Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012, Code Aurora Forum. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /** ------------------------------------------------------------------------- * |
| 23 | ------------------------------------------------------------------------- * |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 24 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 25 | |
| 26 | \file csrApiRoam.c |
| 27 | |
| 28 | Implementation for the Common Roaming interfaces. |
| 29 | |
| 30 | Copyright (C) 2008 Qualcomm, Incorporated |
| 31 | |
| 32 | |
| 33 | ========================================================================== */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 34 | /*=========================================================================== |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 35 | EDIT HISTORY FOR FILE |
| 36 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 37 | This section contains comments describing changes made to the module. |
| 38 | Notice that changes are listed in reverse chronological order. |
| 39 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 40 | when who what, where, why |
| 41 | ---------- --- -------------------------------------------------------- |
| 42 | 06/03/10 js Added support to hostapd driven |
| 43 | * deauth/disassoc/mic failure |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 44 | ===========================================================================*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 45 | #include "aniGlobal.h" //for tpAniSirGlobal |
| 46 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 47 | #ifdef FEATURE_WLAN_INTEGRATED_SOC |
| 48 | #include "halMsgApi.h" //for HAL_STA_INVALID_IDX. |
| 49 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 50 | #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC |
| 51 | #include "halPhyApi.h" |
| 52 | #include "halInternal.h" |
| 53 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 54 | #include "limUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | #include "palApi.h" |
| 56 | #include "csrInsideApi.h" |
| 57 | #include "smsDebug.h" |
| 58 | #include "logDump.h" |
| 59 | #include "smeQosInternal.h" |
| 60 | #include "wlan_qct_tl.h" |
| 61 | #include "smeInside.h" |
| 62 | #include "vos_diag_core_event.h" |
| 63 | #include "vos_diag_core_log.h" |
| 64 | #include "csrApi.h" |
| 65 | #include "pmc.h" |
| 66 | #include "vos_nvitem.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 67 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 68 | #include "csrNeighborRoam.h" |
| 69 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 70 | #ifdef FEATURE_WLAN_CCX |
| 71 | #include "csrCcx.h" |
| 72 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 73 | #define CSR_NUM_IBSS_START_CHANNELS_50 4 |
| 74 | #define CSR_NUM_IBSS_START_CHANNELS_24 3 |
| 75 | #define CSR_DEF_IBSS_START_CHANNEL_50 36 |
| 76 | #define CSR_DEF_IBSS_START_CHANNEL_24 1 |
| 77 | #define CSR_IBSS_JOIN_TIMEOUT_PERIOD ( 1 * PAL_TIMER_TO_SEC_UNIT ) // 1 second |
| 78 | #define CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD ( 50 * PAL_TIMER_TO_SEC_UNIT ) // 50 seconds, for WPA, WPA2, CCKM |
| 79 | #define CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD ( 120 * PAL_TIMER_TO_SEC_UNIT ) // 120 seconds, for WPS |
| 80 | /*--------------------------------------------------------------------------- |
| 81 | OBIWAN recommends [8 10]% : pick 9% |
| 82 | ---------------------------------------------------------------------------*/ |
| 83 | #define CSR_VCC_UL_MAC_LOSS_THRESHOLD 9 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 84 | /*--------------------------------------------------------------------------- |
| 85 | OBIWAN recommends -85dBm |
| 86 | ---------------------------------------------------------------------------*/ |
| 87 | #define CSR_VCC_RSSI_THRESHOLD 80 |
| 88 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD 500 //ms |
| 89 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS 2000 //ms |
| 90 | #define CSR_MIN_TL_STAT_QUERY_PERIOD 500 //ms |
| 91 | #define CSR_DIAG_LOG_STAT_PERIOD 3000 //ms |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 92 | //We use constatnt 4 here |
| 93 | //This macro returns true when higher AC parameter is bigger than lower AC for a difference |
| 94 | //The bigger the number, the less chance of TX |
| 95 | //It must put lower AC as the first parameter. |
| 96 | #define SME_DETECT_AC_WEIGHT_DIFF(loAC, hiAC) (v_BOOL_t)(((hiAC) > (loAC)) ? (((hiAC)-(loAC)) > 4) : 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 97 | //Flag to send/do not send disassoc frame over the air |
| 98 | #define CSR_DONT_SEND_DISASSOC_OVER_THE_AIR 1 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 99 | #define RSSI_HACK_BMPS (-40) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 100 | #define MAX_CB_VALUE_IN_INI (2) |
| 101 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 102 | /*-------------------------------------------------------------------------- |
| 103 | Static Type declarations |
| 104 | ------------------------------------------------------------------------*/ |
| 105 | static tChannelListWithPower csrRoamPowerTableFromEeprom[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 106 | static tChannelListWithPower csrRoamPowerTableFromEeprom40MHz[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 107 | static tCsrRoamSession csrRoamRoamSession[CSR_ROAM_SESSION_MAX]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | /*-------------------------------------------------------------------------- |
| 109 | Type declarations |
| 110 | ------------------------------------------------------------------------*/ |
| 111 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 112 | int diagAuthTypeFromCSRType(eCsrAuthType authType) |
| 113 | { |
| 114 | int n = AUTH_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 115 | switch(authType) |
| 116 | { |
| 117 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 118 | n = AUTH_SHARED; |
| 119 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 120 | case eCSR_AUTH_TYPE_WPA: |
| 121 | n = AUTH_WPA_EAP; |
| 122 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 123 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 124 | n = AUTH_WPA_PSK; |
| 125 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 126 | case eCSR_AUTH_TYPE_RSN: |
| 127 | n = AUTH_WPA2_EAP; |
| 128 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 129 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 130 | n = AUTH_WPA2_PSK; |
| 131 | break; |
| 132 | #ifdef FEATURE_WLAN_WAPI |
| 133 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 134 | n = AUTH_WAPI_CERT; |
| 135 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 136 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 137 | n = AUTH_WAPI_PSK; |
| 138 | break; |
| 139 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 140 | default: |
| 141 | break; |
| 142 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 143 | return (n); |
| 144 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 145 | int diagEncTypeFromCSRType(eCsrEncryptionType encType) |
| 146 | { |
| 147 | int n = ENC_MODE_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 148 | switch(encType) |
| 149 | { |
| 150 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 151 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 152 | n = ENC_MODE_WEP40; |
| 153 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 154 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 155 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 156 | n = ENC_MODE_WEP104; |
| 157 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 158 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 159 | n = ENC_MODE_TKIP; |
| 160 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 161 | case eCSR_ENCRYPT_TYPE_AES: |
| 162 | n = ENC_MODE_AES; |
| 163 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 164 | #ifdef FEATURE_WLAN_WAPI |
| 165 | case eCSR_ENCRYPT_TYPE_WPI: |
| 166 | n = ENC_MODE_SMS4; |
| 167 | break; |
| 168 | #endif /* FEATURE_WLAN_WAPI */ |
| 169 | default: |
| 170 | break; |
| 171 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 172 | return (n); |
| 173 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 174 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 175 | static const tANI_U8 csrStartIbssChannels50[ CSR_NUM_IBSS_START_CHANNELS_50 ] = { 36, 40, 44, 48}; |
| 176 | static const tANI_U8 csrStartIbssChannels24[ CSR_NUM_IBSS_START_CHANNELS_24 ] = { 1, 6, 11 }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 177 | static void initConfigParam(tpAniSirGlobal pMac); |
| 178 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 179 | eCsrRoamCompleteResult Result, void *Context ); |
| 180 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 181 | tCsrRoamProfile *pProfile, |
| 182 | tANI_BOOLEAN *pfSameIbss ); |
| 183 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirSmeNewBssInfo *pNewBss ); |
| 184 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 185 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes); |
| 186 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 187 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac); |
| 188 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ); |
| 189 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac); |
| 190 | eHalStatus csrRoamClose(tpAniSirGlobal pMac); |
| 191 | void csrRoamMICErrorTimerHandler(void *pv); |
| 192 | void csrRoamTKIPCounterMeasureTimerHandler(void *pv); |
| 193 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2); |
| 194 | |
| 195 | static eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 196 | static eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 197 | static void csrRoamRoamingTimerHandler(void *pv); |
| 198 | eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 199 | eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 200 | static void csrRoamIbssJoinTimerHandler(void *pv); |
| 201 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval); |
| 202 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac); |
| 203 | static void csrRoamWaitForKeyTimeOutHandler(void *pv); |
| 204 | |
| 205 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 206 | static eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 207 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ); |
| 208 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 209 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 210 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 211 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 212 | tANI_U8 *pKeyRsc ); |
| 213 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 214 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, |
| 215 | tCsrRoamProfile *pProfile ); |
| 216 | void csrRoamStatisticsTimerHandler(void *pv); |
| 217 | void csrRoamStatsGlobalClassDTimerHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 218 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid); |
| 219 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 220 | v_U8_t rssiNotification, |
| 221 | void * context); |
| 222 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 223 | void csrRoamVccTrigger(tpAniSirGlobal pMac); |
| 224 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId); |
| 225 | /* |
| 226 | pStaEntry is no longer invalid upon the return of this function. |
| 227 | */ |
| 228 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 229 | #ifdef WLAN_SOFTAP_FEATURE |
| 230 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile,tANI_U8 operationChn, eCsrBand *pBand ); |
| 231 | #else |
| 232 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, eCsrPhyMode phyModeIn, tANI_U8 operationChn, eCsrBand *pBand ); |
| 233 | #endif |
| 234 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 235 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 236 | tDblLinkList *pStaList, |
| 237 | tCsrStatsClientReqInfo *pStaEntry); |
| 238 | void csrRoamStatsClientTimerHandler(void *pv); |
| 239 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 240 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId); |
| 241 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 242 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 243 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 244 | void csrRoamTlStatsTimerHandler(void *pv); |
| 245 | void csrRoamPeStatsTimerHandler(void *pv); |
| 246 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 247 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry); |
| 248 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 249 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac); |
| 250 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ); |
| 251 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ); |
| 252 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ); |
| 253 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 254 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ); |
| 255 | //static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ); |
| 256 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
| 257 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac); |
| 258 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 259 | void csrRoamJoinRetryTimerHandler(void *pv); |
| 260 | #endif |
| 261 | extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 262 | extern void btampEstablishLogLinkHdlr(void* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 263 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp); |
| 264 | |
| 265 | //Initialize global variables |
| 266 | static void csrRoamInitGlobals(tpAniSirGlobal pMac) |
| 267 | { |
| 268 | if(pMac) |
| 269 | { |
| 270 | pMac->roam.powerTableFromEeprom = csrRoamPowerTableFromEeprom; |
| 271 | pMac->roam.powerTableFromEeprom40MHz = csrRoamPowerTableFromEeprom40MHz; |
| 272 | pMac->roam.roamSession = csrRoamRoamSession; |
| 273 | } |
| 274 | return; |
| 275 | } |
| 276 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 277 | static void csrRoamDeInitGlobals(tpAniSirGlobal pMac) |
| 278 | { |
| 279 | if(pMac) |
| 280 | { |
| 281 | pMac->roam.powerTableFromEeprom = NULL; |
| 282 | pMac->roam.powerTableFromEeprom40MHz = NULL; |
| 283 | pMac->roam.roamSession = NULL; |
| 284 | } |
| 285 | return; |
| 286 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 287 | eHalStatus csrOpen(tpAniSirGlobal pMac) |
| 288 | { |
| 289 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 290 | static uNvTables nvTables; |
| 291 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 292 | v_REGDOMAIN_t regId; |
| 293 | tANI_U32 i; |
| 294 | |
| 295 | do |
| 296 | { |
| 297 | /* Initialize CSR Roam Globals */ |
| 298 | csrRoamInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 299 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 300 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i); |
| 301 | |
| 302 | initConfigParam(pMac); |
| 303 | if(!HAL_STATUS_SUCCESS((status = csrScanOpen(pMac)))) |
| 304 | break; |
| 305 | if(!HAL_STATUS_SUCCESS((status = csrRoamOpen(pMac)))) |
| 306 | break; |
| 307 | pMac->roam.nextRoamId = 1; //Must not be 0 |
| 308 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.statsClientReqList))) |
| 309 | break; |
| 310 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.peStatsReqList))) |
| 311 | break; |
| 312 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.roamCmdPendingList))) |
| 313 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 314 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 315 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 316 | { |
| 317 | palCopyMemory( pMac->hHdd, pMac->scan.countryCodeDefault, |
| 318 | nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN ); |
| 319 | status = eHAL_STATUS_SUCCESS; |
| 320 | } |
| 321 | else |
| 322 | { |
| 323 | smsLog( pMac, LOGE, FL(" fail to get NV_FIELD_IMAGE\n") ); |
| 324 | //hardcoded for now |
| 325 | pMac->scan.countryCodeDefault[0] = 'U'; |
| 326 | pMac->scan.countryCodeDefault[1] = 'S'; |
| 327 | pMac->scan.countryCodeDefault[2] = 'I'; |
| 328 | //status = eHAL_STATUS_SUCCESS; |
| 329 | } |
| 330 | smsLog( pMac, LOGE, FL(" country Code from nvRam %s\n"), pMac->scan.countryCodeDefault ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 331 | csrGetRegulatoryDomainForCountry(pMac, pMac->scan.countryCodeDefault, ®Id); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 332 | WDA_SetRegDomain(pMac, regId); |
| 333 | pMac->scan.domainIdDefault = regId; |
| 334 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 335 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 336 | pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN); |
| 337 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 338 | }while(0); |
| 339 | |
| 340 | return (status); |
| 341 | } |
| 342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 343 | #ifdef WLAN_SOFTAP_FEATURE |
| 344 | eHalStatus csrSetRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode) |
| 345 | { |
| 346 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 347 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 348 | v_REGDOMAIN_t regId; |
| 349 | v_U8_t cntryCodeLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 350 | if(NULL == apCntryCode) |
| 351 | { |
| 352 | smsLog( pMac, LOGW, FL(" Invalid country Code Pointer\n") ); |
| 353 | return eHAL_STATUS_FAILURE; |
| 354 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | smsLog( pMac, LOGW, FL(" country Code %s\n"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 356 | /* To get correct Regulatory domain from NV table |
| 357 | * 2 character Country code should be used |
| 358 | * 3rd charater is optional for indoor/outdoor setting */ |
| 359 | cntryCodeLength = strlen(apCntryCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 360 | status = csrGetRegulatoryDomainForCountry(pMac, apCntryCode, ®Id); |
| 361 | if (status != eHAL_STATUS_SUCCESS) |
| 362 | { |
| 363 | smsLog( pMac, LOGE, FL(" fail to get regId for country Code %s\n"), apCntryCode ); |
| 364 | return status; |
| 365 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 366 | status = WDA_SetRegDomain(hHal, regId); |
| 367 | if (status != eHAL_STATUS_SUCCESS) |
| 368 | { |
| 369 | smsLog( pMac, LOGE, FL(" fail to get regId for country Code %s\n"), apCntryCode ); |
| 370 | return status; |
| 371 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 372 | pMac->scan.domainIdDefault = regId; |
| 373 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 374 | /* Clear CC field */ |
| 375 | palFillMemory( pMac->hHdd, |
| 376 | pMac->scan.countryCodeDefault, |
| 377 | WNI_CFG_COUNTRY_CODE_LEN, |
| 378 | 0 ); |
| 379 | /* Copy 2 or 3 bytes country code */ |
| 380 | palCopyMemory( pMac->hHdd, pMac->scan.countryCodeDefault, |
| 381 | apCntryCode, cntryCodeLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 382 | /* If 2 bytes country code, 3rd byte must be filled with space */ |
| 383 | if((WNI_CFG_COUNTRY_CODE_LEN - 1) == cntryCodeLength) |
| 384 | { |
| 385 | palFillMemory( pMac->hHdd, |
| 386 | pMac->scan.countryCodeDefault + 2, |
| 387 | 1, |
| 388 | 0x20 ); |
| 389 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 390 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 391 | pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN); |
| 392 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 393 | return status; |
| 394 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 395 | eHalStatus csrSetChannels(tHalHandle hHal, tCsrConfigParam *pParam ) |
| 396 | { |
| 397 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 398 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 399 | tANI_U8 index = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 400 | palCopyMemory( pMac->hHdd, pParam->Csr11dinfo.countryCode, |
| 401 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 402 | for ( index = 0; index < pMac->scan.base20MHzChannels.numChannels ; index++) |
| 403 | { |
| 404 | pParam->Csr11dinfo.Channels.channelList[index] = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 405 | pParam->Csr11dinfo.ChnPower[index].firstChannel = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 406 | pParam->Csr11dinfo.ChnPower[index].numChannels = 1; |
| 407 | pParam->Csr11dinfo.ChnPower[index].maxtxPower = pMac->scan.defaultPowerTable[index].pwr; |
| 408 | } |
| 409 | pParam->Csr11dinfo.Channels.numChannels = pMac->scan.base20MHzChannels.numChannels; |
| 410 | |
| 411 | return status; |
| 412 | } |
| 413 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 414 | eHalStatus csrClose(tpAniSirGlobal pMac) |
| 415 | { |
| 416 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 417 | |
| 418 | csrStop(pMac); |
| 419 | csrRoamClose(pMac); |
| 420 | csrScanClose(pMac); |
| 421 | csrLLClose(&pMac->roam.statsClientReqList); |
| 422 | csrLLClose(&pMac->roam.peStatsReqList); |
| 423 | csrLLClose(&pMac->roam.roamCmdPendingList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 424 | /* DeInit Globals */ |
| 425 | csrRoamDeInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 426 | return (status); |
| 427 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 428 | eHalStatus csrStart(tpAniSirGlobal pMac) |
| 429 | { |
| 430 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 431 | tANI_U32 i; |
| 432 | |
| 433 | do |
| 434 | { |
| 435 | //save the global vos context |
| 436 | pMac->roam.gVosContext = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 437 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 438 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, i ); |
| 439 | |
| 440 | status = csrRoamStart(pMac); |
| 441 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 442 | pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE; |
| 443 | status = pmcRegisterPowerSaveCheck(pMac, csrCheckPSReady, pMac); |
| 444 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 445 | pMac->roam.sPendingCommands = 0; |
| 446 | csrScanEnable(pMac); |
| 447 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 448 | status = csrNeighborRoamInit(pMac); |
| 449 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
| 450 | pMac->roam.tlStatsReqInfo.numClient = 0; |
| 451 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 452 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 453 | //init the link quality indication also |
| 454 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND; |
| 455 | if(!HAL_STATUS_SUCCESS(status)) |
| 456 | { |
| 457 | smsLog(pMac, LOGW, " csrStart: Couldn't Init HO control blk \n"); |
| 458 | break; |
| 459 | } |
| 460 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 461 | #if defined(ANI_LOGDUMP) |
| 462 | csrDumpInit(pMac); |
| 463 | #endif //#if defined(ANI_LOGDUMP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 464 | return (status); |
| 465 | } |
| 466 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 467 | eHalStatus csrStop(tpAniSirGlobal pMac) |
| 468 | { |
| 469 | tANI_U32 sessionId; |
| 470 | tANI_U32 i; |
| 471 | |
| 472 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 473 | { |
| 474 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 475 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 476 | csrScanDisable(pMac); |
| 477 | pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE; |
| 478 | pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 479 | csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE ); |
| 480 | |
| 481 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 482 | csrNeighborRoamClose(pMac); |
| 483 | #endif |
| 484 | csrScanFlushResult(pMac); //Do we want to do this? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 485 | // deregister from PMC since we register during csrStart() |
| 486 | // (ignore status since there is nothing we can do if it fails) |
| 487 | (void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 488 | //Reset the domain back to the deault |
| 489 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
| 490 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE); |
| 491 | |
| 492 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 493 | { |
| 494 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP ,i ); |
| 495 | pMac->roam.curSubState[i] = eCSR_ROAM_SUBSTATE_NONE; |
| 496 | } |
| 497 | |
| 498 | return (eHAL_STATUS_SUCCESS); |
| 499 | } |
| 500 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 501 | eHalStatus csrReady(tpAniSirGlobal pMac) |
| 502 | { |
| 503 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 504 | csrScanGetSupportedChannels( pMac ); |
| 505 | //WNI_CFG_VALID_CHANNEL_LIST should be set by this time |
| 506 | //use it to init the background scan list |
| 507 | csrInitBGScanChannelList(pMac); |
| 508 | /* HDD issues the init scan */ |
| 509 | csrScanStartResultAgingTimer(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 510 | //Store the AC weights in TL for later use |
| 511 | WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 512 | status = csrInitChannelList( pMac ); |
| 513 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 514 | { |
| 515 | smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d\n", |
| 516 | status ); |
| 517 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 518 | return (status); |
| 519 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 520 | void csrSetDefaultDot11Mode( tpAniSirGlobal pMac ) |
| 521 | { |
| 522 | v_U32_t wniDot11mode = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 523 | wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode); |
| 524 | ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE); |
| 525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 526 | void csrSetGlobalCfgs( tpAniSirGlobal pMac ) |
| 527 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 529 | ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 530 | ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 531 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 532 | ((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled), |
| 533 | NULL, eANI_BOOLEAN_FALSE); |
| 534 | ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 535 | /* 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 |
| 536 | * Once session is established we will use the session related params stored in PE session for CB mode |
| 537 | */ |
| 538 | ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, !!(pMac->roam.configParam.channelBondingMode5GHz), NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 539 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE); |
| 540 | |
| 541 | //Update the operating mode to configured value during initialization, |
| 542 | //So that client can advertise full capabilities in Probe request frame. |
| 543 | csrSetDefaultDot11Mode( pMac ); |
| 544 | } |
| 545 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 546 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac) |
| 547 | { |
| 548 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 549 | tANI_U32 i; |
| 550 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 551 | do |
| 552 | { |
| 553 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 554 | { |
| 555 | pSession = CSR_GET_SESSION( pMac, i ); |
| 556 | pSession->roamingTimerInfo.pMac = pMac; |
| 557 | pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 558 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 559 | pMac->roam.WaitForKeyTimerInfo.pMac = pMac; |
| 560 | pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 561 | status = palTimerAlloc(pMac->hHdd, &pMac->roam.hTimerWaitForKey, csrRoamWaitForKeyTimeOutHandler, |
| 562 | &pMac->roam.WaitForKeyTimerInfo); |
| 563 | if(!HAL_STATUS_SUCCESS(status)) |
| 564 | { |
| 565 | smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer\n")); |
| 566 | break; |
| 567 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 568 | status = palTimerAlloc(pMac->hHdd, &pMac->roam.tlStatsReqInfo.hTlStatsTimer, csrRoamTlStatsTimerHandler, pMac); |
| 569 | if(!HAL_STATUS_SUCCESS(status)) |
| 570 | { |
| 571 | smsLog(pMac, LOGE, FL("cannot allocate memory for summary Statistics timer\n")); |
| 572 | return eHAL_STATUS_FAILURE; |
| 573 | } |
| 574 | }while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 575 | return (status); |
| 576 | } |
| 577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 578 | eHalStatus csrRoamClose(tpAniSirGlobal pMac) |
| 579 | { |
| 580 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 581 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 582 | { |
| 583 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 584 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 585 | palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey); |
| 586 | palTimerFree(pMac->hHdd, pMac->roam.hTimerWaitForKey); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 587 | palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 588 | palTimerFree(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 589 | return (eHAL_STATUS_SUCCESS); |
| 590 | } |
| 591 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 592 | eHalStatus csrRoamStart(tpAniSirGlobal pMac) |
| 593 | { |
| 594 | (void)pMac; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 595 | return (eHAL_STATUS_SUCCESS); |
| 596 | } |
| 597 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 598 | void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 599 | { |
| 600 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 601 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 602 | csrRoamDeregStatisticsReq(pMac); |
| 603 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 604 | eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState) |
| 605 | { |
| 606 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 607 | if( pState ) |
| 608 | { |
| 609 | status = eHAL_STATUS_SUCCESS; |
| 610 | *pState = pMac->roam.roamSession[sessionId].connectState; |
| 611 | } |
| 612 | return (status); |
| 613 | } |
| 614 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 615 | eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 616 | { |
| 617 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 618 | tANI_U32 size = 0; |
| 619 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 620 | |
| 621 | if(pProfile) |
| 622 | { |
| 623 | if(pSession->pConnectBssDesc) |
| 624 | { |
| 625 | do |
| 626 | { |
| 627 | size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length); |
| 628 | if(size) |
| 629 | { |
| 630 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile->pBssDesc, size); |
| 631 | if(HAL_STATUS_SUCCESS(status)) |
| 632 | { |
| 633 | palCopyMemory(pMac->hHdd, pProfile->pBssDesc, pSession->pConnectBssDesc, size); |
| 634 | } |
| 635 | else |
| 636 | break; |
| 637 | } |
| 638 | else |
| 639 | { |
| 640 | pProfile->pBssDesc = NULL; |
| 641 | } |
| 642 | pProfile->AuthType = pSession->connectedProfile.AuthType; |
| 643 | pProfile->EncryptionType = pSession->connectedProfile.EncryptionType; |
| 644 | pProfile->mcEncryptionType = pSession->connectedProfile.mcEncryptionType; |
| 645 | pProfile->BSSType = pSession->connectedProfile.BSSType; |
| 646 | pProfile->operationChannel = pSession->connectedProfile.operationChannel; |
| 647 | pProfile->CBMode = pSession->connectedProfile.CBMode; |
| 648 | palCopyMemory(pMac->hHdd, &pProfile->bssid, &pSession->connectedProfile.bssid, sizeof(tCsrBssid)); |
| 649 | palCopyMemory(pMac->hHdd, &pProfile->SSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid)); |
| 650 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 651 | if (pSession->connectedProfile.MDID.mdiePresent) |
| 652 | { |
| 653 | pProfile->MDID.mdiePresent = 1; |
| 654 | pProfile->MDID.mobilityDomain = pSession->connectedProfile.MDID.mobilityDomain; |
| 655 | } |
| 656 | else |
| 657 | { |
| 658 | pProfile->MDID.mdiePresent = 0; |
| 659 | pProfile->MDID.mobilityDomain = 0; |
| 660 | } |
| 661 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 662 | #ifdef FEATURE_WLAN_CCX |
| 663 | pProfile->isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 664 | if (csrIsAuthTypeCCX(pSession->connectedProfile.AuthType)) |
| 665 | { |
| 666 | palCopyMemory( pMac->hHdd, pProfile->ccxCckmInfo.krk, |
| 667 | pSession->connectedProfile.ccxCckmInfo.krk, CSR_KRK_KEY_LEN ); |
| 668 | pProfile->ccxCckmInfo.reassoc_req_num= |
| 669 | pSession->connectedProfile.ccxCckmInfo.reassoc_req_num; |
| 670 | pProfile->ccxCckmInfo.krk_plumbed = |
| 671 | pSession->connectedProfile.ccxCckmInfo.krk_plumbed; |
| 672 | } |
| 673 | #endif |
| 674 | }while(0); |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | return (status); |
| 679 | } |
| 680 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 681 | eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 682 | { |
| 683 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 684 | |
| 685 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 686 | { |
| 687 | if(pProfile) |
| 688 | { |
| 689 | status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile); |
| 690 | } |
| 691 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 692 | return (status); |
| 693 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 694 | eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile) |
| 695 | { |
| 696 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 697 | |
| 698 | if(pProfile->pBssDesc) |
| 699 | { |
| 700 | palFreeMemory(pMac->hHdd, pProfile->pBssDesc); |
| 701 | } |
| 702 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamConnectedProfile)); |
| 703 | pProfile->AuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 704 | return (status); |
| 705 | } |
| 706 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 707 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ) |
| 708 | { |
| 709 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 710 | if( pConnectedInfo->pbFrames ) |
| 711 | { |
| 712 | palFreeMemory( pMac->hHdd, pConnectedInfo->pbFrames ); |
| 713 | pConnectedInfo->pbFrames = NULL; |
| 714 | } |
| 715 | pConnectedInfo->nBeaconLength = 0; |
| 716 | pConnectedInfo->nAssocReqLength = 0; |
| 717 | pConnectedInfo->nAssocRspLength = 0; |
| 718 | pConnectedInfo->staId = 0; |
| 719 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 720 | pConnectedInfo->nRICRspLength = 0; |
| 721 | #endif |
| 722 | #ifdef FEATURE_WLAN_CCX |
| 723 | pConnectedInfo->nTspecIeLength = 0; |
| 724 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 725 | return ( status ); |
| 726 | } |
| 727 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 728 | |
| 729 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 730 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 731 | void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 732 | { |
| 733 | csrReinitRoamCmd(pMac, pCommand); |
| 734 | csrReleaseCommand( pMac, pCommand ); |
| 735 | } |
| 736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 737 | void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 738 | { |
| 739 | csrReinitScanCmd(pMac, pCommand); |
| 740 | csrReleaseCommand( pMac, pCommand ); |
| 741 | } |
| 742 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 743 | void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 744 | { |
| 745 | csrReinitWmStatusChangeCmd(pMac, pCommand); |
| 746 | csrReleaseCommand( pMac, pCommand ); |
| 747 | } |
| 748 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 749 | void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 750 | { |
| 751 | palZeroMemory(pMac->hHdd, &pCommand->u.setKeyCmd, sizeof(tSetKeyCmd)); |
| 752 | } |
| 753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 754 | void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 755 | { |
| 756 | palZeroMemory(pMac->hHdd, &pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd)); |
| 757 | } |
| 758 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 759 | void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 760 | { |
| 761 | csrReinitSetKeyCmd(pMac, pCommand); |
| 762 | csrReleaseCommand( pMac, pCommand ); |
| 763 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 765 | { |
| 766 | csrReinitRemoveKeyCmd(pMac, pCommand); |
| 767 | csrReleaseCommand( pMac, pCommand ); |
| 768 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 769 | void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping ) |
| 770 | { |
| 771 | |
| 772 | if( eSmeCsrCommandMask & pCommand->command ) |
| 773 | { |
| 774 | switch (pCommand->command) |
| 775 | { |
| 776 | case eSmeCommandScan: |
| 777 | // We need to inform the requester before droping the scan command |
| 778 | smsLog( pMac, LOGW, "%s: Drop scan reason %d callback 0x%X\n", |
| 779 | __FUNCTION__, pCommand->u.scanCmd.reason, (unsigned int)pCommand->u.scanCmd.callback); |
| 780 | if (NULL != pCommand->u.scanCmd.callback) |
| 781 | { |
| 782 | smsLog( pMac, LOGW, "%s callback scan requester\n", __FUNCTION__); |
| 783 | csrScanCallCallback(pMac, pCommand, eCSR_SCAN_ABORT); |
| 784 | } |
| 785 | csrReleaseCommandScan( pMac, pCommand ); |
| 786 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 787 | case eSmeCommandRoam: |
| 788 | csrReleaseCommandRoam( pMac, pCommand ); |
| 789 | break; |
| 790 | |
| 791 | case eSmeCommandWmStatusChange: |
| 792 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 793 | break; |
| 794 | |
| 795 | case eSmeCommandSetKey: |
| 796 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 797 | break; |
| 798 | |
| 799 | case eSmeCommandRemoveKey: |
| 800 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 801 | break; |
| 802 | |
| 803 | default: |
| 804 | smsLog( pMac, LOGW, " CSR abort standard command %d\n", pCommand->command ); |
| 805 | csrReleaseCommand( pMac, pCommand ); |
| 806 | break; |
| 807 | } |
| 808 | } |
| 809 | } |
| 810 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 811 | void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId) |
| 812 | { |
| 813 | smsLog( pMac, LOG1, " CSR RoamSubstate: [ %d <== %d ]\n", NewSubstate, pMac->roam.curSubState[sessionId]); |
| 814 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 815 | if(pMac->roam.curSubState[sessionId] == NewSubstate) |
| 816 | { |
| 817 | return; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 819 | pMac->roam.curSubState[sessionId] = NewSubstate; |
| 820 | } |
| 821 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 822 | eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId) |
| 823 | { |
| 824 | eCsrRoamState PreviousState; |
| 825 | |
| 826 | smsLog( pMac, LOG1, "CSR RoamState: [ %d <== %d ]\n", NewRoamState, pMac->roam.curState[sessionId]); |
| 827 | |
| 828 | PreviousState = pMac->roam.curState[sessionId]; |
| 829 | |
| 830 | if ( NewRoamState != pMac->roam.curState[sessionId] ) |
| 831 | { |
| 832 | // Whenever we transition OUT of the Roaming state, clear the Roaming substate... |
| 833 | if ( CSR_IS_ROAM_JOINING(pMac, sessionId) ) |
| 834 | { |
| 835 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 836 | } |
| 837 | |
| 838 | pMac->roam.curState[sessionId] = NewRoamState; |
| 839 | } |
| 840 | return( PreviousState ); |
| 841 | } |
| 842 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 843 | void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset) |
| 844 | { |
| 845 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 846 | if(catOffset) |
| 847 | { |
| 848 | pMac->roam.configParam.bCatRssiOffset = catOffset; |
| 849 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 850 | { |
| 851 | pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)CSR_BEST_RSSI_VALUE - (int)(i * catOffset); |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 856 | static void initConfigParam(tpAniSirGlobal pMac) |
| 857 | { |
| 858 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 859 | pMac->roam.configParam.agingCount = CSR_AGING_COUNT; |
| 860 | pMac->roam.configParam.channelBondingMode24GHz = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 861 | pMac->roam.configParam.channelBondingMode5GHz = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 863 | pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 864 | pMac->roam.configParam.eBand = eCSR_BAND_ALL; |
| 865 | pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 866 | pMac->roam.configParam.FragmentationThreshold = eCSR_DOT11_FRAG_THRESH_DEFAULT; |
| 867 | pMac->roam.configParam.HeartbeatThresh24 = 40; |
| 868 | pMac->roam.configParam.HeartbeatThresh50 = 40; |
| 869 | pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE; |
| 870 | pMac->roam.configParam.Is11dSupportEnabledOriginal = eANI_BOOLEAN_FALSE; |
| 871 | pMac->roam.configParam.Is11eSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 872 | pMac->roam.configParam.Is11hSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 873 | pMac->roam.configParam.RTSThreshold = 2346; |
| 874 | pMac->roam.configParam.shortSlotTime = eANI_BOOLEAN_TRUE; |
| 875 | pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto; |
| 876 | pMac->roam.configParam.ProprietaryRatesEnabled = eANI_BOOLEAN_TRUE; |
| 877 | pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO; |
| 878 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 879 | pMac->roam.configParam.scanAgeTimeNCNPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS; |
| 880 | pMac->roam.configParam.scanAgeTimeNCPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS; |
| 881 | pMac->roam.configParam.scanAgeTimeCNPS = CSR_SCAN_AGING_TIME_CONNECT_NO_PS; |
| 882 | pMac->roam.configParam.scanAgeTimeCPS = CSR_SCAN_AGING_TIME_CONNECT_W_PS; |
| 883 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 884 | { |
| 885 | pMac->roam.configParam.BssPreferValue[i] = i; |
| 886 | } |
| 887 | csrAssignRssiForCategory(pMac, CSR_DEFAULT_RSSI_DB_GAP); |
| 888 | pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME; |
| 889 | pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE; |
| 890 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 891 | pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE; |
| 892 | pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE; |
| 893 | pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; |
| 894 | pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; |
| 895 | pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME; |
| 896 | pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 897 | pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default |
| 898 | pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; |
| 899 | pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; |
| 900 | pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 901 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 902 | pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0; |
| 903 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 904 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 905 | pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3; |
| 906 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120; |
| 907 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = 125; |
| 908 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20; |
| 909 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40; |
| 910 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = 200; |
| 911 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels = 3; |
| 912 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[0] = 1; |
| 913 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[1] = 6; |
| 914 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11; |
| 915 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds |
| 916 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 917 | #ifdef WLAN_FEATURE_11AC |
| 918 | pMac->roam.configParam.nVhtChannelWidth = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1; |
| 919 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 920 | |
| 921 | pMac->roam.configParam.addTSWhenACMIsOff = 0; |
| 922 | pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 923 | #ifndef BMPS_WORKAROUND_NOT_NEEDED |
| 924 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 925 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 926 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 927 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 928 | eCsrBand csrGetCurrentBand(tHalHandle hHal) |
| 929 | { |
| 930 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 931 | return pMac->roam.configParam.bandCapability; |
| 932 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 933 | eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand) |
| 934 | { |
| 935 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 936 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 937 | if (CSR_IS_PHY_MODE_A_ONLY(pMac) && |
| 938 | (eBand == eCSR_BAND_24)) |
| 939 | { |
| 940 | /* DOT11 mode configured to 11a only and received |
| 941 | request to change the band to 2.4 GHz */ |
| 942 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 943 | "failed to set band cfg80211 = %u, band = %u\n", |
| 944 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 945 | return eHAL_STATUS_INVALID_PARAMETER; |
| 946 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 947 | if ((CSR_IS_PHY_MODE_B_ONLY(pMac) || |
| 948 | CSR_IS_PHY_MODE_G_ONLY(pMac)) && |
| 949 | (eBand == eCSR_BAND_5G)) |
| 950 | { |
| 951 | /* DOT11 mode configured to 11b/11g only and received |
| 952 | request to change the band to 5 GHz */ |
| 953 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 954 | "failed to set band dot11mode = %u, band = %u\n", |
| 955 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 956 | return eHAL_STATUS_INVALID_PARAMETER; |
| 957 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 958 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 959 | "Band changed to %u (0 - ALL, 1 - 2.4 GHZ, 2 - 5GHZ)\n", eBand); |
| 960 | pMac->roam.configParam.eBand = eBand; |
| 961 | pMac->roam.configParam.bandCapability = eBand; |
| 962 | csrScanGetSupportedChannels( pMac ); |
| 963 | status = csrInitGetChannels( pMac ); |
| 964 | if (eHAL_STATUS_SUCCESS == status) |
| 965 | csrInitChannelList( hHal ); |
| 966 | return status; |
| 967 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 968 | /* The funcns csrConvertCBIniValueToPhyCBState and csrConvertPhyCBStateToIniValue have been |
| 969 | * introduced to convert the ini value to the ENUM used in csr and MAC for CB state |
| 970 | * Ideally we should have kept the ini value and enum value same and representing the same |
| 971 | * cb values as in 11n standard i.e. |
| 972 | * Set to 1 (SCA) if the secondary channel is above the primary channel |
| 973 | * Set to 3 (SCB) if the secondary channel is below the primary channel |
| 974 | * Set to 0 (SCN) if no secondary channel is present |
| 975 | * However, since our driver is already distributed we will keep the ini definition as it is which is: |
| 976 | * 0 - secondary none |
| 977 | * 1 - secondary LOW |
| 978 | * 2 - secondary HIGH |
| 979 | * and convert to enum value used within the driver in csrChangeDefaultConfigParam using this funcn |
| 980 | * The enum values are as follows: |
| 981 | * PHY_SINGLE_CHANNEL_CENTERED = 0 |
| 982 | * PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1 |
| 983 | * PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 984 | */ |
| 985 | ePhyChanBondState csrConvertCBIniValueToPhyCBState(v_U32_t cbIniValue) |
| 986 | { |
| 987 | |
| 988 | ePhyChanBondState phyCbState; |
| 989 | switch (cbIniValue) { |
| 990 | // secondary none |
| 991 | case 0: |
| 992 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 993 | break; |
| 994 | // secondary LOW |
| 995 | case 1: |
| 996 | phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 997 | break; |
| 998 | // secondary HIGH |
| 999 | case 2: |
| 1000 | phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 1001 | break; |
| 1002 | #ifdef WLAN_FEATURE_11AC |
| 1003 | case 3: |
| 1004 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
| 1005 | break; |
| 1006 | case 4: |
| 1007 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1008 | break; |
| 1009 | case 5: |
| 1010 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1011 | break; |
| 1012 | case 6: |
| 1013 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
| 1014 | break; |
| 1015 | case 7: |
| 1016 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
| 1017 | break; |
| 1018 | case 8: |
| 1019 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 1020 | break; |
| 1021 | case 9: |
| 1022 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
| 1023 | break; |
| 1024 | #endif |
| 1025 | default: |
| 1026 | // If an invalid value is passed, disable CHANNEL BONDING |
| 1027 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1028 | break; |
| 1029 | } |
| 1030 | return phyCbState; |
| 1031 | } |
| 1032 | |
| 1033 | v_U32_t csrConvertPhyCBStateToIniValue(ePhyChanBondState phyCbState) |
| 1034 | { |
| 1035 | |
| 1036 | v_U32_t cbIniValue; |
| 1037 | switch (phyCbState) { |
| 1038 | // secondary none |
| 1039 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 1040 | cbIniValue = 0; |
| 1041 | break; |
| 1042 | // secondary LOW |
| 1043 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 1044 | cbIniValue = 1; |
| 1045 | break; |
| 1046 | // secondary HIGH |
| 1047 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 1048 | cbIniValue = 2; |
| 1049 | break; |
| 1050 | #ifdef WLAN_FEATURE_11AC |
| 1051 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 1052 | cbIniValue = 3; |
| 1053 | break; |
| 1054 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 1055 | cbIniValue = 4; |
| 1056 | break; |
| 1057 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 1058 | cbIniValue = 5; |
| 1059 | break; |
| 1060 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 1061 | cbIniValue = 6; |
| 1062 | break; |
| 1063 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 1064 | cbIniValue = 7; |
| 1065 | break; |
| 1066 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 1067 | cbIniValue = 8; |
| 1068 | break; |
| 1069 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 1070 | cbIniValue = 9; |
| 1071 | break; |
| 1072 | #endif |
| 1073 | default: |
| 1074 | // return some invalid value |
| 1075 | cbIniValue = 10; |
| 1076 | break; |
| 1077 | } |
| 1078 | return cbIniValue; |
| 1079 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1080 | |
| 1081 | eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1082 | { |
| 1083 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1084 | |
| 1085 | if(pParam) |
| 1086 | { |
| 1087 | pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode; |
| 1088 | pMac->roam.configParam.Is11eSupportEnabled = pParam->Is11eSupportEnabled; |
| 1089 | pMac->roam.configParam.FragmentationThreshold = pParam->FragmentationThreshold; |
| 1090 | pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled; |
| 1091 | pMac->roam.configParam.Is11dSupportEnabledOriginal = pParam->Is11dSupportEnabled; |
| 1092 | pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled; |
| 1093 | |
| 1094 | pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 1095 | /* channelBondingMode5GHz plays a dual role right now |
| 1096 | * 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 |
| 1097 | * This is how channelBondingMode5GHz works now and this is kept intact to avoid any cfg.ini change |
| 1098 | */ |
| 1099 | if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI) |
| 1100 | { |
| 1101 | smsLog( pMac, LOGW, "Invalid CB value from ini in 2.4GHz band %d, CB DISABLED\n", pParam->channelBondingMode24GHz); |
| 1102 | } |
| 1103 | pMac->roam.configParam.channelBondingMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode24GHz); |
| 1104 | if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI) |
| 1105 | { |
| 1106 | smsLog( pMac, LOGW, "Invalid CB value from ini in 5GHz band %d, CB DISABLED\n", pParam->channelBondingMode5GHz); |
| 1107 | } |
| 1108 | pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1109 | pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold; |
| 1110 | pMac->roam.configParam.phyMode = pParam->phyMode; |
| 1111 | pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime; |
| 1112 | pMac->roam.configParam.HeartbeatThresh24 = pParam->HeartbeatThresh24; |
| 1113 | pMac->roam.configParam.HeartbeatThresh50 = pParam->HeartbeatThresh50; |
| 1114 | pMac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled; |
| 1115 | pMac->roam.configParam.TxRate = pParam->TxRate; |
| 1116 | pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; |
| 1117 | pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; |
| 1118 | pMac->roam.configParam.bandCapability = pParam->bandCapability; |
| 1119 | pMac->roam.configParam.cbChoice = pParam->cbChoice; |
| 1120 | pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1121 | //if HDD passed down non zero values then only update, |
| 1122 | //otherwise keep using the defaults |
| 1123 | if(pParam->nActiveMaxChnTime) |
| 1124 | { |
| 1125 | pMac->roam.configParam.nActiveMaxChnTime = pParam->nActiveMaxChnTime; |
| 1126 | } |
| 1127 | if(pParam->nActiveMinChnTime) |
| 1128 | { |
| 1129 | pMac->roam.configParam.nActiveMinChnTime = pParam->nActiveMinChnTime; |
| 1130 | } |
| 1131 | if(pParam->nPassiveMaxChnTime) |
| 1132 | { |
| 1133 | pMac->roam.configParam.nPassiveMaxChnTime = pParam->nPassiveMaxChnTime; |
| 1134 | } |
| 1135 | if(pParam->nPassiveMinChnTime) |
| 1136 | { |
| 1137 | pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime; |
| 1138 | } |
| 1139 | //if upper layer wants to disable idle scan altogether set it to 0 |
| 1140 | if(pParam->impsSleepTime) |
| 1141 | { |
| 1142 | //Change the unit from second to microsecond |
| 1143 | tANI_U32 impsSleepTime = pParam->impsSleepTime * PAL_TIMER_TO_SEC_UNIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1144 | if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime) |
| 1145 | { |
| 1146 | pMac->roam.configParam.impsSleepTime = impsSleepTime; |
| 1147 | } |
| 1148 | else |
| 1149 | { |
| 1150 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 1151 | } |
| 1152 | } |
| 1153 | else |
| 1154 | { |
| 1155 | pMac->roam.configParam.impsSleepTime = 0; |
| 1156 | } |
| 1157 | pMac->roam.configParam.eBand = pParam->eBand; |
| 1158 | #ifdef WLAN_SOFTAP_FEATURE |
| 1159 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, pMac->roam.configParam.phyMode, |
| 1160 | pMac->roam.configParam.ProprietaryRatesEnabled); |
| 1161 | #else |
| 1162 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pMac->roam.configParam.phyMode, |
| 1163 | pMac->roam.configParam.ProprietaryRatesEnabled); |
| 1164 | #endif |
| 1165 | //if HDD passed down non zero values for age params, then only update, |
| 1166 | //otherwise keep using the defaults |
| 1167 | if(pParam->nScanResultAgeCount) |
| 1168 | { |
| 1169 | pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount; |
| 1170 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1171 | if(pParam->scanAgeTimeNCNPS) |
| 1172 | { |
| 1173 | pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS; |
| 1174 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1175 | if(pParam->scanAgeTimeNCPS) |
| 1176 | { |
| 1177 | pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS; |
| 1178 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1179 | if(pParam->scanAgeTimeCNPS) |
| 1180 | { |
| 1181 | pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS; |
| 1182 | } |
| 1183 | if(pParam->scanAgeTimeCPS) |
| 1184 | { |
| 1185 | pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS; |
| 1186 | } |
| 1187 | |
| 1188 | csrAssignRssiForCategory(pMac, pParam->bCatRssiOffset); |
| 1189 | pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime; |
| 1190 | pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels; |
| 1191 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority; |
| 1192 | pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch; |
| 1193 | pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1194 | pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold; |
| 1195 | pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1196 | pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled; |
| 1197 | pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity; |
| 1198 | pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS; |
| 1199 | //Assign this before calling CsrInit11dInfo |
| 1200 | pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1201 | if( csrIs11dSupported( pMac ) ) |
| 1202 | { |
| 1203 | status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo); |
| 1204 | } |
| 1205 | else |
| 1206 | { |
| 1207 | pMac->scan.curScanType = eSIR_ACTIVE_SCAN; |
| 1208 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 1209 | |
| 1210 | /* Initialize the power + channel information if 11h is enabled. |
| 1211 | If 11d is enabled this information has already been initialized */ |
| 1212 | if( csrIs11hSupported( pMac ) && !csrIs11dSupported( pMac ) ) |
| 1213 | { |
| 1214 | csrInitChannelPowerList(pMac, &pParam->Csr11dinfo); |
| 1215 | } |
| 1216 | |
| 1217 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1218 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1219 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.csr11rConfig, &pParam->csr11rConfig, sizeof(tCsr11rConfigParams) ); |
| 1220 | smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d\n", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported); |
| 1221 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1222 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1223 | pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1224 | pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1225 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1226 | #ifdef FEATURE_WLAN_LFR |
| 1227 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled; |
| 1228 | #endif |
| 1229 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1230 | #ifdef FEATURE_WLAN_CCX |
| 1231 | pMac->roam.configParam.isCcxIniFeatureEnabled = pParam->isCcxIniFeatureEnabled; |
| 1232 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1233 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1234 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.neighborRoamConfig, &pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1235 | smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod); |
| 1236 | smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold); |
| 1237 | smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold); |
| 1238 | smsLog( pMac, LOG1, "nNeighborScanMinChanTime = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime); |
| 1239 | smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime); |
| 1240 | smsLog( pMac, LOG1, "nMaxNeighborRetries = %d\n", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries); |
| 1241 | smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1242 | { |
| 1243 | int i; |
| 1244 | smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d\n"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1245 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1246 | { |
| 1247 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1248 | } |
| 1249 | smsLog( pMac, LOG1, "\n"); |
| 1250 | } |
| 1251 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1252 | pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff; |
| 1253 | pMac->scan.fValidateList = pParam->fValidateList; |
| 1254 | pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d; |
| 1255 | pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan; |
| 1256 | pMac->roam.configParam.fScanTwice = pParam->fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 1257 | pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl; |
| 1258 | /* This parameter is not available in cfg and not passed from upper layers. Instead it is initialized here |
| 1259 | * This paramtere is used in concurrency to determine if there are concurrent active sessions. |
| 1260 | * Is used as a temporary fix to disconnect all active sessions when BMPS enabled so the active session if Infra STA |
| 1261 | * will automatically connect back and resume BMPS since resume BMPS is not working when moving from concurrent to |
| 1262 | * single session |
| 1263 | */ |
| 1264 | #ifndef BMPS_WORKAROUND_NOT_NEEDED |
| 1265 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 1266 | #endif |
| 1267 | #ifdef WLAN_FEATURE_11AC |
| 1268 | pMac->roam.configParam.nVhtChannelWidth = pParam->nVhtChannelWidth; |
| 1269 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1270 | } |
| 1271 | |
| 1272 | return status; |
| 1273 | } |
| 1274 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1275 | eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1276 | { |
| 1277 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1278 | if(pParam) |
| 1279 | { |
| 1280 | pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode; |
| 1281 | pParam->Is11eSupportEnabled = pMac->roam.configParam.Is11eSupportEnabled; |
| 1282 | pParam->FragmentationThreshold = pMac->roam.configParam.FragmentationThreshold; |
| 1283 | pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled; |
| 1284 | pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 1285 | pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 1286 | pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz); |
| 1287 | pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1288 | pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold; |
| 1289 | pParam->phyMode = pMac->roam.configParam.phyMode; |
| 1290 | pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 1291 | pParam->HeartbeatThresh24 = pMac->roam.configParam.HeartbeatThresh24; |
| 1292 | pParam->HeartbeatThresh50 = pMac->roam.configParam.HeartbeatThresh50; |
| 1293 | pParam->ProprietaryRatesEnabled = pMac->roam.configParam.ProprietaryRatesEnabled; |
| 1294 | pParam->TxRate = pMac->roam.configParam.TxRate; |
| 1295 | pParam->AdHocChannel24 = pMac->roam.configParam.AdHocChannel24; |
| 1296 | pParam->AdHocChannel5G = pMac->roam.configParam.AdHocChannel5G; |
| 1297 | pParam->bandCapability = pMac->roam.configParam.bandCapability; |
| 1298 | pParam->cbChoice = pMac->roam.configParam.cbChoice; |
| 1299 | pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1300 | pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime; |
| 1301 | pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime; |
| 1302 | pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; |
| 1303 | pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1304 | //Change the unit from microsecond to second |
| 1305 | pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT; |
| 1306 | pParam->eBand = pMac->roam.configParam.eBand; |
| 1307 | pParam->nScanResultAgeCount = pMac->roam.configParam.agingCount; |
| 1308 | pParam->scanAgeTimeNCNPS = pMac->roam.configParam.scanAgeTimeNCNPS; |
| 1309 | pParam->scanAgeTimeNCPS = pMac->roam.configParam.scanAgeTimeNCPS; |
| 1310 | pParam->scanAgeTimeCNPS = pMac->roam.configParam.scanAgeTimeCNPS; |
| 1311 | pParam->scanAgeTimeCPS = pMac->roam.configParam.scanAgeTimeCPS; |
| 1312 | pParam->bCatRssiOffset = pMac->roam.configParam.bCatRssiOffset; |
| 1313 | pParam->nRoamingTime = pMac->roam.configParam.nRoamingTime; |
| 1314 | pParam->fEnforce11dChannels = pMac->roam.configParam.fEnforce11dChannels; |
| 1315 | pParam->fSupplicantCountryCodeHasPriority = pMac->roam.configParam.fSupplicantCountryCodeHasPriority; |
| 1316 | pParam->fEnforceCountryCodeMatch = pMac->roam.configParam.fEnforceCountryCodeMatch; |
| 1317 | pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain; |
| 1318 | pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold; |
| 1319 | pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1320 | pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled; |
| 1321 | pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap; |
| 1322 | pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 1323 | pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1324 | pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff; |
| 1325 | pParam->fValidateList = pMac->roam.configParam.fValidateList; |
| 1326 | pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d; |
| 1327 | pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan; |
| 1328 | pParam->fScanTwice = pMac->roam.configParam.fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 1329 | pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1330 | |
| 1331 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1332 | palCopyMemory( pMac->hHdd, &pParam->neighborRoamConfig, &pMac->roam.configParam.neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
| 1333 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 1334 | #ifdef WLAN_FEATURE_11AC |
| 1335 | pParam->nVhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth; |
| 1336 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1337 | |
| 1338 | csrSetChannels(pMac, pParam); |
| 1339 | |
| 1340 | status = eHAL_STATUS_SUCCESS; |
| 1341 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1342 | return (status); |
| 1343 | } |
| 1344 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1345 | eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded) |
| 1346 | { |
| 1347 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 1348 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1349 | tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE; |
| 1350 | eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1351 | do |
| 1352 | { |
| 1353 | if(eCSR_BAND_24 == eBand) |
| 1354 | { |
| 1355 | if(CSR_IS_RADIO_A_ONLY(pMac)) break; |
| 1356 | if((eCSR_DOT11_MODE_11a & phyMode) || (eCSR_DOT11_MODE_11a_ONLY & phyMode)) break; |
| 1357 | } |
| 1358 | if(eCSR_BAND_5G == eBand) |
| 1359 | { |
| 1360 | if(CSR_IS_RADIO_BG_ONLY(pMac)) break; |
| 1361 | if((eCSR_DOT11_MODE_11b & phyMode) || (eCSR_DOT11_MODE_11b_ONLY & phyMode) || |
| 1362 | (eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1363 | ) |
| 1364 | { |
| 1365 | break; |
| 1366 | } |
| 1367 | } |
| 1368 | if((0 == phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode)) |
| 1369 | { |
| 1370 | newPhyMode = eCSR_DOT11_MODE_TAURUS; |
| 1371 | } |
| 1372 | else if(eCSR_DOT11_MODE_AUTO & phyMode) |
| 1373 | { |
| 1374 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1375 | } |
| 1376 | else |
| 1377 | { |
| 1378 | //Check for dual band and higher capability first |
| 1379 | if(eCSR_DOT11_MODE_11n_ONLY & phyMode) |
| 1380 | { |
| 1381 | if(eCSR_DOT11_MODE_11n_ONLY != phyMode) break; |
| 1382 | newPhyMode = eCSR_DOT11_MODE_11n_ONLY; |
| 1383 | } |
| 1384 | else if(eCSR_DOT11_MODE_11a_ONLY & phyMode) |
| 1385 | { |
| 1386 | if(eCSR_DOT11_MODE_11a_ONLY != phyMode) break; |
| 1387 | if(eCSR_BAND_24 == eBand) break; |
| 1388 | newPhyMode = eCSR_DOT11_MODE_11a_ONLY; |
| 1389 | eBand = eCSR_BAND_5G; |
| 1390 | } |
| 1391 | else if(eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1392 | { |
| 1393 | if(eCSR_DOT11_MODE_11g_ONLY != phyMode) break; |
| 1394 | if(eCSR_BAND_5G == eBand) break; |
| 1395 | newPhyMode = eCSR_DOT11_MODE_11g_ONLY; |
| 1396 | eBand = eCSR_BAND_24; |
| 1397 | } |
| 1398 | else if(eCSR_DOT11_MODE_11b_ONLY & phyMode) |
| 1399 | { |
| 1400 | if(eCSR_DOT11_MODE_11b_ONLY != phyMode) break; |
| 1401 | if(eCSR_BAND_5G == eBand) break; |
| 1402 | newPhyMode = eCSR_DOT11_MODE_11b_ONLY; |
| 1403 | eBand = eCSR_BAND_24; |
| 1404 | } |
| 1405 | else if(eCSR_DOT11_MODE_11n & phyMode) |
| 1406 | { |
| 1407 | newPhyMode = eCSR_DOT11_MODE_11n; |
| 1408 | } |
| 1409 | else if(eCSR_DOT11_MODE_abg & phyMode) |
| 1410 | { |
| 1411 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1412 | } |
| 1413 | else if(eCSR_DOT11_MODE_11a & phyMode) |
| 1414 | { |
| 1415 | if((eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11b & phyMode)) |
| 1416 | { |
| 1417 | if(eCSR_BAND_ALL == eBand) |
| 1418 | { |
| 1419 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1420 | } |
| 1421 | else |
| 1422 | { |
| 1423 | //bad setting |
| 1424 | break; |
| 1425 | } |
| 1426 | } |
| 1427 | else |
| 1428 | { |
| 1429 | newPhyMode = eCSR_DOT11_MODE_11a; |
| 1430 | eBand = eCSR_BAND_5G; |
| 1431 | } |
| 1432 | } |
| 1433 | else if(eCSR_DOT11_MODE_11g & phyMode) |
| 1434 | { |
| 1435 | newPhyMode = eCSR_DOT11_MODE_11g; |
| 1436 | eBand = eCSR_BAND_24; |
| 1437 | } |
| 1438 | else if(eCSR_DOT11_MODE_11b & phyMode) |
| 1439 | { |
| 1440 | newPhyMode = eCSR_DOT11_MODE_11b; |
| 1441 | eBand = eCSR_BAND_24; |
| 1442 | } |
| 1443 | else |
| 1444 | { |
| 1445 | //We will never be here |
| 1446 | smsLog( pMac, LOGE, FL(" cannot recognize the phy mode 0x%08X\n"), phyMode ); |
| 1447 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1448 | } |
| 1449 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1450 | //Done validating |
| 1451 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1452 | //Now we need to check whether a restart is needed. |
| 1453 | if(eBand != pMac->roam.configParam.eBand) |
| 1454 | { |
| 1455 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1456 | break; |
| 1457 | } |
| 1458 | if(newPhyMode != pMac->roam.configParam.phyMode) |
| 1459 | { |
| 1460 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1461 | break; |
| 1462 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1463 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1464 | if(HAL_STATUS_SUCCESS(status)) |
| 1465 | { |
| 1466 | pMac->roam.configParam.eBand = eBand; |
| 1467 | pMac->roam.configParam.phyMode = newPhyMode; |
| 1468 | if(pfRestartNeeded) |
| 1469 | { |
| 1470 | *pfRestartNeeded = fRestartNeeded; |
| 1471 | } |
| 1472 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1473 | return (status); |
| 1474 | } |
| 1475 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1476 | void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList ) |
| 1477 | { |
| 1478 | tANI_U8 Index; |
| 1479 | tANI_U8 cChannels; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1480 | // for dual band NICs, don't need to trim the channel list.... |
| 1481 | if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) ) |
| 1482 | { |
| 1483 | // 2.4 GHz band operation requires the channel list to be trimmed to |
| 1484 | // the 2.4 GHz channels only... |
| 1485 | if ( CSR_IS_24_BAND_ONLY( pMac ) ) |
| 1486 | { |
| 1487 | for( Index = 0, cChannels = 0; Index < pChannelList->numChannels; |
| 1488 | Index++ ) |
| 1489 | { |
| 1490 | if ( CSR_IS_CHANNEL_24GHZ(pChannelList->channelList[ Index ]) ) |
| 1491 | { |
| 1492 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 1493 | cChannels++; |
| 1494 | } |
| 1495 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1496 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 1497 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 1498 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 1499 | // only if we need to. |
| 1500 | // |
| 1501 | // The amount of memory to clear is the number of channesl that we trimmed |
| 1502 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 1503 | |
| 1504 | if ( pChannelList->numChannels > cChannels ) |
| 1505 | { |
| 1506 | palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ], |
| 1507 | sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) ); |
| 1508 | |
| 1509 | } |
| 1510 | |
| 1511 | pChannelList->numChannels = cChannels; |
| 1512 | } |
| 1513 | else if ( CSR_IS_5G_BAND_ONLY( pMac ) ) |
| 1514 | { |
| 1515 | for ( Index = 0, cChannels = 0; Index < pChannelList->numChannels; Index++ ) |
| 1516 | { |
| 1517 | if ( CSR_IS_CHANNEL_5GHZ(pChannelList->channelList[ Index ]) ) |
| 1518 | { |
| 1519 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 1520 | cChannels++; |
| 1521 | } |
| 1522 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1523 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 1524 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 1525 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 1526 | // only if we need to. |
| 1527 | // |
| 1528 | // The amount of memory to clear is the number of channesl that we trimmed |
| 1529 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 1530 | if ( pChannelList->numChannels > cChannels ) |
| 1531 | { |
| 1532 | palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ], |
| 1533 | sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) ); |
| 1534 | } |
| 1535 | |
| 1536 | pChannelList->numChannels = cChannels; |
| 1537 | } |
| 1538 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1539 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1540 | #ifdef WLAN_SOFTAP_FEATURE |
| 1541 | #define INFRA_AP_DEFAULT_CHANNEL 6 |
| 1542 | eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum) |
| 1543 | { |
| 1544 | tANI_U8 index= 0; |
| 1545 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1546 | for (index=0; index < pMac->scan.base20MHzChannels.numChannels ;index++) |
| 1547 | { |
| 1548 | if(pMac->scan.base20MHzChannels.channelList[ index ] == chnNum){ |
| 1549 | status = eHAL_STATUS_SUCCESS; |
| 1550 | break; |
| 1551 | } |
| 1552 | } |
| 1553 | return status; |
| 1554 | } |
| 1555 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1556 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac) |
| 1557 | { |
| 1558 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1559 | tANI_U8 num20MHzChannelsFound = 0; |
| 1560 | VOS_STATUS vosStatus; |
| 1561 | tANI_U8 Index = 0; |
| 1562 | tANI_U8 num40MHzChannelsFound = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 1563 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1564 | |
| 1565 | //TODO: this interface changed to include the 40MHz channel list |
| 1566 | // this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation |
| 1567 | // Read the scan channel list (including the power limit) from EEPROM |
| 1568 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 1569 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 1570 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 1571 | { |
| 1572 | smsLog( pMac, LOGE, FL("failed to get channels \n")); |
| 1573 | status = eHAL_STATUS_FAILURE; |
| 1574 | } |
| 1575 | else |
| 1576 | { |
| 1577 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 1578 | { |
| 1579 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1580 | } |
| 1581 | pMac->scan.numChannelsDefault = num20MHzChannelsFound; |
| 1582 | // Move the channel list to the global data |
| 1583 | // structure -- this will be used as the scan list |
| 1584 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 1585 | { |
| 1586 | #ifdef FEATURE_WLAN_INTEGRATED_SOC /* Need to fix this while dealing with NV item */ |
| 1587 | pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[ Index ].chanId; |
| 1588 | #else |
| 1589 | pMac->scan.base20MHzChannels.channelList[ Index ] = Index + 1; |
| 1590 | pMac->scan.defaultPowerTable[Index].chanId = Index + 1; |
| 1591 | pMac->scan.defaultPowerTable[Index].pwr = 25; |
| 1592 | #endif |
| 1593 | } |
| 1594 | pMac->scan.base20MHzChannels.numChannels = num20MHzChannelsFound; |
| 1595 | if(num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 1596 | { |
| 1597 | num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1598 | } |
| 1599 | for ( Index = 0; Index < num40MHzChannelsFound; Index++) |
| 1600 | { |
| 1601 | pMac->scan.base40MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable40MHz[ Index ].chanId; |
| 1602 | } |
| 1603 | pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound; |
| 1604 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1605 | return (status); |
| 1606 | } |
| 1607 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1608 | eHalStatus csrInitChannelList( tHalHandle hHal ) |
| 1609 | { |
| 1610 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1611 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1612 | csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels); |
| 1613 | csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels); |
| 1614 | // Apply the base channel list, power info, and set the Country code... |
| 1615 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent ); |
| 1616 | |
| 1617 | return (status); |
| 1618 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1619 | eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, |
| 1620 | tCsrUpdateConfigParam *pUpdateConfigParam) |
| 1621 | { |
| 1622 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1623 | tCsr11dinfo *ps11dinfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1624 | ps11dinfo = &pUpdateConfigParam->Csr11dinfo; |
| 1625 | status = CsrInit11dInfo(pMac, ps11dinfo); |
| 1626 | return status; |
| 1627 | } |
| 1628 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1629 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 1630 | { |
| 1631 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1632 | tANI_U8 index; |
| 1633 | tANI_U32 count=0; |
| 1634 | tSirMacChanInfo *pChanInfo; |
| 1635 | tSirMacChanInfo *pChanInfoStart; |
| 1636 | tANI_BOOLEAN applyConfig = TRUE; |
| 1637 | |
| 1638 | if(!ps11dinfo) |
| 1639 | { |
| 1640 | return (status); |
| 1641 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1642 | if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) ) |
| 1643 | { |
| 1644 | pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels; |
| 1645 | status = palCopyMemory(pMac->hHdd, pMac->scan.base20MHzChannels.channelList, |
| 1646 | ps11dinfo->Channels.channelList, ps11dinfo->Channels.numChannels); |
| 1647 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
| 1648 | } |
| 1649 | else |
| 1650 | { |
| 1651 | //No change |
| 1652 | return (eHAL_STATUS_SUCCESS); |
| 1653 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1654 | //legacy maintenance |
| 1655 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, |
| 1656 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 1657 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1658 | //Tush: at csropen get this initialized with default, during csr reset if this |
| 1659 | // already set with some value no need initilaize with default again |
| 1660 | if(0 == pMac->scan.countryCodeCurrent[0]) |
| 1661 | { |
| 1662 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 1663 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 1664 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
| 1665 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1666 | // need to add the max power channel list |
| 1667 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN))) |
| 1668 | { |
| 1669 | palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 1670 | pChanInfoStart = pChanInfo; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 1671 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 1672 | { |
| 1673 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 1674 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 1675 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 1676 | pChanInfo++; |
| 1677 | count++; |
| 1678 | } |
| 1679 | if(count) |
| 1680 | { |
| 1681 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 1682 | } |
| 1683 | palFreeMemory(pMac->hHdd, pChanInfoStart); |
| 1684 | } |
| 1685 | //Only apply them to CFG when not in STOP state. Otherwise they will be applied later |
| 1686 | if( HAL_STATUS_SUCCESS(status) ) |
| 1687 | { |
| 1688 | for( index = 0; index < CSR_ROAM_SESSION_MAX; index++ ) |
| 1689 | { |
| 1690 | if((CSR_IS_SESSION_VALID(pMac, index)) && CSR_IS_ROAM_STOP(pMac, index)) |
| 1691 | { |
| 1692 | applyConfig = FALSE; |
| 1693 | } |
| 1694 | } |
| 1695 | |
| 1696 | if(TRUE == applyConfig) |
| 1697 | { |
| 1698 | // Apply the base channel list, power info, and set the Country code... |
| 1699 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent ); |
| 1700 | } |
| 1701 | |
| 1702 | } |
| 1703 | return (status); |
| 1704 | } |
| 1705 | /* Initialize the Channel + Power List in the local cache and in the CFG */ |
| 1706 | eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 1707 | { |
| 1708 | tANI_U8 index; |
| 1709 | tANI_U32 count=0; |
| 1710 | tSirMacChanInfo *pChanInfo; |
| 1711 | tSirMacChanInfo *pChanInfoStart; |
| 1712 | |
| 1713 | if(!ps11dinfo || !pMac) |
| 1714 | { |
| 1715 | return eHAL_STATUS_FAILURE; |
| 1716 | } |
| 1717 | |
| 1718 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN))) |
| 1719 | { |
| 1720 | palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 1721 | pChanInfoStart = pChanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1722 | |
| 1723 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 1724 | { |
| 1725 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 1726 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 1727 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 1728 | pChanInfo++; |
| 1729 | count++; |
| 1730 | } |
| 1731 | if(count) |
| 1732 | { |
| 1733 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 1734 | } |
| 1735 | palFreeMemory(pMac->hHdd, pChanInfoStart); |
| 1736 | } |
| 1737 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 1738 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1739 | } |
| 1740 | |
| 1741 | //pCommand may be NULL |
| 1742 | //Pass in sessionId in case pCommand is NULL. sessionId is not used in case pCommand is not NULL. |
| 1743 | void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason) |
| 1744 | { |
| 1745 | tListElem *pEntry, *pNextEntry; |
| 1746 | tSmeCmd *pDupCommand; |
| 1747 | tDblLinkList localList; |
| 1748 | |
| 1749 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 1750 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 1751 | { |
| 1752 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 1753 | return; |
| 1754 | } |
| 1755 | csrLLLock( &pMac->sme.smeCmdPendingList ); |
| 1756 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK ); |
| 1757 | while( pEntry ) |
| 1758 | { |
| 1759 | pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ); |
| 1760 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1761 | // Remove the previous command if.. |
| 1762 | // - the new roam command is for the same RoamReason... |
| 1763 | // - the new roam command is a NewProfileList. |
| 1764 | // - the new roam command is a Forced Dissoc |
| 1765 | // - the new roam command is from an 802.11 OID (OID_SSID or OID_BSSID). |
| 1766 | if ( |
| 1767 | (pCommand && ( pCommand->sessionId == pDupCommand->sessionId ) && |
| 1768 | ((pCommand->command == pDupCommand->command) && |
| 1769 | (pCommand->u.roamCmd.roamReason == pDupCommand->u.roamCmd.roamReason || |
| 1770 | eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason || |
| 1771 | eCsrHddIssued == pCommand->u.roamCmd.roamReason))) |
| 1772 | || |
| 1773 | //below the pCommand is NULL |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1774 | ( (sessionId == pDupCommand->sessionId) && |
| 1775 | (eSmeCommandRoam == pDupCommand->command) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1776 | ((eCsrForcedDisassoc == eRoamReason) || |
| 1777 | (eCsrHddIssued == eRoamReason)) |
| 1778 | ) |
| 1779 | ) |
| 1780 | { |
| 1781 | smsLog(pMac, LOGW, FL(" roamReason = %d\n"), pDupCommand->u.roamCmd.roamReason); |
| 1782 | // Remove the 'stale' roam command from the pending list... |
| 1783 | if(csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK )) |
| 1784 | { |
| 1785 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 1786 | } |
| 1787 | } |
| 1788 | pEntry = pNextEntry; |
| 1789 | } |
| 1790 | csrLLUnlock( &pMac->sme.smeCmdPendingList ); |
| 1791 | |
| 1792 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 1793 | { |
| 1794 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 1795 | //Tell caller that the command is cancelled |
| 1796 | csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL, pDupCommand->u.roamCmd.roamId, |
| 1797 | eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE); |
| 1798 | csrReleaseCommandRoam(pMac, pDupCommand); |
| 1799 | } |
| 1800 | csrLLClose(&localList); |
| 1801 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1802 | eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, |
| 1803 | tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2) |
| 1804 | { |
| 1805 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1806 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 1807 | WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type); |
| 1808 | #endif |
| 1809 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1810 | if( CSR_IS_SESSION_VALID( pMac, sessionId) ) |
| 1811 | { |
| 1812 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 1813 | } |
| 1814 | else |
| 1815 | { |
| 1816 | smsLog(pMac, LOGE, "Session ID:%d is not valid\n", sessionId); |
| 1817 | VOS_ASSERT(0); |
| 1818 | return eHAL_STATUS_FAILURE; |
| 1819 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1820 | if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo) |
| 1821 | { |
| 1822 | smsLog(pMac, LOGW, " Assoc complete result = %d statusCode = %d reasonCode = %d\n", u2, pRoamInfo->statusCode, pRoamInfo->reasonCode); |
| 1823 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1824 | if ( (pSession == NULL) || |
| 1825 | (eANI_BOOLEAN_FALSE == pSession->sessionActive) ) |
| 1826 | { |
| 1827 | smsLog(pMac, LOG1, "Session ID is not valid\n"); |
| 1828 | return eHAL_STATUS_FAILURE; |
| 1829 | } |
| 1830 | |
| 1831 | if(NULL != pSession->callback) |
| 1832 | { |
| 1833 | if( pRoamInfo ) |
| 1834 | { |
| 1835 | pRoamInfo->sessionId = (tANI_U8)sessionId; |
| 1836 | } |
| 1837 | |
| 1838 | /* avoid holding the global lock when making the roaming callback , original change came |
| 1839 | from a raised CR (CR304874). Since this callback is in HDD a potential deadlock |
| 1840 | is possible on other OS ports where the callback may need to take locks to protect |
| 1841 | HDD state |
| 1842 | UPDATE : revert this change but keep the comments here. Need to revisit as there are callbacks |
| 1843 | that may actually depend on the lock being held */ |
| 1844 | // TODO: revisit: sme_ReleaseGlobalLock( &pMac->sme ); |
| 1845 | status = pSession->callback(pSession->pContext, pRoamInfo, roamId, u1, u2); |
| 1846 | // TODO: revisit: sme_AcquireGlobalLock( &pMac->sme ); |
| 1847 | } |
| 1848 | //EVENT_WLAN_STATUS: eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 1849 | // eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED, |
| 1850 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 1851 | palZeroMemory(pMac->hHdd, &connectionStatus, sizeof(vos_event_wlan_status_payload_type)); |
| 1852 | if((eCSR_ROAM_ASSOCIATION_COMPLETION == u1) && (eCSR_ROAM_RESULT_ASSOCIATED == u2)) |
| 1853 | { |
| 1854 | connectionStatus.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 1855 | connectionStatus.bssType = pRoamInfo->u.pConnectedProfile->BSSType; |
| 1856 | if(NULL != pRoamInfo->pBssDesc) |
| 1857 | { |
| 1858 | connectionStatus.rssi = pRoamInfo->pBssDesc->rssi * (-1); |
| 1859 | connectionStatus.channel = pRoamInfo->pBssDesc->channelId; |
| 1860 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1861 | connectionStatus.qosCapability = pRoamInfo->u.pConnectedProfile->qosConnection; |
| 1862 | connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType); |
| 1863 | connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType); |
| 1864 | palCopyMemory(pMac->hHdd, connectionStatus.ssid, pRoamInfo->u.pConnectedProfile->SSID.ssId, 6); |
| 1865 | connectionStatus.reason = eCSR_REASON_UNSPECIFIED; |
| 1866 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 1867 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1868 | if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2)) |
| 1869 | { |
| 1870 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 1871 | connectionStatus.reason = eCSR_REASON_MIC_ERROR; |
| 1872 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 1873 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1874 | if(eCSR_ROAM_RESULT_FORCED == u2) |
| 1875 | { |
| 1876 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 1877 | connectionStatus.reason = eCSR_REASON_USER_REQUESTED; |
| 1878 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 1879 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1880 | if(eCSR_ROAM_RESULT_DISASSOC_IND == u2) |
| 1881 | { |
| 1882 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 1883 | connectionStatus.reason = eCSR_REASON_DISASSOC; |
| 1884 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 1885 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1886 | if(eCSR_ROAM_RESULT_DEAUTH_IND == u2) |
| 1887 | { |
| 1888 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 1889 | connectionStatus.reason = eCSR_REASON_DEAUTH; |
| 1890 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 1891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1892 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 1893 | |
| 1894 | return (status); |
| 1895 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1896 | // Returns whether handoff is currently in progress or not |
| 1897 | tANI_BOOLEAN csrRoamIsHandoffInProgress(tpAniSirGlobal pMac) |
| 1898 | { |
| 1899 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1900 | return csrNeighborRoamIsHandoffInProgress(pMac); |
| 1901 | #else |
| 1902 | return eANI_BOOLEAN_FALSE; |
| 1903 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1904 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1905 | eHalStatus csrRoamIssueDisassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 1906 | eCsrRoamSubState NewSubstate, tANI_BOOLEAN fMICFailure ) |
| 1907 | { |
| 1908 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1909 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 1910 | tANI_U16 reasonCode; |
| 1911 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 1912 | |
| 1913 | //Restore AC weight in case we change it |
| 1914 | if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 1915 | { |
| 1916 | smsLog(pMac, LOGE, FL(" restore AC weights (%d-%d-%d-%d)\n"), pMac->roam.ucACWeights[0], pMac->roam.ucACWeights[1], |
| 1917 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 1918 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 1919 | } |
| 1920 | |
| 1921 | if ( fMICFailure ) |
| 1922 | { |
| 1923 | reasonCode = eSIR_MAC_MIC_FAILURE_REASON; |
| 1924 | } |
| 1925 | else if (NewSubstate == eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF) |
| 1926 | { |
| 1927 | reasonCode = eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON; |
| 1928 | } else |
| 1929 | { |
| 1930 | reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 1931 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1932 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1933 | if ( (csrRoamIsHandoffInProgress(pMac)) && |
| 1934 | (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF)) |
| 1935 | { |
| 1936 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1937 | palCopyMemory(pMac->hHdd, &bssId, pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1938 | } else |
| 1939 | #endif |
| 1940 | if(pSession->pConnectBssDesc) |
| 1941 | { |
| 1942 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 1943 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 1944 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1945 | |
| 1946 | smsLog( pMac, LOGE, "CSR Attempting to Disassociate Bssid= %02x-%02x-%02x-%02x-%02x-%02x subState = %d\n", |
| 1947 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 1948 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ], NewSubstate ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1949 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 1950 | |
| 1951 | status = csrSendMBDisassocReqMsg( pMac, sessionId, bssId, reasonCode ); |
| 1952 | |
| 1953 | if(HAL_STATUS_SUCCESS(status)) |
| 1954 | { |
| 1955 | csrRoamLinkDown(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1956 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 1957 | //no need to tell QoS that we are disassociating, it will be taken care off in assoc req for HO |
| 1958 | if(eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate) |
| 1959 | { |
| 1960 | //Tush-QoS: notify QoS module that disassoc happening |
| 1961 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 1962 | } |
| 1963 | #endif |
| 1964 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1965 | return (status); |
| 1966 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1967 | #ifdef WLAN_SOFTAP_FEATURE |
| 1968 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1969 | /* --------------------------------------------------------------------------- |
| 1970 | \fn csrRoamIssueDisassociateStaCmd |
| 1971 | \brief csr function that HDD calls to disassociate a associated station |
| 1972 | \param sessionId - session Id for Soft AP |
| 1973 | \param pPeerMacAddr - MAC of associated station to delete |
| 1974 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 1975 | \return eHalStatus |
| 1976 | ---------------------------------------------------------------------------*/ |
| 1977 | eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, |
| 1978 | tANI_U32 sessionId, |
| 1979 | tANI_U8 *pPeerMacAddr, |
| 1980 | tANI_U32 reason) |
| 1981 | { |
| 1982 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1983 | tSmeCmd *pCommand; |
| 1984 | |
| 1985 | do |
| 1986 | { |
| 1987 | pCommand = csrGetCommandBuffer( pMac ); |
| 1988 | if ( !pCommand ) |
| 1989 | { |
| 1990 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 1991 | status = eHAL_STATUS_RESOURCES; |
| 1992 | break; |
| 1993 | } |
| 1994 | pCommand->command = eSmeCommandRoam; |
| 1995 | pCommand->sessionId = (tANI_U8)sessionId; |
| 1996 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocSta; |
| 1997 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 1998 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 1999 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2000 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2001 | { |
| 2002 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 2003 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2004 | } |
| 2005 | }while(0); |
| 2006 | |
| 2007 | return status; |
| 2008 | } |
| 2009 | |
| 2010 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2011 | /* --------------------------------------------------------------------------- |
| 2012 | \fn csrRoamIssueDeauthSta |
| 2013 | \brief csr function that HDD calls to delete a associated station |
| 2014 | \param sessionId - session Id for Soft AP |
| 2015 | \param pPeerMacAddr - MAC of associated station to delete |
| 2016 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2017 | \return eHalStatus |
| 2018 | ---------------------------------------------------------------------------*/ |
| 2019 | eHalStatus csrRoamIssueDeauthStaCmd( tpAniSirGlobal pMac, |
| 2020 | tANI_U32 sessionId, |
| 2021 | tANI_U8 *pPeerMacAddr, |
| 2022 | tANI_U32 reason) |
| 2023 | { |
| 2024 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2025 | tSmeCmd *pCommand; |
| 2026 | |
| 2027 | do |
| 2028 | { |
| 2029 | pCommand = csrGetCommandBuffer( pMac ); |
| 2030 | if ( !pCommand ) |
| 2031 | { |
| 2032 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2033 | status = eHAL_STATUS_RESOURCES; |
| 2034 | break; |
| 2035 | } |
| 2036 | pCommand->command = eSmeCommandRoam; |
| 2037 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2038 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 2039 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2040 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2041 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2042 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2043 | { |
| 2044 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 2045 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2046 | } |
| 2047 | }while(0); |
| 2048 | |
| 2049 | return status; |
| 2050 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2051 | eHalStatus |
| 2052 | csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2053 | tANI_BOOLEAN bEnable ) |
| 2054 | { |
| 2055 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2056 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2057 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2058 | if (!pSession) |
| 2059 | { |
| 2060 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:CSR Session not found\n"); |
| 2061 | return (status); |
| 2062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2063 | if (pSession->pConnectBssDesc) |
| 2064 | { |
| 2065 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2066 | } |
| 2067 | else |
| 2068 | { |
| 2069 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:Connected BSS Description in CSR Session not found\n"); |
| 2070 | return (status); |
| 2071 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2072 | smsLog( pMac, LOG2, "CSR issuing tkip counter measures for Bssid = %02x-%02x-%02x-%02x-%02x-%02x, Enable = %d\n", |
| 2073 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2074 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] , bEnable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2075 | status = csrSendMBTkipCounterMeasuresReqMsg( pMac, sessionId, bEnable, bssId ); |
| 2076 | return (status); |
| 2077 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2078 | eHalStatus |
| 2079 | csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2080 | VOS_MODULE_ID modId, void *pUsrContext, |
| 2081 | void *pfnSapEventCallback, v_U8_t *pAssocStasBuf ) |
| 2082 | { |
| 2083 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2084 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2085 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2086 | if (!pSession) |
| 2087 | { |
| 2088 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:CSR Session not found\n"); |
| 2089 | return (status); |
| 2090 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2091 | if(pSession->pConnectBssDesc) |
| 2092 | { |
| 2093 | palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) ); |
| 2094 | } |
| 2095 | else |
| 2096 | { |
| 2097 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:Connected BSS Description in CSR Session not found\n"); |
| 2098 | return (status); |
| 2099 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2100 | smsLog( pMac, LOG2, "CSR getting associated stations for Bssid = %02x-%02x-%02x-%02x-%02x-%02x\n", |
| 2101 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2102 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2103 | status = csrSendMBGetAssociatedStasReqMsg( pMac, sessionId, modId, bssId, pUsrContext, pfnSapEventCallback, pAssocStasBuf ); |
| 2104 | return (status); |
| 2105 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2106 | eHalStatus |
| 2107 | csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2108 | void *pUsrContext, void *pfnSapEventCallback, v_MACADDR_t pRemoveMac ) |
| 2109 | { |
| 2110 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2111 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2112 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2113 | |
| 2114 | if (!pSession) |
| 2115 | { |
| 2116 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:CSR Session not found\n"); |
| 2117 | return (status); |
| 2118 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2119 | if(pSession->pConnectBssDesc) |
| 2120 | { |
| 2121 | palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) ); |
| 2122 | } |
| 2123 | else |
| 2124 | { |
| 2125 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:Connected BSS Description in CSR Session not found\n"); |
| 2126 | return (status); |
| 2127 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2128 | smsLog( pMac, LOG2, "CSR getting WPS Session Overlap for Bssid = %02x-%02x-%02x-%02x-%02x-%02x\n", |
| 2129 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2130 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
| 2131 | |
| 2132 | status = csrSendMBGetWPSPBCSessions( pMac, sessionId, bssId, pUsrContext, pfnSapEventCallback, pRemoveMac); |
| 2133 | |
| 2134 | return (status); |
| 2135 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2136 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2137 | eHalStatus csrRoamIssueDeauth( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 2138 | { |
| 2139 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2140 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2141 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2142 | |
| 2143 | if(pSession->pConnectBssDesc) |
| 2144 | { |
| 2145 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2147 | smsLog( pMac, LOG2, "CSR Attempting to Deauth Bssid= %02x-%02x-%02x-%02x-%02x-%02x\n", |
| 2148 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2149 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2150 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2151 | |
| 2152 | status = csrSendMBDeauthReqMsg( pMac, sessionId, bssId, eSIR_MAC_DISASSOC_LEAVING_BSS_REASON ); |
| 2153 | |
| 2154 | return (status); |
| 2155 | } |
| 2156 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2157 | eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc ) |
| 2158 | { |
| 2159 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2160 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2161 | tANI_U32 size; |
| 2162 | |
| 2163 | // If no BSS description was found in this connection (happens with start IBSS), then |
| 2164 | // nix the BSS description that we keep around for the connected BSS) and get out... |
| 2165 | if(NULL == pBssDesc) |
| 2166 | { |
| 2167 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2168 | } |
| 2169 | else |
| 2170 | { |
| 2171 | size = pBssDesc->length + sizeof( pBssDesc->length ); |
| 2172 | if(NULL != pSession->pConnectBssDesc) |
| 2173 | { |
| 2174 | if(((pSession->pConnectBssDesc->length) + sizeof(pSession->pConnectBssDesc->length)) < size) |
| 2175 | { |
| 2176 | //not enough room for the new BSS, pMac->roam.pConnectBssDesc is freed inside |
| 2177 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2178 | } |
| 2179 | } |
| 2180 | if(NULL == pSession->pConnectBssDesc) |
| 2181 | { |
| 2182 | status = palAllocateMemory( pMac->hHdd, (void **)&pSession->pConnectBssDesc, size); |
| 2183 | } |
| 2184 | if ( HAL_STATUS_SUCCESS(status) && pSession->pConnectBssDesc ) |
| 2185 | { |
| 2186 | palCopyMemory( pMac->hHdd, pSession->pConnectBssDesc, pBssDesc, size ); |
| 2187 | } |
| 2188 | } |
| 2189 | |
| 2190 | return (status); |
| 2191 | } |
| 2192 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2193 | eHalStatus csrRoamPrepareBssConfig(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2194 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 2195 | tDot11fBeaconIEs *pIes) |
| 2196 | { |
| 2197 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2198 | eCsrCfgDot11Mode cfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2199 | #if defined(VOSS_ENABLED) |
| 2200 | VOS_ASSERT( pIes != NULL ); |
| 2201 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 2202 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2203 | do |
| 2204 | { |
| 2205 | palCopyMemory(pMac->hHdd, &pBssConfig->BssCap, &pBssDesc->capabilityInfo, sizeof(tSirMacCapabilityInfo)); |
| 2206 | //get qos |
| 2207 | pBssConfig->qosType = csrGetQoSFromBssDesc(pMac, pBssDesc, pIes); |
| 2208 | //get SSID |
| 2209 | if(pIes->SSID.present) |
| 2210 | { |
| 2211 | palCopyMemory(pMac->hHdd, &pBssConfig->SSID.ssId, pIes->SSID.ssid, pIes->SSID.num_ssid); |
| 2212 | pBssConfig->SSID.length = pIes->SSID.num_ssid; |
| 2213 | } |
| 2214 | else |
| 2215 | pBssConfig->SSID.length = 0; |
| 2216 | if(csrIsNULLSSID(pBssConfig->SSID.ssId, pBssConfig->SSID.length)) |
| 2217 | { |
| 2218 | smsLog(pMac, LOGW, " BSS desc SSID is a wildcard\n"); |
| 2219 | //Return failed if profile doesn't have an SSID either. |
| 2220 | if(pProfile->SSIDs.numOfSSIDs == 0) |
| 2221 | { |
| 2222 | smsLog(pMac, LOGW, " Both BSS desc and profile doesn't have SSID\n"); |
| 2223 | status = eHAL_STATUS_FAILURE; |
| 2224 | break; |
| 2225 | } |
| 2226 | } |
| 2227 | if(CSR_IS_CHANNEL_5GHZ(pBssDesc->channelId)) |
| 2228 | { |
| 2229 | pBssConfig->eBand = eCSR_BAND_5G; |
| 2230 | } |
| 2231 | else |
| 2232 | { |
| 2233 | pBssConfig->eBand = eCSR_BAND_24; |
| 2234 | } |
| 2235 | //phymode |
| 2236 | if(csrIsPhyModeMatch( pMac, pProfile->phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes )) |
| 2237 | { |
| 2238 | pBssConfig->uCfgDot11Mode = cfgDot11Mode; |
| 2239 | } |
| 2240 | else |
| 2241 | { |
| 2242 | smsLog(pMac, LOGW, " Can not find match phy mode\n"); |
| 2243 | //force it |
| 2244 | if(eCSR_BAND_24 == pBssConfig->eBand) |
| 2245 | { |
| 2246 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2247 | } |
| 2248 | else |
| 2249 | { |
| 2250 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2251 | } |
| 2252 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2253 | //Qos |
| 2254 | if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) && |
| 2255 | (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos)) |
| 2256 | { |
| 2257 | //Joining BSS is not 11n capable and WMM is disabled on client. |
| 2258 | //Disable QoS and WMM |
| 2259 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2260 | } |
| 2261 | |
| 2262 | //auth type |
| 2263 | switch( pProfile->negotiatedAuthType ) |
| 2264 | { |
| 2265 | default: |
| 2266 | case eCSR_AUTH_TYPE_WPA: |
| 2267 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2268 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2269 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2270 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2271 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2272 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2273 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2274 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2275 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2276 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2277 | break; |
| 2278 | } |
| 2279 | //short slot time |
| 2280 | if( eCSR_CFG_DOT11_MODE_11B != cfgDot11Mode ) |
| 2281 | { |
| 2282 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2283 | } |
| 2284 | else |
| 2285 | { |
| 2286 | pBssConfig->uShortSlotTime = 0; |
| 2287 | } |
| 2288 | if(pBssConfig->BssCap.ibss) |
| 2289 | { |
| 2290 | //We don't support 11h on IBSS |
| 2291 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2292 | } |
| 2293 | else |
| 2294 | { |
| 2295 | pBssConfig->f11hSupport = pMac->roam.configParam.Is11hSupportEnabled; |
| 2296 | } |
| 2297 | //power constraint |
| 2298 | pBssConfig->uPowerLimit = csrGet11hPowerConstraint(pMac, &pIes->PowerConstraints); |
| 2299 | //heartbeat |
| 2300 | if ( CSR_IS_11A_BSS( pBssDesc ) ) |
| 2301 | { |
| 2302 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2303 | } |
| 2304 | else |
| 2305 | { |
| 2306 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 2307 | } |
| 2308 | //Join timeout |
| 2309 | // if we find a BeaconInterval in the BssDescription, then set the Join Timeout to |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 2310 | // be 10 x the BeaconInterval. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2311 | if ( pBssDesc->beaconInterval ) |
| 2312 | { |
| 2313 | //Make sure it is bigger than the minimal |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 2314 | pBssConfig->uJoinTimeOut = CSR_ROAM_MAX(10 * pBssDesc->beaconInterval, CSR_JOIN_FAILURE_TIMEOUT_MIN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2315 | } |
| 2316 | else |
| 2317 | { |
| 2318 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
| 2319 | } |
| 2320 | //validate CB |
| 2321 | pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes); |
| 2322 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2323 | return (status); |
| 2324 | } |
| 2325 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2326 | static eHalStatus csrRoamPrepareBssConfigFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2327 | tBssConfigParam *pBssConfig, tSirBssDescription *pBssDesc) |
| 2328 | { |
| 2329 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2330 | tANI_U8 operationChannel = 0; |
| 2331 | tANI_U8 qAPisEnabled = FALSE; |
| 2332 | //SSID |
| 2333 | pBssConfig->SSID.length = 0; |
| 2334 | if(pProfile->SSIDs.numOfSSIDs) |
| 2335 | { |
| 2336 | //only use the first one |
| 2337 | palCopyMemory(pMac->hHdd, &pBssConfig->SSID, &pProfile->SSIDs.SSIDList[0].SSID, sizeof(tSirMacSSid)); |
| 2338 | } |
| 2339 | else |
| 2340 | { |
| 2341 | //SSID must present |
| 2342 | return eHAL_STATUS_FAILURE; |
| 2343 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2344 | //Settomg up the capabilities |
| 2345 | if( csrIsBssTypeIBSS(pProfile->BSSType) ) |
| 2346 | { |
| 2347 | pBssConfig->BssCap.ibss = 1; |
| 2348 | } |
| 2349 | else |
| 2350 | { |
| 2351 | pBssConfig->BssCap.ess = 1; |
| 2352 | } |
| 2353 | if( eCSR_ENCRYPT_TYPE_NONE != pProfile->EncryptionType.encryptionType[0] ) |
| 2354 | { |
| 2355 | pBssConfig->BssCap.privacy = 1; |
| 2356 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2357 | pBssConfig->eBand = pMac->roam.configParam.eBand; |
| 2358 | //phymode |
| 2359 | if(pProfile->ChannelInfo.ChannelList) |
| 2360 | { |
| 2361 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 2362 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2363 | #ifdef WLAN_SOFTAP_FEATURE |
| 2364 | pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, operationChannel, |
| 2365 | &pBssConfig->eBand); |
| 2366 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2367 | pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, (eCsrPhyMode)pProfile->phyMode, operationChannel, |
| 2368 | &pBssConfig->eBand); |
| 2369 | #endif |
| 2370 | //QOS |
| 2371 | //Is this correct to always set to this //*** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2372 | if ( pBssConfig->BssCap.ess == 1 ) |
| 2373 | { |
| 2374 | #ifdef WLAN_SOFTAP_FEATURE |
| 2375 | /*For Softap case enable WMM*/ |
| 2376 | if(CSR_IS_INFRA_AP(pProfile) && (eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode )){ |
| 2377 | qAPisEnabled = TRUE; |
| 2378 | } |
| 2379 | else |
| 2380 | #endif |
| 2381 | if (csrRoamGetQosInfoFromBss(pMac, pBssDesc) == eHAL_STATUS_SUCCESS) { |
| 2382 | qAPisEnabled = TRUE; |
| 2383 | } else { |
| 2384 | qAPisEnabled = FALSE; |
| 2385 | } |
| 2386 | } else { |
| 2387 | qAPisEnabled = TRUE; |
| 2388 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2389 | if (( eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && qAPisEnabled) || |
| 2390 | (( eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && qAPisEnabled) || |
| 2391 | ( eCSR_CFG_DOT11_MODE_TAURUS == pBssConfig->uCfgDot11Mode ) ) //For 11n, need QoS |
| 2392 | ) |
| 2393 | { |
| 2394 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2395 | } else { |
| 2396 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2397 | } |
| 2398 | |
| 2399 | //auth type |
| 2400 | switch( pProfile->AuthType.authType[0] ) //Take the prefered Auth type. |
| 2401 | { |
| 2402 | default: |
| 2403 | case eCSR_AUTH_TYPE_WPA: |
| 2404 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2405 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2406 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2407 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2408 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2409 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2410 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2411 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2412 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2413 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2414 | break; |
| 2415 | } |
| 2416 | //short slot time |
| 2417 | if( WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode ) |
| 2418 | { |
| 2419 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2420 | } |
| 2421 | else |
| 2422 | { |
| 2423 | pBssConfig->uShortSlotTime = 0; |
| 2424 | } |
| 2425 | //power constraint. We don't support 11h on IBSS |
| 2426 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2427 | pBssConfig->uPowerLimit = 0; |
| 2428 | //heartbeat |
| 2429 | if ( eCSR_BAND_5G == pBssConfig->eBand ) |
| 2430 | { |
| 2431 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2432 | } |
| 2433 | else |
| 2434 | { |
| 2435 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 2436 | } |
| 2437 | //Join timeout |
| 2438 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 2439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2440 | return (status); |
| 2441 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2442 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc) |
| 2443 | { |
| 2444 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2445 | tDot11fBeaconIEs *pIes = NULL; |
| 2446 | |
| 2447 | do |
| 2448 | { |
| 2449 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 2450 | { |
| 2451 | //err msg |
| 2452 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 2453 | "csrRoamGetQosInfoFromBss() failed\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2454 | break; |
| 2455 | } |
| 2456 | //check if the AP is QAP & it supports APSD |
| 2457 | if( CSR_IS_QOS_BSS(pIes) ) |
| 2458 | { |
| 2459 | return eHAL_STATUS_SUCCESS; |
| 2460 | } |
| 2461 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2462 | return status; |
| 2463 | } |
| 2464 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2465 | void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy ) |
| 2466 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2467 | // !! Note: the only difference between this function and the csrSetCfgPrivacyFromProfile() is the |
| 2468 | // setting of the privacy CFG based on the advertised privacy setting from the AP for WPA associations. |
| 2469 | // See !!Note: below in this function... |
| 2470 | tANI_U32 PrivacyEnabled = 0; |
| 2471 | tANI_U32 RsnEnabled = 0; |
| 2472 | tANI_U32 WepDefaultKeyId = 0; |
| 2473 | tANI_U32 WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; /* default 40 bits */ |
| 2474 | tANI_U32 Key0Length = 0; |
| 2475 | tANI_U32 Key1Length = 0; |
| 2476 | tANI_U32 Key2Length = 0; |
| 2477 | tANI_U32 Key3Length = 0; |
| 2478 | |
| 2479 | // Reserve for the biggest key |
| 2480 | tANI_U8 Key0[ WNI_CFG_WEP_DEFAULT_KEY_1_LEN ]; |
| 2481 | tANI_U8 Key1[ WNI_CFG_WEP_DEFAULT_KEY_2_LEN ]; |
| 2482 | tANI_U8 Key2[ WNI_CFG_WEP_DEFAULT_KEY_3_LEN ]; |
| 2483 | tANI_U8 Key3[ WNI_CFG_WEP_DEFAULT_KEY_4_LEN ]; |
| 2484 | |
| 2485 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 2486 | { |
| 2487 | case eCSR_ENCRYPT_TYPE_NONE: |
| 2488 | |
| 2489 | // for NO encryption, turn off Privacy and Rsn. |
| 2490 | PrivacyEnabled = 0; |
| 2491 | RsnEnabled = 0; |
| 2492 | |
| 2493 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 2494 | |
| 2495 | // clear out the WEP keys that may be hanging around. |
| 2496 | Key0Length = 0; |
| 2497 | Key1Length = 0; |
| 2498 | Key2Length = 0; |
| 2499 | Key3Length = 0; |
| 2500 | |
| 2501 | break; |
| 2502 | |
| 2503 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 2504 | |
| 2505 | // Privacy is ON. NO RSN for Wep40 static key. |
| 2506 | PrivacyEnabled = 1; |
| 2507 | RsnEnabled = 0; |
| 2508 | |
| 2509 | // Set the Wep default key ID. |
| 2510 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2511 | // Wep key size if 5 bytes (40 bits). |
| 2512 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2513 | |
| 2514 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 2515 | if ( pProfile->Keys.KeyLength[0] ) |
| 2516 | { |
| 2517 | palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[0], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2518 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2519 | } |
| 2520 | else |
| 2521 | { |
| 2522 | Key0Length = 0; |
| 2523 | } |
| 2524 | |
| 2525 | if ( pProfile->Keys.KeyLength[1] ) |
| 2526 | { |
| 2527 | palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[1], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2528 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2529 | } |
| 2530 | else |
| 2531 | { |
| 2532 | Key1Length = 0; |
| 2533 | } |
| 2534 | |
| 2535 | if ( pProfile->Keys.KeyLength[2] ) |
| 2536 | { |
| 2537 | palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[2], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2538 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2539 | } |
| 2540 | else |
| 2541 | { |
| 2542 | Key2Length = 0; |
| 2543 | } |
| 2544 | |
| 2545 | if ( pProfile->Keys.KeyLength[3] ) |
| 2546 | { |
| 2547 | palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[3], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2548 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2549 | } |
| 2550 | else |
| 2551 | { |
| 2552 | Key3Length = 0; |
| 2553 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2554 | break; |
| 2555 | |
| 2556 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 2557 | |
| 2558 | // Privacy is ON. NO RSN for Wep40 static key. |
| 2559 | PrivacyEnabled = 1; |
| 2560 | RsnEnabled = 0; |
| 2561 | |
| 2562 | // Set the Wep default key ID. |
| 2563 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
| 2564 | |
| 2565 | // Wep key size if 13 bytes (104 bits). |
| 2566 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2567 | |
| 2568 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 2569 | if ( pProfile->Keys.KeyLength[0] ) |
| 2570 | { |
| 2571 | palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[ 0 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2572 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2573 | } |
| 2574 | else |
| 2575 | { |
| 2576 | Key0Length = 0; |
| 2577 | } |
| 2578 | |
| 2579 | if ( pProfile->Keys.KeyLength[1] ) |
| 2580 | { |
| 2581 | palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[ 1 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2582 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2583 | } |
| 2584 | else |
| 2585 | { |
| 2586 | Key1Length = 0; |
| 2587 | } |
| 2588 | |
| 2589 | if ( pProfile->Keys.KeyLength[2] ) |
| 2590 | { |
| 2591 | palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[ 2 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2592 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2593 | } |
| 2594 | else |
| 2595 | { |
| 2596 | Key2Length = 0; |
| 2597 | } |
| 2598 | |
| 2599 | if ( pProfile->Keys.KeyLength[3] ) |
| 2600 | { |
| 2601 | palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[ 3 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2602 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2603 | } |
| 2604 | else |
| 2605 | { |
| 2606 | Key3Length = 0; |
| 2607 | } |
| 2608 | |
| 2609 | break; |
| 2610 | |
| 2611 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 2612 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 2613 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 2614 | case eCSR_ENCRYPT_TYPE_AES: |
| 2615 | #ifdef FEATURE_WLAN_WAPI |
| 2616 | case eCSR_ENCRYPT_TYPE_WPI: |
| 2617 | #endif /* FEATURE_WLAN_WAPI */ |
| 2618 | // !! Note: this is the only difference between this function and the csrSetCfgPrivacyFromProfile() |
| 2619 | // (setting of the privacy CFG based on the advertised privacy setting from the AP for WPA/WAPI associations ). |
| 2620 | PrivacyEnabled = (0 != fPrivacy); |
| 2621 | |
| 2622 | // turn on RSN enabled for WPA associations |
| 2623 | RsnEnabled = 1; |
| 2624 | |
| 2625 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 2626 | |
| 2627 | // clear out the static WEP keys that may be hanging around. |
| 2628 | Key0Length = 0; |
| 2629 | Key1Length = 0; |
| 2630 | Key2Length = 0; |
| 2631 | Key3Length = 0; |
| 2632 | |
| 2633 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2634 | default: |
| 2635 | PrivacyEnabled = 0; |
| 2636 | RsnEnabled = 0; |
| 2637 | break; |
| 2638 | } |
| 2639 | |
| 2640 | ccmCfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 2641 | ccmCfgSetInt(pMac, WNI_CFG_RSN_ENABLED, RsnEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 2642 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length, NULL, eANI_BOOLEAN_FALSE); |
| 2643 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length, NULL, eANI_BOOLEAN_FALSE); |
| 2644 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length, NULL, eANI_BOOLEAN_FALSE); |
| 2645 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length, NULL, eANI_BOOLEAN_FALSE); |
| 2646 | ccmCfgSetInt(pMac, WNI_CFG_WEP_KEY_LENGTH, WepKeyLength, NULL, eANI_BOOLEAN_FALSE); |
| 2647 | ccmCfgSetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId, NULL, eANI_BOOLEAN_FALSE); |
| 2648 | } |
| 2649 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2650 | static void csrSetCfgSsid( tpAniSirGlobal pMac, tSirMacSSid *pSSID ) |
| 2651 | { |
| 2652 | tANI_U32 len = 0; |
| 2653 | if(pSSID->length <= WNI_CFG_SSID_LEN) |
| 2654 | { |
| 2655 | len = pSSID->length; |
| 2656 | } |
| 2657 | ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pSSID->ssId, len, NULL, eANI_BOOLEAN_FALSE); |
| 2658 | } |
| 2659 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2660 | eHalStatus csrSetQosToCfg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrMediaAccessType qosType ) |
| 2661 | { |
| 2662 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2663 | tANI_U32 QoSEnabled; |
| 2664 | tANI_U32 WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2665 | // set the CFG enable/disable variables based on the qosType being configured... |
| 2666 | switch( qosType ) |
| 2667 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2668 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p: |
| 2669 | QoSEnabled = FALSE; |
| 2670 | WmeEnabled = TRUE; |
| 2671 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2672 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP: |
| 2673 | QoSEnabled = FALSE; |
| 2674 | WmeEnabled = TRUE; |
| 2675 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2676 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify: |
| 2677 | QoSEnabled = FALSE; |
| 2678 | WmeEnabled = TRUE; |
| 2679 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2680 | case eCSR_MEDIUM_ACCESS_11e_eDCF: |
| 2681 | QoSEnabled = TRUE; |
| 2682 | WmeEnabled = FALSE; |
| 2683 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2684 | case eCSR_MEDIUM_ACCESS_11e_HCF: |
| 2685 | QoSEnabled = TRUE; |
| 2686 | WmeEnabled = FALSE; |
| 2687 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2688 | default: |
| 2689 | case eCSR_MEDIUM_ACCESS_DCF: |
| 2690 | QoSEnabled = FALSE; |
| 2691 | WmeEnabled = FALSE; |
| 2692 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2693 | } |
| 2694 | //save the WMM setting for later use |
| 2695 | pMac->roam.roamSession[sessionId].fWMMConnection = (tANI_BOOLEAN)WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2696 | status = ccmCfgSetInt(pMac, WNI_CFG_QOS_ENABLED, QoSEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 2697 | status = ccmCfgSetInt(pMac, WNI_CFG_WME_ENABLED, WmeEnabled, NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2698 | return (status); |
| 2699 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2700 | static eHalStatus csrGetRateSet( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc, |
| 2701 | tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet) |
| 2702 | { |
| 2703 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2704 | int i; |
| 2705 | eCsrCfgDot11Mode cfgDot11Mode; |
| 2706 | tANI_U8 *pDstRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2707 | palZeroMemory(pMac->hHdd, pOpRateSet, sizeof(tSirMacRateSet)); |
| 2708 | palZeroMemory(pMac->hHdd, pExRateSet, sizeof(tSirMacRateSet)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2709 | #if defined(VOSS_ENABLED) |
| 2710 | VOS_ASSERT( pIes != NULL ); |
| 2711 | #endif |
| 2712 | |
| 2713 | if( NULL != pIes ) |
| 2714 | { |
| 2715 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2716 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 2717 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 2718 | // appear in the Operational Rate set. Consequently, in either case, we |
| 2719 | // would blindly put the rates we support into our Operational Rate set |
| 2720 | // (including the basic rates, which we have already verified are |
| 2721 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2722 | // However, it turns out that this is not always the case. Some AP's |
| 2723 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 2724 | // too. Now, we're a little more careful: |
| 2725 | pDstRate = pOpRateSet->rate; |
| 2726 | if(pIes->SuppRates.present) |
| 2727 | { |
| 2728 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 2729 | { |
| 2730 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) ) |
| 2731 | { |
| 2732 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
| 2733 | pOpRateSet->numRates++;; |
| 2734 | } |
| 2735 | } |
| 2736 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2737 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 2738 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 2739 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 2740 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 2741 | { |
| 2742 | // If there are Extended Rates in the beacon, we will reflect those |
| 2743 | // extended rates that we support in out Extended Operational Rate |
| 2744 | // set: |
| 2745 | pDstRate = pExRateSet->rate; |
| 2746 | if(pIes->ExtSuppRates.present) |
| 2747 | { |
| 2748 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 2749 | { |
| 2750 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) ) |
| 2751 | { |
| 2752 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 2753 | pExRateSet->numRates++; |
| 2754 | } |
| 2755 | } |
| 2756 | } |
| 2757 | } |
| 2758 | }//Parsing BSSDesc |
| 2759 | else |
| 2760 | { |
| 2761 | smsLog(pMac, LOGE, FL("failed to parse BssDesc\n")); |
| 2762 | } |
| 2763 | if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0) status = eHAL_STATUS_SUCCESS; |
| 2764 | return status; |
| 2765 | } |
| 2766 | |
| 2767 | static void csrSetCfgRateSet( tpAniSirGlobal pMac, eCsrPhyMode phyMode, tCsrRoamProfile *pProfile, |
| 2768 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 2769 | { |
| 2770 | int i; |
| 2771 | tANI_U8 *pDstRate; |
| 2772 | eCsrCfgDot11Mode cfgDot11Mode; |
| 2773 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 2774 | tANI_U32 OperationalRatesLength = 0; |
| 2775 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 2776 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 2777 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 2778 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 2779 | tANI_U32 PropRatesEnable = 0; |
| 2780 | tANI_U8 MCSRateIdxSet[ SIZE_OF_SUPPORTED_MCS_SET ]; |
| 2781 | tANI_U32 MCSRateLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2782 | #if defined(VOSS_ENABLED) |
| 2783 | VOS_ASSERT( pIes != NULL ); |
| 2784 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2785 | if( NULL != pIes ) |
| 2786 | { |
| 2787 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2788 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 2789 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 2790 | // appear in the Operational Rate set. Consequently, in either case, we |
| 2791 | // would blindly put the rates we support into our Operational Rate set |
| 2792 | // (including the basic rates, which we have already verified are |
| 2793 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2794 | // However, it turns out that this is not always the case. Some AP's |
| 2795 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 2796 | // too. Now, we're a little more careful: |
| 2797 | pDstRate = OperationalRates; |
| 2798 | if(pIes->SuppRates.present) |
| 2799 | { |
| 2800 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 2801 | { |
| 2802 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) && |
| 2803 | ( OperationalRatesLength < CSR_DOT11_SUPPORTED_RATES_MAX )) |
| 2804 | { |
| 2805 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
| 2806 | OperationalRatesLength++; |
| 2807 | } |
| 2808 | } |
| 2809 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2810 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 2811 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 2812 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 2813 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 2814 | { |
| 2815 | // If there are Extended Rates in the beacon, we will reflect those |
| 2816 | // extended rates that we support in out Extended Operational Rate |
| 2817 | // set: |
| 2818 | pDstRate = ExtendedOperationalRates; |
| 2819 | if(pIes->ExtSuppRates.present) |
| 2820 | { |
| 2821 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 2822 | { |
| 2823 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) && |
| 2824 | ( ExtendedOperationalRatesLength < CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX )) |
| 2825 | { |
| 2826 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 2827 | ExtendedOperationalRatesLength++; |
| 2828 | } |
| 2829 | } |
| 2830 | } |
| 2831 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2832 | // Enable proprietary MAC features if peer node is Airgo node and STA |
| 2833 | // user wants to use them |
| 2834 | if( pIes->Airgo.present && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 2835 | { |
| 2836 | PropRatesEnable = 1; |
| 2837 | } |
| 2838 | else |
| 2839 | { |
| 2840 | PropRatesEnable = 0; |
| 2841 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2842 | // For ANI network companions, we need to populate the proprietary rate |
| 2843 | // set with any proprietary rates we found in the beacon, only if user |
| 2844 | // allows them... |
| 2845 | if ( PropRatesEnable && pIes->Airgo.PropSuppRates.present && |
| 2846 | ( pIes->Airgo.PropSuppRates.num_rates > 0 )) |
| 2847 | { |
| 2848 | ProprietaryOperationalRatesLength = pIes->Airgo.PropSuppRates.num_rates; |
| 2849 | if ( ProprietaryOperationalRatesLength > sizeof(ProprietaryOperationalRates) ) |
| 2850 | { |
| 2851 | ProprietaryOperationalRatesLength = sizeof (ProprietaryOperationalRates); |
| 2852 | } |
| 2853 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, pIes->Airgo.PropSuppRates.rates, ProprietaryOperationalRatesLength ); |
| 2854 | } |
| 2855 | else { |
| 2856 | // No proprietary modes... |
| 2857 | ProprietaryOperationalRatesLength = 0; |
| 2858 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2859 | /* Get MCS Rate */ |
| 2860 | pDstRate = MCSRateIdxSet; |
| 2861 | if ( pIes->HTCaps.present ) |
| 2862 | { |
| 2863 | for ( i = 0; i < VALID_MAX_MCS_INDEX; i++ ) |
| 2864 | { |
| 2865 | if ( (unsigned int)pIes->HTCaps.supportedMCSSet[0] & (1 << i) ) |
| 2866 | { |
| 2867 | MCSRateLength++; |
| 2868 | *pDstRate++ = i; |
| 2869 | } |
| 2870 | } |
| 2871 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2872 | // Set the operational rate set CFG variables... |
| 2873 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 2874 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 2875 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 2876 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 2877 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 2878 | ProprietaryOperationalRates, |
| 2879 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 2880 | ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE); |
| 2881 | ccmCfgSetStr(pMac, WNI_CFG_CURRENT_MCS_SET, MCSRateIdxSet, |
| 2882 | MCSRateLength, NULL, eANI_BOOLEAN_FALSE); |
| 2883 | }//Parsing BSSDesc |
| 2884 | else |
| 2885 | { |
| 2886 | smsLog(pMac, LOGE, FL("failed to parse BssDesc\n")); |
| 2887 | } |
| 2888 | } |
| 2889 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2890 | static void csrSetCfgRateSetFromProfile( tpAniSirGlobal pMac, |
| 2891 | tCsrRoamProfile *pProfile ) |
| 2892 | { |
| 2893 | tSirMacRateSetIE DefaultSupportedRates11a = { SIR_MAC_RATESET_EID, |
| 2894 | { 8, |
| 2895 | { SIR_MAC_RATE_6, |
| 2896 | SIR_MAC_RATE_9, |
| 2897 | SIR_MAC_RATE_12, |
| 2898 | SIR_MAC_RATE_18, |
| 2899 | SIR_MAC_RATE_24, |
| 2900 | SIR_MAC_RATE_36, |
| 2901 | SIR_MAC_RATE_48, |
| 2902 | SIR_MAC_RATE_54 } } }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2903 | tSirMacRateSetIE DefaultSupportedRates11b = { SIR_MAC_RATESET_EID, |
| 2904 | { 4, |
| 2905 | { SIR_MAC_RATE_1, |
| 2906 | SIR_MAC_RATE_2, |
| 2907 | SIR_MAC_RATE_5_5, |
| 2908 | SIR_MAC_RATE_11 } } }; |
| 2909 | |
| 2910 | |
| 2911 | tSirMacPropRateSet DefaultSupportedPropRates = { 3, |
| 2912 | { SIR_MAC_RATE_72, |
| 2913 | SIR_MAC_RATE_96, |
| 2914 | SIR_MAC_RATE_108 } }; |
| 2915 | eCsrCfgDot11Mode cfgDot11Mode; |
| 2916 | eCsrBand eBand; |
| 2917 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 2918 | tANI_U32 OperationalRatesLength = 0; |
| 2919 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 2920 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 2921 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 2922 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 2923 | tANI_U32 PropRatesEnable = 0; |
| 2924 | tANI_U8 operationChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2925 | if(pProfile->ChannelInfo.ChannelList) |
| 2926 | { |
| 2927 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 2928 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2929 | #ifdef WLAN_SOFTAP_FEATURE |
| 2930 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
| 2931 | #else |
| 2932 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, (eCsrPhyMode)pProfile->phyMode, operationChannel, &eBand ); |
| 2933 | #endif |
| 2934 | // For 11a networks, the 11a rates go into the Operational Rate set. For 11b and 11g |
| 2935 | // networks, the 11b rates appear in the Operational Rate set. In either case, |
| 2936 | // we can blindly put the rates we support into our Operational Rate set |
| 2937 | // (including the basic rates, which we have already verified are supported |
| 2938 | // earlier in the roaming decision). |
| 2939 | if ( eCSR_BAND_5G == eBand ) |
| 2940 | { |
| 2941 | // 11a rates into the Operational Rate Set. |
| 2942 | OperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 2943 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
| 2944 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 2945 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 2946 | OperationalRatesLength ); |
| 2947 | |
| 2948 | // Nothing in the Extended rate set. |
| 2949 | ExtendedOperationalRatesLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2950 | // populate proprietary rates if user allows them |
| 2951 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 2952 | { |
| 2953 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 2954 | sizeof(*DefaultSupportedPropRates.propRate); |
| 2955 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, |
| 2956 | DefaultSupportedPropRates.propRate, |
| 2957 | ProprietaryOperationalRatesLength ); |
| 2958 | } |
| 2959 | else |
| 2960 | { |
| 2961 | // No proprietary modes |
| 2962 | ProprietaryOperationalRatesLength = 0; |
| 2963 | } |
| 2964 | } |
| 2965 | else if ( eCSR_CFG_DOT11_MODE_11B == cfgDot11Mode ) |
| 2966 | { |
| 2967 | // 11b rates into the Operational Rate Set. |
| 2968 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 2969 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
| 2970 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 2971 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 2972 | OperationalRatesLength ); |
| 2973 | // Nothing in the Extended rate set. |
| 2974 | ExtendedOperationalRatesLength = 0; |
| 2975 | // No proprietary modes |
| 2976 | ProprietaryOperationalRatesLength = 0; |
| 2977 | } |
| 2978 | else |
| 2979 | { |
| 2980 | // 11G |
| 2981 | |
| 2982 | // 11b rates into the Operational Rate Set. |
| 2983 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 2984 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
| 2985 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 2986 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 2987 | OperationalRatesLength ); |
| 2988 | |
| 2989 | // 11a rates go in the Extended rate set. |
| 2990 | ExtendedOperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 2991 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
| 2992 | palCopyMemory( pMac->hHdd, ExtendedOperationalRates, |
| 2993 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 2994 | ExtendedOperationalRatesLength ); |
| 2995 | |
| 2996 | // populate proprietary rates if user allows them |
| 2997 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 2998 | { |
| 2999 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3000 | sizeof(*DefaultSupportedPropRates.propRate); |
| 3001 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, |
| 3002 | DefaultSupportedPropRates.propRate, |
| 3003 | ProprietaryOperationalRatesLength ); |
| 3004 | } |
| 3005 | else |
| 3006 | { |
| 3007 | // No proprietary modes |
| 3008 | ProprietaryOperationalRatesLength = 0; |
| 3009 | } |
| 3010 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3011 | // set this to 1 if prop. rates need to be advertised in to the IBSS beacon and user wants to use them |
| 3012 | if ( ProprietaryOperationalRatesLength && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3013 | { |
| 3014 | PropRatesEnable = 1; |
| 3015 | } |
| 3016 | else |
| 3017 | { |
| 3018 | PropRatesEnable = 0; |
| 3019 | } |
| 3020 | |
| 3021 | // Set the operational rate set CFG variables... |
| 3022 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3023 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3024 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3025 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3026 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3027 | ProprietaryOperationalRates, |
| 3028 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3029 | ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3030 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3031 | void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result) |
| 3032 | { |
| 3033 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3034 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3035 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 3036 | tANI_U32 sessionId; |
| 3037 | tSmeCmd *pCommand = NULL; |
| 3038 | |
| 3039 | if(NULL == pEntry) |
| 3040 | { |
| 3041 | smsLog(pMac, LOGW, " CFG_CNF with active list empty\n"); |
| 3042 | return; |
| 3043 | } |
| 3044 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 3045 | sessionId = pCommand->sessionId; |
| 3046 | |
| 3047 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 3048 | { |
| 3049 | csrRoamingStateConfigCnfProcessor(pMac, (tANI_U32)result); |
| 3050 | } |
| 3051 | } |
| 3052 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3053 | //This function is very dump. It is here because PE still need WNI_CFG_PHY_MODE |
| 3054 | tANI_U32 csrRoamGetPhyModeFromDot11Mode(eCsrCfgDot11Mode dot11Mode, eCsrBand band) |
| 3055 | { |
| 3056 | if(eCSR_CFG_DOT11_MODE_11B == dot11Mode) |
| 3057 | { |
| 3058 | return (WNI_CFG_PHY_MODE_11B); |
| 3059 | } |
| 3060 | else |
| 3061 | { |
| 3062 | if(eCSR_BAND_24 == band) |
| 3063 | return (WNI_CFG_PHY_MODE_11G); |
| 3064 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3065 | return (WNI_CFG_PHY_MODE_11A); |
| 3066 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3067 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3068 | |
| 3069 | #ifdef WLAN_FEATURE_11AC |
| 3070 | ePhyChanBondState csrGetHTCBStateFromVHTCBState(ePhyChanBondState aniCBMode) |
| 3071 | { |
| 3072 | switch ( aniCBMode ) |
| 3073 | { |
| 3074 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 3075 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 3076 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 3077 | return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 3078 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 3079 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 3080 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 3081 | return PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 3082 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 3083 | default : |
| 3084 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 3085 | } |
| 3086 | } |
| 3087 | #endif |
| 3088 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3089 | //pIes may be NULL |
| 3090 | eHalStatus csrRoamSetBssConfigCfg(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3091 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 3092 | tDot11fBeaconIEs *pIes) |
| 3093 | { |
| 3094 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3095 | tANI_U32 cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3096 | tANI_U8 channel = 0; |
| 3097 | //Make sure we have the domain info for the BSS we try to connect to. |
| 3098 | //Do we need to worry about sequence for OSs that are not Windows?? |
| 3099 | if(pBssDesc) |
| 3100 | { |
| 3101 | if(csrLearnCountryInformation(pMac, pBssDesc, pIes, eANI_BOOLEAN_TRUE)) |
| 3102 | { |
| 3103 | //Make sure the 11d info from this BSSDesc can be applied |
| 3104 | pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE; |
| 3105 | csrApplyCountryInformation( pMac, TRUE ); |
| 3106 | } |
| 3107 | } |
| 3108 | |
| 3109 | //Qos |
| 3110 | csrSetQosToCfg( pMac, sessionId, pBssConfig->qosType ); |
| 3111 | //SSID |
| 3112 | csrSetCfgSsid(pMac, &pBssConfig->SSID ); |
| 3113 | //fragment threshold |
| 3114 | //ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3115 | //RTS threshold |
| 3116 | //ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3117 | |
| 3118 | //ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, csrTranslateToWNICfgDot11Mode(pMac, pBssConfig->uCfgDot11Mode), NULL, eANI_BOOLEAN_FALSE); |
| 3119 | |
| 3120 | //Auth type |
| 3121 | ccmCfgSetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType, NULL, eANI_BOOLEAN_FALSE); |
| 3122 | //encryption type |
| 3123 | csrSetCfgPrivacy(pMac, pProfile, (tANI_BOOLEAN)pBssConfig->BssCap.privacy ); |
| 3124 | //short slot time |
| 3125 | ccmCfgSetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, pBssConfig->uShortSlotTime, NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3126 | #ifdef WLAN_SOFTAP_FEATURE |
| 3127 | //11d |
| 3128 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 3129 | ((pBssConfig->f11hSupport) ? pBssConfig->f11hSupport : pProfile->ieee80211d), |
| 3130 | NULL, eANI_BOOLEAN_FALSE); |
| 3131 | #endif |
| 3132 | /*//11h |
| 3133 | ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3134 | */ |
| 3135 | ccmCfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, pBssConfig->uPowerLimit, NULL, eANI_BOOLEAN_FALSE); |
| 3136 | //CB |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3137 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3138 | if(CSR_IS_INFRA_AP(pProfile) || CSR_IS_WDS_AP(pProfile)) |
| 3139 | { |
| 3140 | channel = pProfile->operationChannel; |
| 3141 | } |
| 3142 | else |
| 3143 | { |
| 3144 | if(pBssDesc) |
| 3145 | { |
| 3146 | channel = pBssDesc->channelId; |
| 3147 | } |
| 3148 | } |
| 3149 | if(0 != channel) |
| 3150 | { |
| 3151 | if(CSR_IS_CHANNEL_24GHZ(channel)) |
| 3152 | {//for now if we are on 2.4 Ghz, CB will be always disabled |
| 3153 | cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3154 | } |
| 3155 | else |
| 3156 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3157 | cfgCb = pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3158 | } |
| 3159 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3160 | #ifdef WLAN_FEATURE_11AC |
| 3161 | if(cfgCb > 2 ) |
| 3162 | { |
| 3163 | if(!WDA_getFwWlanFeatCaps(DOT11AC)) { |
| 3164 | cfgCb = csrGetHTCBStateFromVHTCBState(cfgCb); |
| 3165 | } |
| 3166 | else |
| 3167 | { |
| 3168 | ccmCfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, pMac->roam.configParam.nVhtChannelWidth, NULL, eANI_BOOLEAN_FALSE); |
| 3169 | } |
| 3170 | } |
| 3171 | else |
| 3172 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3173 | ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, cfgCb, NULL, eANI_BOOLEAN_FALSE); |
| 3174 | //Rate |
| 3175 | //Fixed Rate |
| 3176 | if(pBssDesc) |
| 3177 | { |
| 3178 | csrSetCfgRateSet(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile, pBssDesc, pIes); |
| 3179 | } |
| 3180 | else |
| 3181 | { |
| 3182 | csrSetCfgRateSetFromProfile(pMac, pProfile); |
| 3183 | } |
| 3184 | //Make this the last CFG to set. The callback will trigger a join_req |
| 3185 | //Join time out |
| 3186 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId ); |
| 3187 | |
| 3188 | ccmCfgSetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, pBssConfig->uJoinTimeOut, (tCcmCfgSetCallback)csrRoamCcmCfgSetCallback, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3189 | return (status); |
| 3190 | } |
| 3191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3192 | eHalStatus csrRoamStopNetwork( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3193 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3194 | { |
| 3195 | eHalStatus status; |
| 3196 | tBssConfigParam *pBssConfig; |
| 3197 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3198 | status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); |
| 3199 | if(HAL_STATUS_SUCCESS(status)) |
| 3200 | { |
| 3201 | palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam)); |
| 3202 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, pBssConfig, pIes); |
| 3203 | if(HAL_STATUS_SUCCESS(status)) |
| 3204 | { |
| 3205 | pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3206 | /* This will allow to pass cbMode during join req */ |
| 3207 | pSession->bssParams.cbMode= pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3208 | //For IBSS, we need to prepare some more information |
| 3209 | if( csrIsBssTypeIBSS(pProfile->BSSType) || CSR_IS_WDS( pProfile ) |
| 3210 | #ifdef WLAN_SOFTAP_FEATURE |
| 3211 | || CSR_IS_INFRA_AP(pProfile) |
| 3212 | #endif |
| 3213 | ) |
| 3214 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3215 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3216 | } |
| 3217 | // If we are in an IBSS, then stop the IBSS... |
| 3218 | ////Not worry about WDS connection for now |
| 3219 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 3220 | { |
| 3221 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 3222 | } |
| 3223 | else |
| 3224 | { |
| 3225 | // if we are in an Infrastructure association.... |
| 3226 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 3227 | { |
| 3228 | // and the new Bss is an Ibss OR we are roaming from Infra to Infra |
| 3229 | // across SSIDs (roaming to a new SSID)... // |
| 3230 | //Not worry about WDS connection for now |
| 3231 | if ( pBssDesc && ( ( csrIsIbssBssDesc( pBssDesc ) ) || |
| 3232 | !csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIes ) ) ) |
| 3233 | { |
| 3234 | // then we need to disassociate from the Infrastructure network... |
| 3235 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 3236 | } |
| 3237 | else |
| 3238 | { |
| 3239 | // In an Infrastucture and going to an Infrastructure network with the same SSID. This |
| 3240 | // calls for a Reassociation sequence. So issue the CFG sets for this new AP. |
| 3241 | if ( pBssDesc ) |
| 3242 | { |
| 3243 | // Set parameters for this Bss. |
| 3244 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
| 3245 | } |
| 3246 | } |
| 3247 | } |
| 3248 | else |
| 3249 | { |
| 3250 | // Neiher in IBSS nor in Infra. We can go ahead and set the CFG for tne new network... |
| 3251 | // Nothing to stop. |
| 3252 | if ( pBssDesc || CSR_IS_WDS_AP( pProfile ) |
| 3253 | #ifdef WLAN_SOFTAP_FEATURE |
| 3254 | || CSR_IS_INFRA_AP(pProfile) |
| 3255 | #endif |
| 3256 | ) |
| 3257 | { |
| 3258 | // Set parameters for this Bss. |
| 3259 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
| 3260 | } |
| 3261 | } |
| 3262 | } |
| 3263 | }//Success getting BSS config info |
| 3264 | palFreeMemory(pMac->hHdd, pBssConfig); |
| 3265 | }//Allocate memory |
| 3266 | |
| 3267 | return (status); |
| 3268 | } |
| 3269 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3270 | eCsrJoinState csrRoamJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3271 | tCsrScanResultInfo *pScanResult, tCsrRoamProfile *pProfile ) |
| 3272 | { |
| 3273 | eCsrJoinState eRoamState = eCsrContinueRoaming; |
| 3274 | eHalStatus status; |
| 3275 | tSirBssDescription *pBssDesc = &pScanResult->BssDescriptor; |
| 3276 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)( pScanResult->pvIes ); //This may be NULL |
| 3277 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3278 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 3279 | { |
| 3280 | status = csrRoamStartWds( pMac, sessionId, pProfile, pBssDesc ); |
| 3281 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 3282 | { |
| 3283 | eRoamState = eCsrStopRoaming; |
| 3284 | } |
| 3285 | } |
| 3286 | else |
| 3287 | { |
| 3288 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 3289 | { |
| 3290 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
| 3291 | return (eCsrStopRoaming); |
| 3292 | } |
| 3293 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 3294 | { |
| 3295 | // If we are connected in infrastructure mode and the Join Bss description is for the same BssID, then we are |
| 3296 | // attempting to join the AP we are already connected with. In that case, see if the Bss or Sta capabilities |
| 3297 | // have changed and handle the changes (without disturbing the current association). |
| 3298 | |
| 3299 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && |
| 3300 | csrIsBssIdEqual( pMac, pBssDesc, pSession->pConnectBssDesc ) && |
| 3301 | csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIesLocal ) |
| 3302 | ) |
| 3303 | { |
| 3304 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 3305 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 3306 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 3307 | // a new Association. |
| 3308 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 3309 | { |
| 3310 | smsLog(pMac, LOGW, FL(" detect same profile authType = %d encryType = %d\n"), pProfile->AuthType, pProfile->EncryptionType); |
| 3311 | if(csrRoamIsSameProfileKeys(pMac, &pSession->connectedProfile, pProfile)) |
| 3312 | { |
| 3313 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 3314 | } |
| 3315 | else |
| 3316 | { |
| 3317 | tBssConfigParam bssConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3318 | //The key changes |
| 3319 | palZeroMemory(pMac->hHdd, &bssConfig, sizeof(bssConfig)); |
| 3320 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 3321 | if(HAL_STATUS_SUCCESS(status)) |
| 3322 | { |
| 3323 | pSession->bssParams.uCfgDot11Mode = bssConfig.uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3324 | pSession->bssParams.cbMode = bssConfig.cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3325 | //Reapply the config including Keys so reassoc is happening. |
| 3326 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 3327 | if(!HAL_STATUS_SUCCESS(status)) |
| 3328 | { |
| 3329 | eRoamState = eCsrStopRoaming; |
| 3330 | } |
| 3331 | } |
| 3332 | else |
| 3333 | { |
| 3334 | eRoamState = eCsrStopRoaming; |
| 3335 | } |
| 3336 | }//same profile |
| 3337 | } |
| 3338 | else |
| 3339 | { |
| 3340 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, sessionId, |
| 3341 | eCSR_ROAM_SUBSTATE_DISASSOC_REQ, FALSE ))) |
| 3342 | { |
| 3343 | smsLog(pMac, LOGW, FL(" fail to issue disassociate\n")); |
| 3344 | eRoamState = eCsrStopRoaming; |
| 3345 | } |
| 3346 | } |
| 3347 | } |
| 3348 | else |
| 3349 | { |
| 3350 | // note: we used to pre-auth here with open authentication networks but that was not working so well. |
| 3351 | // we had a lot of join timeouts when testing at Samsung. removing this step helped associations |
| 3352 | // work much better. |
| 3353 | // |
| 3354 | // |
| 3355 | // stop the existing network before attempting to join the new network... |
| 3356 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 3357 | { |
| 3358 | eRoamState = eCsrStopRoaming; |
| 3359 | } |
| 3360 | } |
| 3361 | }//Infra |
| 3362 | else |
| 3363 | { |
| 3364 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 3365 | { |
| 3366 | eRoamState = eCsrStopRoaming; |
| 3367 | } |
| 3368 | } |
| 3369 | if( pIesLocal && !pScanResult->pvIes ) |
| 3370 | { |
| 3371 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 3372 | } |
| 3373 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3374 | return( eRoamState ); |
| 3375 | } |
| 3376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3377 | eHalStatus csrRoamShouldRoam(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3378 | tSirBssDescription *pBssDesc, tANI_U32 roamId) |
| 3379 | { |
| 3380 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3381 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3382 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 3383 | roamInfo.pBssDesc = pBssDesc; |
| 3384 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, roamId, eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE); |
| 3385 | return (status); |
| 3386 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3387 | //In case no matching BSS is found, use whatever default we can find |
| 3388 | static void csrRoamAssignDefaultParam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 3389 | { |
| 3390 | //Need to get all negotiated types in place first |
| 3391 | //auth type |
| 3392 | switch( pCommand->u.roamCmd.roamProfile.AuthType.authType[0] ) //Take the prefered Auth type. |
| 3393 | { |
| 3394 | default: |
| 3395 | case eCSR_AUTH_TYPE_WPA: |
| 3396 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 3397 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 3398 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3399 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 3400 | break; |
| 3401 | |
| 3402 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 3403 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 3404 | break; |
| 3405 | |
| 3406 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 3407 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 3408 | break; |
| 3409 | } |
| 3410 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 3411 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 3412 | //In this case, the multicast encryption needs to follow the uncast ones. |
| 3413 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 3414 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 3415 | } |
| 3416 | |
| 3417 | static eCsrJoinState csrRoamJoinNextBss( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fUseSameBss ) |
| 3418 | { |
| 3419 | eHalStatus status; |
| 3420 | tCsrScanResult *pScanResult = NULL; |
| 3421 | eCsrJoinState eRoamState = eCsrStopRoaming; |
| 3422 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 3423 | tANI_BOOLEAN fDone = eANI_BOOLEAN_FALSE; |
| 3424 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 3425 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 3426 | v_U8_t acm_mask = 0; |
| 3427 | #endif |
| 3428 | tANI_U32 sessionId = pCommand->sessionId; |
| 3429 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 3430 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 3431 | tANI_U8 concurrentChannel = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3433 | do |
| 3434 | { |
| 3435 | // Check for Cardbus eject condition, before trying to Roam to any BSS |
| 3436 | //***if( !balIsCardPresent(pAdapter) ) break; |
| 3437 | |
| 3438 | if(NULL != pBSSList) |
| 3439 | { |
| 3440 | // When handling AP's capability change, continue to associate to |
| 3441 | // same BSS and make sure pRoamBssEntry is not Null. |
| 3442 | if((eANI_BOOLEAN_FALSE == fUseSameBss) || (pCommand->u.roamCmd.pRoamBssEntry == NULL)) |
| 3443 | { |
| 3444 | if(pCommand->u.roamCmd.pRoamBssEntry == NULL) |
| 3445 | { |
| 3446 | //Try the first BSS |
| 3447 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 3448 | pCommand->u.roamCmd.pRoamBssEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 3449 | } |
| 3450 | else |
| 3451 | { |
| 3452 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 3453 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 3454 | { |
| 3455 | //Done with all the BSSs |
| 3456 | //In this case, will tell HDD the completion |
| 3457 | break; |
| 3458 | } |
| 3459 | else |
| 3460 | { |
| 3461 | //We need to indicate to HDD that we are done with this one. |
| 3462 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 3463 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; //this shall not be NULL |
| 3464 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 3465 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 3466 | pRoamInfo = &roamInfo; |
| 3467 | } |
| 3468 | } |
| 3469 | while(pCommand->u.roamCmd.pRoamBssEntry) |
| 3470 | { |
| 3471 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3472 | /*If concurrency enabled take the concurrent connected channel first. */ |
| 3473 | /* Valid multichannel concurrent sessions exempted */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3474 | if (vos_concurrent_sessions_running() && |
| 3475 | !csrIsValidMcConcurrentSession(pMac, sessionId, &pScanResult->Result.BssDescriptor)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3476 | { |
| 3477 | concurrentChannel = |
| 3478 | csrGetConcurrentOperationChannel(pMac); |
| 3479 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: " |
| 3480 | " csr Concurrent Channel = %d", __FUNCTION__, concurrentChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3481 | if ((concurrentChannel) && |
| 3482 | (concurrentChannel == |
| 3483 | pScanResult->Result.BssDescriptor.channelId)) |
| 3484 | { |
| 3485 | //make this 0 because we do not want the |
| 3486 | //below check to pass as we don't want to |
| 3487 | //connect on other channel |
| 3488 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 3489 | FL("Concurrent channel match =%d"), |
| 3490 | concurrentChannel); |
| 3491 | concurrentChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3492 | } |
| 3493 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3494 | |
| 3495 | if (!concurrentChannel) |
| 3496 | { |
| 3497 | |
| 3498 | if(HAL_STATUS_SUCCESS(csrRoamShouldRoam(pMac, |
| 3499 | sessionId, &pScanResult->Result.BssDescriptor, |
| 3500 | pCommand->u.roamCmd.roamId))) |
| 3501 | { |
| 3502 | //Ok to roam this |
| 3503 | break; |
| 3504 | } |
| 3505 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3506 | else |
| 3507 | { |
| 3508 | eRoamState = eCsrStopRoamingDueToConcurrency; |
| 3509 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3510 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 3511 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 3512 | { |
| 3513 | //Done with all the BSSs |
| 3514 | fDone = eANI_BOOLEAN_TRUE; |
| 3515 | break; |
| 3516 | } |
| 3517 | } |
| 3518 | if(fDone) |
| 3519 | { |
| 3520 | break; |
| 3521 | } |
| 3522 | } |
| 3523 | } |
| 3524 | //We have something to roam, tell HDD when it is infra. |
| 3525 | //For IBSS, the indication goes back to HDD via eCSR_ROAM_IBSS_IND |
| 3526 | //For WDS, the indication is eCSR_ROAM_WDS_IND |
| 3527 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 3528 | { |
| 3529 | if(pRoamInfo) |
| 3530 | { |
| 3531 | pSession->bRefAssocStartCnt--; |
| 3532 | //Complete the last association attemp because a new one is about to be tried |
| 3533 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 3534 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 3535 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 3536 | } |
| 3537 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 3538 | if(pScanResult) |
| 3539 | { |
| 3540 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3541 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->Result.BssDescriptor, &pIesLocal))) ) |
| 3542 | { |
| 3543 | smsLog(pMac, LOGE, FL(" cannot parse IEs\n")); |
| 3544 | fDone = eANI_BOOLEAN_TRUE; |
| 3545 | eRoamState = eCsrStopRoaming; |
| 3546 | break; |
| 3547 | } |
| 3548 | roamInfo.pBssDesc = &pScanResult->Result.BssDescriptor; |
| 3549 | pCommand->u.roamCmd.pLastRoamBss = roamInfo.pBssDesc; |
| 3550 | //No need to put uapsd_mask in if the BSS doesn't support uAPSD |
| 3551 | if( pCommand->u.roamCmd.roamProfile.uapsd_mask && |
| 3552 | CSR_IS_QOS_BSS(pIesLocal) && |
| 3553 | CSR_IS_UAPSD_BSS(pIesLocal) ) |
| 3554 | { |
| 3555 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3556 | acm_mask = sme_QosGetACMMask(pMac, &pScanResult->Result.BssDescriptor, |
| 3557 | pIesLocal); |
| 3558 | pCommand->u.roamCmd.roamProfile.uapsd_mask &= ~(acm_mask); |
| 3559 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3560 | } |
| 3561 | else |
| 3562 | { |
| 3563 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 3564 | } |
| 3565 | if( pIesLocal && !pScanResult->Result.pvIes) |
| 3566 | { |
| 3567 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 3568 | } |
| 3569 | } |
| 3570 | else |
| 3571 | { |
| 3572 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 3573 | } |
| 3574 | roamInfo.pProfile = pProfile; |
| 3575 | pSession->bRefAssocStartCnt++; |
| 3576 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 3577 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 3578 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3579 | if ( NULL == pCommand->u.roamCmd.pRoamBssEntry ) |
| 3580 | { |
| 3581 | // If this is a start IBSS profile, then we need to start the IBSS. |
| 3582 | if ( CSR_IS_START_IBSS(pProfile) ) |
| 3583 | { |
| 3584 | tANI_BOOLEAN fSameIbss = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3585 | // Attempt to start this IBSS... |
| 3586 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 3587 | status = csrRoamStartIbss( pMac, sessionId, pProfile, &fSameIbss ); |
| 3588 | if(HAL_STATUS_SUCCESS(status)) |
| 3589 | { |
| 3590 | if ( fSameIbss ) |
| 3591 | { |
| 3592 | eRoamState = eCsrStartIbssSameIbss; |
| 3593 | } |
| 3594 | else |
| 3595 | { |
| 3596 | eRoamState = eCsrContinueRoaming; |
| 3597 | } |
| 3598 | } |
| 3599 | else |
| 3600 | { |
| 3601 | //it somehow fail need to stop |
| 3602 | eRoamState = eCsrStopRoaming; |
| 3603 | } |
| 3604 | break; |
| 3605 | } |
| 3606 | else if ( (CSR_IS_WDS_AP(pProfile)) |
| 3607 | #ifdef WLAN_SOFTAP_FEATURE |
| 3608 | || (CSR_IS_INFRA_AP(pProfile)) |
| 3609 | #endif |
| 3610 | ) |
| 3611 | { |
| 3612 | // Attempt to start this WDS... |
| 3613 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 3614 | /* For AP WDS, we dont have any BSSDescription */ |
| 3615 | status = csrRoamStartWds( pMac, sessionId, pProfile, NULL ); |
| 3616 | if(HAL_STATUS_SUCCESS(status)) |
| 3617 | { |
| 3618 | eRoamState = eCsrContinueRoaming; |
| 3619 | } |
| 3620 | else |
| 3621 | { |
| 3622 | //it somehow fail need to stop |
| 3623 | eRoamState = eCsrStopRoaming; |
| 3624 | } |
| 3625 | } |
| 3626 | else |
| 3627 | { |
| 3628 | //Nothing we can do |
| 3629 | smsLog(pMac, LOGW, FL("cannot continue without BSS list\n")); |
| 3630 | eRoamState = eCsrStopRoaming; |
| 3631 | break; |
| 3632 | } |
| 3633 | } |
| 3634 | else //We have BSS |
| 3635 | { |
| 3636 | //Need to assign these value because they are used in csrIsSameProfile |
| 3637 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 3638 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = pScanResult->ucEncryptionType; //Negotiated while building scan result. |
| 3639 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = pScanResult->mcEncryptionType; |
| 3640 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = pScanResult->authType; |
| 3641 | if ( CSR_IS_START_IBSS(&pCommand->u.roamCmd.roamProfile) ) |
| 3642 | { |
| 3643 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 3644 | { |
| 3645 | eRoamState = eCsrStartIbssSameIbss; |
| 3646 | break; |
| 3647 | } |
| 3648 | } |
| 3649 | if( pCommand->u.roamCmd.fReassocToSelfNoCapChange ) |
| 3650 | { |
| 3651 | //trying to connect to the one already connected |
| 3652 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_FALSE; |
| 3653 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 3654 | break; |
| 3655 | } |
| 3656 | // Attempt to Join this Bss... |
| 3657 | eRoamState = csrRoamJoin( pMac, sessionId, &pScanResult->Result, pProfile ); |
| 3658 | break; |
| 3659 | } |
| 3660 | |
| 3661 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3662 | if( (eCsrStopRoaming == eRoamState) && (CSR_IS_INFRASTRUCTURE( pProfile )) ) |
| 3663 | { |
| 3664 | //Need to indicate association_completion if association_start has been done |
| 3665 | if(pSession->bRefAssocStartCnt > 0) |
| 3666 | { |
| 3667 | pSession->bRefAssocStartCnt--; |
| 3668 | //Complete the last association attemp because a new one is about to be tried |
| 3669 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 3670 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 3671 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 3672 | } |
| 3673 | } |
| 3674 | |
| 3675 | return( eRoamState ); |
| 3676 | } |
| 3677 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3678 | static eHalStatus csrRoam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 3679 | { |
| 3680 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3681 | eCsrJoinState RoamState; |
| 3682 | tANI_U32 sessionId = pCommand->sessionId; |
| 3683 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3684 | //***if( hddIsRadioStateOn( pAdapter ) ) |
| 3685 | { |
| 3686 | // Attept to join a Bss... |
| 3687 | RoamState = csrRoamJoinNextBss( pMac, pCommand, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3688 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3689 | // if nothing to join.. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3690 | if (( eCsrStopRoaming == RoamState ) || ( eCsrStopRoamingDueToConcurrency == RoamState)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3691 | { |
| 3692 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3693 | // and if connected in Infrastructure mode... |
| 3694 | if ( csrIsConnStateInfra(pMac, sessionId) ) |
| 3695 | { |
| 3696 | //... then we need to issue a disassociation |
| 3697 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, FALSE ); |
| 3698 | if(!HAL_STATUS_SUCCESS(status)) |
| 3699 | { |
| 3700 | smsLog(pMac, LOGW, FL(" failed to issue disassociate, status = %d\n"), status); |
| 3701 | //roam command is completed by caller in the failed case |
| 3702 | fComplete = eANI_BOOLEAN_TRUE; |
| 3703 | } |
| 3704 | } |
| 3705 | else if( csrIsConnStateIbss(pMac, sessionId) ) |
| 3706 | { |
| 3707 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 3708 | if(!HAL_STATUS_SUCCESS(status)) |
| 3709 | { |
| 3710 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d\n"), status); |
| 3711 | //roam command is completed by caller in the failed case |
| 3712 | fComplete = eANI_BOOLEAN_TRUE; |
| 3713 | } |
| 3714 | } |
| 3715 | #ifdef WLAN_SOFTAP_FEATURE |
| 3716 | else if (csrIsConnStateConnectedInfraAp(pMac, sessionId)) |
| 3717 | { |
| 3718 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 3719 | if(!HAL_STATUS_SUCCESS(status)) |
| 3720 | { |
| 3721 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d\n"), status); |
| 3722 | //roam command is completed by caller in the failed case |
| 3723 | fComplete = eANI_BOOLEAN_TRUE; |
| 3724 | } |
| 3725 | } |
| 3726 | #endif |
| 3727 | else |
| 3728 | { |
| 3729 | fComplete = eANI_BOOLEAN_TRUE; |
| 3730 | } |
| 3731 | if(fComplete) |
| 3732 | { |
| 3733 | // ... otherwise, we can complete the Roam command here. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3734 | if(eCsrStopRoamingDueToConcurrency == RoamState) |
| 3735 | { |
| 3736 | csrRoamComplete( pMac, eCsrJoinFailureDueToConcurrency, NULL ); |
| 3737 | } |
| 3738 | else |
| 3739 | { |
| 3740 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 3741 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3742 | } |
| 3743 | } |
| 3744 | else if ( eCsrReassocToSelfNoCapChange == RoamState ) |
| 3745 | { |
| 3746 | csrRoamComplete( pMac, eCsrSilentlyStopRoamingSaveState, NULL ); |
| 3747 | } |
| 3748 | else if ( eCsrStartIbssSameIbss == RoamState ) |
| 3749 | { |
| 3750 | csrRoamComplete( pMac, eCsrSilentlyStopRoaming, NULL ); |
| 3751 | } |
| 3752 | }//hddIsRadioStateOn |
| 3753 | |
| 3754 | return status; |
| 3755 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3756 | eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 3757 | { |
| 3758 | tANI_U32 sessionId; |
| 3759 | tCsrRoamSession *pSession; |
| 3760 | tCsrScanResult *pScanResult = NULL; |
| 3761 | tSirBssDescription *pBssDesc = NULL; |
| 3762 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3763 | sessionId = pCommand->sessionId; |
| 3764 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3765 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 3766 | { |
| 3767 | //the roaming is cancelled. Simply complete the command |
| 3768 | smsLog(pMac, LOG1, FL(" Roam command cancelled\n")); |
| 3769 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 3770 | return eHAL_STATUS_FAILURE; |
| 3771 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3772 | if (pCommand->u.roamCmd.pRoamBssEntry) |
| 3773 | { |
| 3774 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 3775 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 3776 | } |
| 3777 | else |
| 3778 | { |
| 3779 | //the roaming is cancelled. Simply complete the command |
| 3780 | smsLog(pMac, LOG1, FL(" Roam command cancelled\n")); |
| 3781 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 3782 | return eHAL_STATUS_FAILURE; |
| 3783 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3784 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 3785 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 3786 | return status; |
| 3787 | } |
| 3788 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3789 | eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 3790 | { |
| 3791 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3792 | tCsrRoamInfo roamInfo; |
| 3793 | tANI_U32 sessionId = pCommand->sessionId; |
| 3794 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 3795 | |
| 3796 | switch ( pCommand->u.roamCmd.roamReason ) |
| 3797 | { |
| 3798 | case eCsrForcedDisassoc: |
| 3799 | csrFreeRoamProfile(pMac, sessionId); |
| 3800 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 3801 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3802 | case eCsrSmeIssuedDisassocForHandoff: |
| 3803 | //Not to free pMac->roam.pCurRoamProfile (via csrFreeRoamProfile) because it is needed after disconnect |
| 3804 | #if 0 // TODO : Confirm this change |
| 3805 | status = csrRoamProcessDisassociate( pMac, pCommand, FALSE ); |
| 3806 | #else |
| 3807 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 3808 | #endif |
| 3809 | |
| 3810 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3811 | case eCsrForcedDisassocMICFailure: |
| 3812 | csrFreeRoamProfile(pMac, sessionId); |
| 3813 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, TRUE ); |
| 3814 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3815 | case eCsrForcedDeauth: |
| 3816 | csrFreeRoamProfile(pMac, sessionId); |
| 3817 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, FALSE, FALSE ); |
| 3818 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3819 | case eCsrHddIssuedReassocToSameAP: |
| 3820 | case eCsrSmeIssuedReassocToSameAP: |
| 3821 | { |
| 3822 | tDot11fBeaconIEs *pIes = NULL; |
| 3823 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3824 | if( pSession->pConnectBssDesc ) |
| 3825 | { |
| 3826 | status = csrGetParsedBssDescriptionIEs(pMac, pSession->pConnectBssDesc, &pIes); |
| 3827 | if(!HAL_STATUS_SUCCESS(status) ) |
| 3828 | { |
| 3829 | smsLog(pMac, LOGE, FL(" fail to parse IEs\n")); |
| 3830 | } |
| 3831 | else |
| 3832 | { |
| 3833 | roamInfo.reasonCode = eCsrRoamReasonStaCapabilityChanged; |
| 3834 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
| 3835 | pSession->roamingReason = eCsrReassocRoaming; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3836 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 3837 | roamInfo.pProfile = &pCommand->u.roamCmd.roamProfile; |
| 3838 | pSession->bRefAssocStartCnt++; |
| 3839 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 3840 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 3841 | |
| 3842 | smsLog(pMac, LOG1, FL(" calling csrRoamIssueReassociate\n")); |
| 3843 | csrRoamIssueReassociate( pMac, sessionId, pSession->pConnectBssDesc, pIes, |
| 3844 | &pCommand->u.roamCmd.roamProfile ); |
| 3845 | palFreeMemory(pMac->hHdd, pIes); |
| 3846 | pIes = NULL; |
| 3847 | } |
| 3848 | } |
| 3849 | break; |
| 3850 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3851 | case eCsrCapsChange: |
| 3852 | smsLog(pMac, LOGE, FL("received eCsrCapsChange \n")); |
| 3853 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 3854 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE); |
| 3855 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3856 | case eCsrSmeIssuedFTReassoc: |
| 3857 | smsLog(pMac, LOGE, FL("received FT Reassoc Req \n")); |
| 3858 | status = csrProcessFTReassocRoamCommand(pMac, pCommand); |
| 3859 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 3860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3861 | case eCsrStopBss: |
| 3862 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 3863 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 3864 | break; |
| 3865 | |
| 3866 | case eCsrForcedDisassocSta: |
| 3867 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 3868 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId); |
| 3869 | status = csrSendMBDisassocReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 3870 | pCommand->u.roamCmd.reason); |
| 3871 | break; |
| 3872 | |
| 3873 | case eCsrForcedDeauthSta: |
| 3874 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 3875 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId); |
| 3876 | status = csrSendMBDeauthReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 3877 | pCommand->u.roamCmd.reason); |
| 3878 | break; |
| 3879 | |
| 3880 | default: |
| 3881 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 3882 | |
| 3883 | if( pCommand->u.roamCmd.fUpdateCurRoamProfile ) |
| 3884 | { |
| 3885 | //Remember the roaming profile |
| 3886 | csrFreeRoamProfile(pMac, sessionId); |
| 3887 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)))) |
| 3888 | { |
| 3889 | palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 3890 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, &pCommand->u.roamCmd.roamProfile); |
| 3891 | } |
| 3892 | } |
| 3893 | |
| 3894 | //At this point, original uapsd_mask is saved in pCurRoamProfile |
| 3895 | //uapsd_mask in the pCommand may change from this point on. |
| 3896 | |
| 3897 | // Attempt to roam with the new scan results (if we need to..) |
| 3898 | status = csrRoam( pMac, pCommand ); |
| 3899 | break; |
| 3900 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3901 | return (status); |
| 3902 | } |
| 3903 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3904 | void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 3905 | { |
| 3906 | if(pCommand->u.roamCmd.fReleaseBssList) |
| 3907 | { |
| 3908 | csrScanResultPurge(pMac, pCommand->u.roamCmd.hBSSList); |
| 3909 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 3910 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 3911 | } |
| 3912 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 3913 | { |
| 3914 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 3915 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 3916 | } |
| 3917 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 3918 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
| 3919 | palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd)); |
| 3920 | } |
| 3921 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3922 | void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 3923 | { |
| 3924 | palZeroMemory(pMac->hHdd, &pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd)); |
| 3925 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3926 | void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context ) |
| 3927 | { |
| 3928 | tListElem *pEntry; |
| 3929 | tSmeCmd *pCommand; |
| 3930 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3931 | smsLog( pMac, LOG2, "roamQ: Roam Completion ...\n" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3932 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 3933 | if ( pEntry ) |
| 3934 | { |
| 3935 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3936 | // If the head of the queue is Active and it is a ROAM command, remove |
| 3937 | // and put this on the Free queue. |
| 3938 | if ( eSmeCommandRoam == pCommand->command ) |
| 3939 | { |
| 3940 | //we need to process the result first before removing it from active list because state changes |
| 3941 | //still happening insides roamQProcessRoamResults so no other roam command should be issued |
| 3942 | fReleaseCommand = csrRoamProcessResults( pMac, pCommand, Result, Context ); |
| 3943 | if( fReleaseCommand ) |
| 3944 | { |
| 3945 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 3946 | { |
| 3947 | csrReleaseCommandRoam( pMac, pCommand ); |
| 3948 | } |
| 3949 | else |
| 3950 | { |
| 3951 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d\n", |
| 3952 | pCommand->u.roamCmd.roamReason ); |
| 3953 | } |
| 3954 | } |
| 3955 | else |
| 3956 | { |
| 3957 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d\n", |
| 3958 | pCommand->u.roamCmd.roamReason ); |
| 3959 | } |
| 3960 | } |
| 3961 | else |
| 3962 | { |
| 3963 | smsLog( pMac, LOGW, "CSR: Roam Completion called but ROAM command is not ACTIVE ...\n" ); |
| 3964 | } |
| 3965 | } |
| 3966 | else |
| 3967 | { |
| 3968 | smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ...\n" ); |
| 3969 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3970 | if( fReleaseCommand ) |
| 3971 | { |
| 3972 | smeProcessPendingQueue( pMac ); |
| 3973 | } |
| 3974 | } |
| 3975 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3976 | void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 3977 | { |
| 3978 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3979 | palZeroMemory( pMac->hHdd, &(pSession->PmkidCandidateInfo[0]), sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED ); |
| 3980 | pSession->NumPmkidCandidate = 0; |
| 3981 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3982 | #ifdef FEATURE_WLAN_WAPI |
| 3983 | void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 3984 | { |
| 3985 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 3986 | palZeroMemory( pMac->hHdd, &(pSession->BkidCandidateInfo[0]), sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED ); |
| 3987 | pSession->NumBkidCandidate = 0; |
| 3988 | } |
| 3989 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3990 | extern tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ]; |
| 3991 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3992 | static eHalStatus csrRoamSaveSecurityRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrAuthType authType, |
| 3993 | tSirBssDescription *pSirBssDesc, |
| 3994 | tDot11fBeaconIEs *pIes) |
| 3995 | { |
| 3996 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3997 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 3998 | tDot11fBeaconIEs *pIesLocal = pIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3999 | if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4000 | (eCSR_AUTH_TYPE_WPA_PSK == authType) || |
| 4001 | (eCSR_AUTH_TYPE_RSN == authType) || |
| 4002 | (eCSR_AUTH_TYPE_RSN_PSK == authType) |
| 4003 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4004 | || |
| 4005 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4006 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) |
| 4007 | #endif /* FEATURE_WLAN_WAPI */ |
| 4008 | #ifdef FEATURE_WLAN_WAPI |
| 4009 | || |
| 4010 | (eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4011 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType) |
| 4012 | #endif /* FEATURE_WLAN_WAPI */ |
| 4013 | ) |
| 4014 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4015 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 4016 | { |
| 4017 | smsLog(pMac, LOGE, FL(" cannot parse IEs\n")); |
| 4018 | } |
| 4019 | if( pIesLocal ) |
| 4020 | { |
| 4021 | tANI_U32 nIeLen; |
| 4022 | tANI_U8 *pIeBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4023 | if((eCSR_AUTH_TYPE_RSN == authType) || |
| 4024 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4025 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4026 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) || |
| 4027 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4028 | (eCSR_AUTH_TYPE_RSN_PSK == authType)) |
| 4029 | { |
| 4030 | if(pIesLocal->RSN.present) |
| 4031 | { |
| 4032 | //Calculate the actual length |
| 4033 | nIeLen = 8 //version + gp_cipher_suite + pwise_cipher_suite_count |
| 4034 | + pIesLocal->RSN.pwise_cipher_suite_count * 4 //pwise_cipher_suites |
| 4035 | + 2 //akm_suite_count |
| 4036 | + pIesLocal->RSN.akm_suite_count * 4 //akm_suites |
| 4037 | + 2; //reserved |
| 4038 | if( pIesLocal->RSN.pmkid_count ) |
| 4039 | { |
| 4040 | nIeLen += 2 + pIesLocal->RSN.pmkid_count * 4; //pmkid |
| 4041 | } |
| 4042 | //nIeLen doesn't count EID and length fields |
| 4043 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2)))) |
| 4044 | { |
| 4045 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_RSN; |
| 4046 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4047 | //copy upto akm_suites |
| 4048 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 4049 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.version, 8); |
| 4050 | pIeBuf += 8; |
| 4051 | if( pIesLocal->RSN.pwise_cipher_suite_count ) |
| 4052 | { |
| 4053 | //copy pwise_cipher_suites |
| 4054 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.pwise_cipher_suites, |
| 4055 | pIesLocal->RSN.pwise_cipher_suite_count * 4); |
| 4056 | pIeBuf += pIesLocal->RSN.pwise_cipher_suite_count * 4; |
| 4057 | } |
| 4058 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.akm_suite_count, 2); |
| 4059 | pIeBuf += 2; |
| 4060 | if( pIesLocal->RSN.akm_suite_count ) |
| 4061 | { |
| 4062 | //copy akm_suites |
| 4063 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites, |
| 4064 | pIesLocal->RSN.akm_suite_count * 4); |
| 4065 | pIeBuf += pIesLocal->RSN.akm_suite_count * 4; |
| 4066 | } |
| 4067 | //copy the rest |
| 4068 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites + |
| 4069 | pIesLocal->RSN.akm_suite_count * 4, |
| 4070 | 2 + pIesLocal->RSN.pmkid_count * 4); |
| 4071 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4072 | } |
| 4073 | } |
| 4074 | } |
| 4075 | else if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4076 | (eCSR_AUTH_TYPE_WPA_PSK == authType)) |
| 4077 | { |
| 4078 | if(pIesLocal->WPA.present) |
| 4079 | { |
| 4080 | //Calculate the actual length |
| 4081 | nIeLen = 12 //OUI + version + multicast_cipher + unicast_cipher_count |
| 4082 | + pIesLocal->WPA.unicast_cipher_count * 4 //unicast_ciphers |
| 4083 | + 2 //auth_suite_count |
| 4084 | + pIesLocal->WPA.auth_suite_count * 4; //auth_suites |
| 4085 | // The WPA capabilities follows the Auth Suite (two octects)-- |
| 4086 | // this field is optional, and we always "send" zero, so just |
| 4087 | // remove it. This is consistent with our assumptions in the |
| 4088 | // frames compiler; c.f. bug 15234: |
| 4089 | //nIeLen doesn't count EID and length fields |
| 4090 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2)))) |
| 4091 | { |
| 4092 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_WPA; |
| 4093 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4094 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 4095 | //Copy WPA OUI |
| 4096 | palCopyMemory(pMac->hHdd, pIeBuf, &csrWpaOui[1], 4); |
| 4097 | pIeBuf += 4; |
| 4098 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.version, 8 + |
| 4099 | pIesLocal->WPA.unicast_cipher_count * 4); |
| 4100 | pIeBuf += 8 + pIesLocal->WPA.unicast_cipher_count * 4; |
| 4101 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.auth_suite_count, 2 + |
| 4102 | pIesLocal->WPA.auth_suite_count * 4); |
| 4103 | pIeBuf += pIesLocal->WPA.auth_suite_count * 4; |
| 4104 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4105 | } |
| 4106 | } |
| 4107 | } |
| 4108 | #ifdef FEATURE_WLAN_WAPI |
| 4109 | else if((eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4110 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType)) |
| 4111 | { |
| 4112 | if(pIesLocal->WAPI.present) |
| 4113 | { |
| 4114 | //Calculate the actual length |
| 4115 | nIeLen = 4 //version + akm_suite_count |
| 4116 | + pIesLocal->WAPI.akm_suite_count * 4 // akm_suites |
| 4117 | + 2 //pwise_cipher_suite_count |
| 4118 | + pIesLocal->WAPI.unicast_cipher_suite_count * 4 //pwise_cipher_suites |
| 4119 | + 6; //gp_cipher_suite + preauth + reserved |
| 4120 | if( pIesLocal->WAPI.bkid_count ) |
| 4121 | { |
| 4122 | nIeLen += 2 + pIesLocal->WAPI.bkid_count * 4; //bkid |
| 4123 | } |
| 4124 | |
| 4125 | //nIeLen doesn't count EID and length fields |
| 4126 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiRspIE, nIeLen + 2)))) |
| 4127 | { |
| 4128 | pSession->pWapiRspIE[0] = DOT11F_EID_WAPI; |
| 4129 | pSession->pWapiRspIE[1] = (tANI_U8)nIeLen; |
| 4130 | pIeBuf = pSession->pWapiRspIE + 2; |
| 4131 | //copy upto akm_suite_count |
| 4132 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.version, 4); |
| 4133 | pIeBuf += 4; |
| 4134 | if( pIesLocal->WAPI.akm_suite_count ) |
| 4135 | { |
| 4136 | //copy akm_suites |
| 4137 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.akm_suites, |
| 4138 | pIesLocal->WAPI.akm_suite_count * 4); |
| 4139 | pIeBuf += pIesLocal->WAPI.akm_suite_count * 4; |
| 4140 | } |
| 4141 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.unicast_cipher_suite_count, 2); |
| 4142 | pIeBuf += 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4143 | if( pIesLocal->WAPI.unicast_cipher_suite_count ) |
| 4144 | { |
| 4145 | //copy pwise_cipher_suites |
| 4146 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.unicast_cipher_suites, |
| 4147 | pIesLocal->WAPI.unicast_cipher_suite_count * 4); |
| 4148 | pIeBuf += pIesLocal->WAPI.unicast_cipher_suite_count * 4; |
| 4149 | } |
| 4150 | //gp_cipher_suite + preauth + reserved + bkid_count |
| 4151 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.multicast_cipher_suite, 8); |
| 4152 | pIeBuf += 8; |
| 4153 | if( pIesLocal->WAPI.bkid_count ) |
| 4154 | { |
| 4155 | //copy akm_suites |
| 4156 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.bkid, pIesLocal->WAPI.bkid_count * 4); |
| 4157 | pIeBuf += pIesLocal->WAPI.bkid_count * 4; |
| 4158 | } |
| 4159 | pSession->nWapiRspIeLength = nIeLen + 2; |
| 4160 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4161 | } |
| 4162 | } |
| 4163 | #endif /* FEATURE_WLAN_WAPI */ |
| 4164 | if( !pIes ) |
| 4165 | { |
| 4166 | //locally allocated |
| 4167 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 4168 | } |
| 4169 | } |
| 4170 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4171 | return (status); |
| 4172 | } |
| 4173 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4174 | static void csrCheckAndUpdateACWeight( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIEs ) |
| 4175 | { |
| 4176 | v_U8_t bACWeights[WLANTL_MAX_AC]; |
| 4177 | v_U8_t paramBk, paramBe, paramVi, paramVo; |
| 4178 | v_BOOL_t fWeightChange = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4179 | //Compare two ACs' EDCA parameters, from low to high (BK, BE, VI, VO) |
| 4180 | //The "formula" is, if lower AC's AIFSN+CWMin is bigger than a fixed amount |
| 4181 | //of the higher AC one, make the higher AC has the same weight as the lower AC. |
| 4182 | //This doesn't address the case where the lower AC needs a real higher weight |
| 4183 | if( pIEs->WMMParams.present ) |
| 4184 | { |
| 4185 | //no change to the lowest ones |
| 4186 | bACWeights[WLANTL_AC_BK] = pMac->roam.ucACWeights[WLANTL_AC_BK]; |
| 4187 | bACWeights[WLANTL_AC_BE] = pMac->roam.ucACWeights[WLANTL_AC_BE]; |
| 4188 | bACWeights[WLANTL_AC_VI] = pMac->roam.ucACWeights[WLANTL_AC_VI]; |
| 4189 | bACWeights[WLANTL_AC_VO] = pMac->roam.ucACWeights[WLANTL_AC_VO]; |
| 4190 | paramBk = pIEs->WMMParams.acbk_aifsn + pIEs->WMMParams.acbk_acwmin; |
| 4191 | paramBe = pIEs->WMMParams.acbe_aifsn + pIEs->WMMParams.acbe_acwmin; |
| 4192 | paramVi = pIEs->WMMParams.acvi_aifsn + pIEs->WMMParams.acvi_acwmin; |
| 4193 | paramVo = pIEs->WMMParams.acvo_aifsn + pIEs->WMMParams.acvo_acwmin; |
| 4194 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramBe) ) |
| 4195 | { |
| 4196 | bACWeights[WLANTL_AC_BE] = bACWeights[WLANTL_AC_BK]; |
| 4197 | fWeightChange = VOS_TRUE; |
| 4198 | } |
| 4199 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVi) ) |
| 4200 | { |
| 4201 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BK]; |
| 4202 | fWeightChange = VOS_TRUE; |
| 4203 | } |
| 4204 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVi) ) |
| 4205 | { |
| 4206 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BE]; |
| 4207 | fWeightChange = VOS_TRUE; |
| 4208 | } |
| 4209 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVo) ) |
| 4210 | { |
| 4211 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BK]; |
| 4212 | fWeightChange = VOS_TRUE; |
| 4213 | } |
| 4214 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVo) ) |
| 4215 | { |
| 4216 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BE]; |
| 4217 | fWeightChange = VOS_TRUE; |
| 4218 | } |
| 4219 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramVi, paramVo) ) |
| 4220 | { |
| 4221 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_VI]; |
| 4222 | fWeightChange = VOS_TRUE; |
| 4223 | } |
| 4224 | if(fWeightChange) |
| 4225 | { |
| 4226 | smsLog(pMac, LOGE, FL(" change AC weights (%d-%d-%d-%d)\n"), bACWeights[0], bACWeights[1], |
| 4227 | bACWeights[2], bACWeights[3]); |
| 4228 | WLANTL_SetACWeights(pMac->roam.gVosContext, bACWeights); |
| 4229 | } |
| 4230 | } |
| 4231 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4232 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4233 | //Returns whether the current association is a 11r assoc or not |
| 4234 | tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac) |
| 4235 | { |
| 4236 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4237 | return csrNeighborRoamIs11rAssoc(pMac); |
| 4238 | #else |
| 4239 | return eANI_BOOLEAN_FALSE; |
| 4240 | #endif |
| 4241 | } |
| 4242 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4243 | #ifdef FEATURE_WLAN_CCX |
| 4244 | //Returns whether the current association is a CCX assoc or not |
| 4245 | tANI_BOOLEAN csrRoamIsCCXAssoc(tpAniSirGlobal pMac) |
| 4246 | { |
| 4247 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4248 | return csrNeighborRoamIsCCXAssoc(pMac); |
| 4249 | #else |
| 4250 | return eANI_BOOLEAN_FALSE; |
| 4251 | #endif |
| 4252 | } |
| 4253 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4254 | #ifdef FEATURE_WLAN_LFR |
| 4255 | //Returns whether "Legacy Fast Roaming" is currently enabled...or not |
| 4256 | tANI_BOOLEAN csrRoamIsFastRoamEnabled(tpAniSirGlobal pMac) |
| 4257 | { |
| 4258 | return pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
| 4259 | } |
| 4260 | #endif |
| 4261 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4262 | //Return true means the command can be release, else not |
| 4263 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 4264 | eCsrRoamCompleteResult Result, void *Context ) |
| 4265 | { |
| 4266 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
| 4267 | tSirBssDescription *pSirBssDesc = NULL; |
| 4268 | tSirMacAddr BroadcastMac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 4269 | tCsrScanResult *pScanResult = NULL; |
| 4270 | tCsrRoamInfo roamInfo; |
| 4271 | sme_QosAssocInfo assocInfo; |
| 4272 | sme_QosCsrEventIndType ind_qos;//indication for QoS module in SME |
| 4273 | tANI_U8 acm_mask = 0; //HDD needs the ACM mask in the assoc rsp callback |
| 4274 | tDot11fBeaconIEs *pIes = NULL; |
| 4275 | tANI_U32 sessionId = pCommand->sessionId; |
| 4276 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4277 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4278 | eRoamCmdStatus roamStatus; |
| 4279 | eCsrRoamResult roamResult; |
| 4280 | eHalStatus status; |
| 4281 | tANI_U32 key_timeout_interval = 0; |
| 4282 | #ifdef WLAN_SOFTAP_FEATURE |
| 4283 | tSirSmeStartBssRsp *pSmeStartBssRsp = NULL; |
| 4284 | #endif |
| 4285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4286 | smsLog( pMac, LOG1, FL("Processing ROAM results...\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4287 | switch( Result ) |
| 4288 | { |
| 4289 | case eCsrJoinSuccess: |
| 4290 | // reset the IDLE timer |
| 4291 | // !! |
| 4292 | // !! fall through to the next CASE statement here is intentional !! |
| 4293 | // !! |
| 4294 | case eCsrReassocSuccess: |
| 4295 | if(eCsrReassocSuccess == Result) |
| 4296 | { |
| 4297 | ind_qos = SME_QOS_CSR_REASSOC_COMPLETE; |
| 4298 | } |
| 4299 | else |
| 4300 | { |
| 4301 | ind_qos = SME_QOS_CSR_ASSOC_COMPLETE; |
| 4302 | } |
| 4303 | // Success Join Response from LIM. Tell NDIS we are connected and save the |
| 4304 | // Connected state... |
| 4305 | smsLog(pMac, LOGW, FL("receives association indication\n")); |
| 4306 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 4307 | //always free the memory here |
| 4308 | if(pSession->pWpaRsnRspIE) |
| 4309 | { |
| 4310 | pSession->nWpaRsnRspIeLength = 0; |
| 4311 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE); |
| 4312 | pSession->pWpaRsnRspIE = NULL; |
| 4313 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4314 | #ifdef FEATURE_WLAN_WAPI |
| 4315 | if(pSession->pWapiRspIE) |
| 4316 | { |
| 4317 | pSession->nWapiRspIeLength = 0; |
| 4318 | palFreeMemory(pMac->hHdd, pSession->pWapiRspIE); |
| 4319 | pSession->pWapiRspIE = NULL; |
| 4320 | } |
| 4321 | #endif /* FEATURE_WLAN_WAPI */ |
| 4322 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 4323 | //Reset counter so no join retry is needed. |
| 4324 | pSession->maxRetryCount = 0; |
| 4325 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 4326 | #endif |
| 4327 | /* This creates problem since we have not saved the connected profile. |
| 4328 | So moving this after saving the profile |
| 4329 | */ |
| 4330 | //csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED ); |
| 4331 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 4332 | { |
| 4333 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
| 4334 | } |
| 4335 | else |
| 4336 | { |
| 4337 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED; |
| 4338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4339 | //Use the last connected bssdesc for reassoc-ing to the same AP. |
| 4340 | //NOTE: What to do when reassoc to a different AP??? |
| 4341 | if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) || |
| 4342 | (eCsrSmeIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ) |
| 4343 | { |
| 4344 | pSirBssDesc = pSession->pConnectBssDesc; |
| 4345 | if(pSirBssDesc) |
| 4346 | { |
| 4347 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 4348 | } |
| 4349 | } |
| 4350 | else |
| 4351 | { |
| 4352 | |
| 4353 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 4354 | { |
| 4355 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4356 | if(pScanResult != NULL) |
| 4357 | { |
| 4358 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 4359 | //this can be NULL |
| 4360 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 4361 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 4362 | } |
| 4363 | } |
| 4364 | } |
| 4365 | if( pSirBssDesc ) |
| 4366 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4367 | roamInfo.staId = HAL_STA_INVALID_IDX; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4368 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 4369 | //Save WPA/RSN IE |
| 4370 | csrRoamSaveSecurityRspIE(pMac, sessionId, pProfile->negotiatedAuthType, pSirBssDesc, pIes); |
| 4371 | #ifdef FEATURE_WLAN_CCX |
| 4372 | roamInfo.isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
| 4373 | #endif |
| 4374 | |
| 4375 | // csrRoamStateChange also affects sub-state. Hence, csrRoamStateChange happens first and then |
| 4376 | // substate change. |
| 4377 | // Moving even save profile above so that below mentioned conditon is also met. |
| 4378 | // JEZ100225: Moved to after saving the profile. Fix needed in main/latest |
| 4379 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4380 | // Make sure the Set Context is issued before link indication to NDIS. After link indication is |
| 4381 | // made to NDIS, frames could start flowing. If we have not set context with LIM, the frames |
| 4382 | // will be dropped for the security context may not be set properly. |
| 4383 | // |
| 4384 | // this was causing issues in the 2c_wlan_wep WHQL test when the SetContext was issued after the link |
| 4385 | // indication. (Link Indication happens in the profFSMSetConnectedInfra call). |
| 4386 | // |
| 4387 | // this reordering was done on titan_prod_usb branch and is being replicated here. |
| 4388 | // |
| 4389 | |
| 4390 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && |
| 4391 | !pProfile->bWPSAssociation) |
| 4392 | { |
| 4393 | // Issue the set Context request to LIM to establish the Unicast STA context |
| 4394 | if( !HAL_STATUS_SUCCESS( csrRoamIssueSetContextReq( pMac, sessionId, |
| 4395 | pProfile->negotiatedUCEncryptionType, |
| 4396 | pSirBssDesc, &(pSirBssDesc->bssId), |
| 4397 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ) ) ) // NO keys... these key parameters don't matter. |
| 4398 | { |
| 4399 | smsLog( pMac, LOGE, FL(" Set context for unicast fail\n") ); |
| 4400 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 4401 | } |
| 4402 | // Issue the set Context request to LIM to establish the Broadcast STA context |
| 4403 | csrRoamIssueSetContextReq( pMac, sessionId, pProfile->negotiatedMCEncryptionType, |
| 4404 | pSirBssDesc, &BroadcastMac, |
| 4405 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 4406 | } |
| 4407 | else |
| 4408 | { |
| 4409 | //Need to wait for supplicant authtication |
| 4410 | roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4411 | //Set the subestate to WaitForKey in case authentiation is needed |
| 4412 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId ); |
| 4413 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4414 | if(pProfile->bWPSAssociation) |
| 4415 | { |
| 4416 | key_timeout_interval = CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD; |
| 4417 | } |
| 4418 | else |
| 4419 | { |
| 4420 | key_timeout_interval = CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD; |
| 4421 | } |
| 4422 | |
| 4423 | //Save sessionId in case of timeout |
| 4424 | pMac->roam.WaitForKeyTimerInfo.sessionId = (tANI_U8)sessionId; |
| 4425 | //This time should be long enough for the rest of the process plus setting key |
| 4426 | if(!HAL_STATUS_SUCCESS( csrRoamStartWaitForKeyTimer( pMac, key_timeout_interval ) ) ) |
| 4427 | { |
| 4428 | //Reset our state so nothting is blocked. |
| 4429 | smsLog( pMac, LOGE, FL(" Failed to start pre-auth timer\n") ); |
| 4430 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 4431 | } |
| 4432 | } |
| 4433 | |
| 4434 | assocInfo.pBssDesc = pSirBssDesc; //could be NULL |
| 4435 | assocInfo.pProfile = pProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4436 | if(Context) |
| 4437 | { |
| 4438 | tSirSmeJoinRsp *pJoinRsp = (tSirSmeJoinRsp *)Context; |
| 4439 | tANI_U32 len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4440 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 4441 | len = pJoinRsp->assocReqLength + pJoinRsp->assocRspLength + pJoinRsp->beaconLength; |
| 4442 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4443 | len += pJoinRsp->parsedRicRspLen; |
| 4444 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4445 | #ifdef FEATURE_WLAN_CCX |
| 4446 | len += pJoinRsp->tspecIeLen; |
| 4447 | #endif |
| 4448 | if(len) |
| 4449 | { |
| 4450 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 4451 | (void **)&pSession->connectedInfo.pbFrames, len))) |
| 4452 | { |
| 4453 | if(HAL_STATUS_SUCCESS( palCopyMemory(pMac->hHdd, |
| 4454 | pSession->connectedInfo.pbFrames, pJoinRsp->frames, len) )) |
| 4455 | { |
| 4456 | pSession->connectedInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 4457 | pSession->connectedInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 4458 | pSession->connectedInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 4459 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4460 | pSession->connectedInfo.nRICRspLength = pJoinRsp->parsedRicRspLen; |
| 4461 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4462 | #ifdef FEATURE_WLAN_CCX |
| 4463 | pSession->connectedInfo.nTspecIeLength = pJoinRsp->tspecIeLen; |
| 4464 | #endif |
| 4465 | roamInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 4466 | roamInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 4467 | roamInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 4468 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 4469 | } |
| 4470 | else |
| 4471 | { |
| 4472 | smsLog(pMac, LOGE, "%s: Copying of memory failed for %d bytes !!!\n", |
| 4473 | __FUNCTION__, len); |
| 4474 | palFreeMemory( pMac->hHdd, pSession->connectedInfo.pbFrames ); |
| 4475 | pSession->connectedInfo.pbFrames = NULL; |
| 4476 | } |
| 4477 | } |
| 4478 | } |
| 4479 | if(pCommand->u.roamCmd.fReassoc) |
| 4480 | { |
| 4481 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 4482 | } |
| 4483 | pSession->connectedInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 4484 | roamInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 4485 | roamInfo.ucastSig = ( tANI_U8 )pJoinRsp->ucastSig; |
| 4486 | roamInfo.bcastSig = ( tANI_U8 )pJoinRsp->bcastSig; |
| 4487 | } |
| 4488 | else |
| 4489 | { |
| 4490 | if(pCommand->u.roamCmd.fReassoc) |
| 4491 | { |
| 4492 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 4493 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 4494 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 4495 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 4496 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 4497 | } |
| 4498 | } |
| 4499 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4500 | // Indicate SME-QOS with reassoc success event, only after |
| 4501 | // copying the frames |
| 4502 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, ind_qos, &assocInfo); |
| 4503 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4504 | roamInfo.pBssDesc = pSirBssDesc; |
| 4505 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4506 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4507 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4508 | acm_mask = sme_QosGetACMMask(pMac, pSirBssDesc, NULL); |
| 4509 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 4510 | pSession->connectedProfile.acm_mask = acm_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4511 | #ifdef FEATURE_WLAN_UAPSD_FW_TRG_FRAMES |
| 4512 | //start UAPSD if uapsd_mask is not 0 because HDD will configure for trigger frame |
| 4513 | //It may be better to let QoS do this???? |
| 4514 | if( pSession->connectedProfile.modifyProfileFields.uapsd_mask ) |
| 4515 | { |
| 4516 | smsLog(pMac, LOGE, " uapsd_mask (0x%X) set, request UAPSD now\n", |
| 4517 | pSession->connectedProfile.modifyProfileFields.uapsd_mask); |
| 4518 | pmcStartUapsd( pMac, NULL, NULL ); |
| 4519 | } |
| 4520 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4521 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 4522 | if( pSession->bRefAssocStartCnt > 0 ) |
| 4523 | { |
| 4524 | pSession->bRefAssocStartCnt--; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 4525 | #ifndef BMPS_WORKAROUND_NOT_NEEDED |
| 4526 | if( csrIsConcurrentSessionRunning( pMac ) ) |
| 4527 | { |
| 4528 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 4529 | } |
| 4530 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4531 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 4532 | } |
| 4533 | |
| 4534 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_NONE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4535 | // reset the PMKID candidate list |
| 4536 | csrResetPMKIDCandidateList( pMac, sessionId ); |
| 4537 | //Update TL's AC weight base on the current EDCA parameters |
| 4538 | //These parameters may change in the course of the connection, that sictuation |
| 4539 | //is not taken care here. This change is mainly to address a WIFI WMM test where |
| 4540 | //BE has a equal or higher TX priority than VI. |
| 4541 | //We only do this for infra link |
| 4542 | if( csrIsConnStateConnectedInfra(pMac, sessionId ) && pIes ) |
| 4543 | { |
| 4544 | csrCheckAndUpdateACWeight(pMac, pIes); |
| 4545 | } |
| 4546 | #ifdef FEATURE_WLAN_WAPI |
| 4547 | // reset the BKID candidate list |
| 4548 | csrResetBKIDCandidateList( pMac, sessionId ); |
| 4549 | #endif /* FEATURE_WLAN_WAPI */ |
| 4550 | } |
| 4551 | else |
| 4552 | { |
| 4553 | smsLog(pMac, LOGW, " Roam command doesn't have a BSS desc\n"); |
| 4554 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4555 | csrScanCancelIdleScan(pMac); |
| 4556 | //Not to signal link up because keys are yet to be set. |
| 4557 | //The linkup function will overwrite the sub-state that we need to keep at this point. |
| 4558 | if( !CSR_IS_WAIT_FOR_KEY(pMac, sessionId) ) |
| 4559 | { |
| 4560 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 4561 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4562 | //Check if BMPS is required and start the BMPS retry timer. Timer period is large |
| 4563 | //enough to let security and DHCP handshake succeed before entry into BMPS |
| 4564 | if (pmcShouldBmpsTimerRun(pMac)) |
| 4565 | { |
| 4566 | if (pmcStartTrafficTimer(pMac, BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP) |
| 4567 | != eHAL_STATUS_SUCCESS) |
| 4568 | { |
| 4569 | smsLog(pMac, LOGP, FL("Cannot start BMPS Retry timer")); |
| 4570 | } |
| 4571 | smsLog(pMac, LOG2, FL("BMPS Retry Timer already running or started")); |
| 4572 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4573 | break; |
| 4574 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4575 | case eCsrStartBssSuccess: |
| 4576 | // on the StartBss Response, LIM is returning the Bss Description that we |
| 4577 | // are beaconing. Add this Bss Description to our scan results and |
| 4578 | // chain the Profile to this Bss Description. On a Start BSS, there was no |
| 4579 | // detected Bss description (no partner) so we issued the Start Bss to |
| 4580 | // start the Ibss without any Bss description. Lim was kind enough to return |
| 4581 | // the Bss Description that we start beaconing for the newly started Ibss. |
| 4582 | smsLog(pMac, LOG2, FL("receives start BSS ok indication\n")); |
| 4583 | status = eHAL_STATUS_FAILURE; |
| 4584 | #ifdef WLAN_SOFTAP_FEATURE |
| 4585 | pSmeStartBssRsp = (tSirSmeStartBssRsp *)Context; |
| 4586 | #endif |
| 4587 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 4588 | if( CSR_IS_IBSS( pProfile ) ) |
| 4589 | { |
| 4590 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 4591 | } |
| 4592 | #ifdef WLAN_SOFTAP_FEATURE |
| 4593 | else if (CSR_IS_INFRA_AP(pProfile)) |
| 4594 | { |
| 4595 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 4596 | } |
| 4597 | #endif |
| 4598 | else |
| 4599 | { |
| 4600 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 4601 | } |
| 4602 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 4603 | { |
| 4604 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
| 4605 | #ifdef WLAN_SOFTAP_FEATURE |
| 4606 | pSirBssDesc = &pSmeStartBssRsp->bssDescription; |
| 4607 | #else |
| 4608 | pSirBssDesc = (tSirBssDescription *)Context; |
| 4609 | #endif |
| 4610 | if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs( pMac, pSirBssDesc, &pIes )) ) |
| 4611 | { |
| 4612 | smsLog(pMac, LOG2, FL("cannot parse IBSS IEs\n")); |
| 4613 | roamInfo.pBssDesc = pSirBssDesc; |
| 4614 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 4615 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4616 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_START_FAILED ); |
| 4617 | break; |
| 4618 | } |
| 4619 | #ifdef WLAN_SOFTAP_FEATURE |
| 4620 | if (!CSR_IS_INFRA_AP(pProfile)) |
| 4621 | #endif |
| 4622 | { |
| 4623 | pScanResult = csrScanAppendBssDescription( pMac, pSirBssDesc, pIes ); |
| 4624 | } |
| 4625 | csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
| 4626 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 4627 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 4628 | if(pSirBssDesc) |
| 4629 | { |
| 4630 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 4631 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 4632 | } |
| 4633 | //We are doen with the IEs so free it |
| 4634 | palFreeMemory(pMac->hHdd, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4635 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 4636 | { |
| 4637 | vos_log_ibss_pkt_type *pIbssLog; |
| 4638 | tANI_U32 bi; |
| 4639 | |
| 4640 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 4641 | if(pIbssLog) |
| 4642 | { |
| 4643 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 4644 | { |
| 4645 | //We start the IBSS (didn't find any matched IBSS out there) |
| 4646 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_RSP; |
| 4647 | } |
| 4648 | else |
| 4649 | { |
| 4650 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_RSP; |
| 4651 | } |
| 4652 | if(pSirBssDesc) |
| 4653 | { |
| 4654 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pSirBssDesc->bssId, 6); |
| 4655 | pIbssLog->operatingChannel = pSirBssDesc->channelId; |
| 4656 | } |
| 4657 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 4658 | { |
| 4659 | //***U8 is not enough for beacon interval |
| 4660 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 4661 | } |
| 4662 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 4663 | } |
| 4664 | } |
| 4665 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 4666 | //Only set context for non-WDS_STA. We don't even need it for WDS_AP. But since the encryption |
| 4667 | //is WPA2-PSK so it won't matter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4668 | #ifdef WLAN_SOFTAP_FEATURE |
| 4669 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && !CSR_IS_INFRA_AP( pSession->pCurRoamProfile )) |
| 4670 | { |
| 4671 | #else |
| 4672 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType )) |
| 4673 | { |
| 4674 | #endif |
| 4675 | // Issue the set Context request to LIM to establish the Broadcast STA context for the Ibss. |
| 4676 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 4677 | pProfile->negotiatedMCEncryptionType, |
| 4678 | pSirBssDesc, &BroadcastMac, |
| 4679 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 4680 | } |
| 4681 | } |
| 4682 | else |
| 4683 | { |
| 4684 | //Keep the state to eCSR_ROAMING_STATE_JOINING |
| 4685 | //Need to send join_req. |
| 4686 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 4687 | { |
| 4688 | if((pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link))) |
| 4689 | { |
| 4690 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 4691 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 4692 | // Set the roaming substate to 'join attempt'... |
| 4693 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
| 4694 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes ); |
| 4695 | } |
| 4696 | } |
| 4697 | else |
| 4698 | { |
| 4699 | smsLog( pMac, LOGE, " StartBSS for WDS station with no BssDesc\n" ); |
| 4700 | VOS_ASSERT( 0 ); |
| 4701 | } |
| 4702 | } |
| 4703 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 4704 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 4705 | //trigger the connection start indication in Vista |
| 4706 | if( !CSR_IS_JOIN_TO_IBSS( pProfile ) ) |
| 4707 | { |
| 4708 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 4709 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 4710 | if( CSR_IS_WDS( pProfile ) ) |
| 4711 | { |
| 4712 | roamStatus = eCSR_ROAM_WDS_IND; |
| 4713 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 4714 | } |
| 4715 | #ifdef WLAN_SOFTAP_FEATURE |
| 4716 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 4717 | { |
| 4718 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 4719 | roamResult = eCSR_ROAM_RESULT_INFRA_STARTED; |
| 4720 | } |
| 4721 | #endif |
| 4722 | |
| 4723 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 4724 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 4725 | //trigger the connection start indication in Vista |
| 4726 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 4727 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4728 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4729 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 4730 | { |
| 4731 | //We start the IBSS (didn't find any matched IBSS out there) |
| 4732 | roamInfo.pBssDesc = pSirBssDesc; |
| 4733 | } |
| 4734 | #ifdef WLAN_SOFTAP_FEATURE |
| 4735 | roamInfo.staId = (tANI_U8)pSmeStartBssRsp->staId; |
| 4736 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 4737 | #ifndef BMPS_WORKAROUND_NOT_NEEDED |
| 4738 | if( csrIsConcurrentSessionRunning( pMac ) ) |
| 4739 | { |
| 4740 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 4741 | } |
| 4742 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4743 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 4744 | } |
| 4745 | |
| 4746 | csrScanCancelIdleScan(pMac); |
| 4747 | //Only use this timer for ibss. BAP has its own timer for WDS |
| 4748 | if( CSR_IS_IBSS( pProfile) && CSR_INVALID_SCANRESULT_HANDLE != pCommand->u.roamCmd.hBSSList) |
| 4749 | { |
| 4750 | //start the join IBSS timer |
| 4751 | csrRoamStartIbssJoinTimer(pMac, sessionId, CSR_IBSS_JOIN_TIMEOUT_PERIOD); //interval |
| 4752 | pSession->ibss_join_pending = TRUE; |
| 4753 | } |
| 4754 | if( HAL_STATUS_SUCCESS( status ) ) |
| 4755 | { |
| 4756 | //Already sent join_req for the WDS station |
| 4757 | fReleaseCommand = eANI_BOOLEAN_FALSE; |
| 4758 | } |
| 4759 | else if( CSR_IS_WDS_STA( pProfile ) ) |
| 4760 | { |
| 4761 | //need to send stop BSS because we fail to send join_req |
| 4762 | csrRoamIssueDisassociateCmd( pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 4763 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4764 | eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_STOPPED ); |
| 4765 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4766 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4767 | case eCsrStartBssFailure: |
| 4768 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 4769 | { |
| 4770 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4771 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 4772 | if(pIbssLog) |
| 4773 | { |
| 4774 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 4775 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 4776 | } |
| 4777 | } |
| 4778 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4779 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 4780 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 4781 | if( CSR_IS_WDS( pProfile ) ) |
| 4782 | { |
| 4783 | roamStatus = eCSR_ROAM_WDS_IND; |
| 4784 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 4785 | } |
| 4786 | #ifdef WLAN_SOFTAP_FEATURE |
| 4787 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 4788 | { |
| 4789 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 4790 | roamResult = eCSR_ROAM_RESULT_INFRA_START_FAILED; |
| 4791 | } |
| 4792 | #endif |
| 4793 | if(Context) |
| 4794 | { |
| 4795 | pSirBssDesc = (tSirBssDescription *)Context; |
| 4796 | } |
| 4797 | else |
| 4798 | { |
| 4799 | pSirBssDesc = NULL; |
| 4800 | } |
| 4801 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 4802 | roamInfo.pBssDesc = pSirBssDesc; |
| 4803 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 4804 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 4805 | csrSetDefaultDot11Mode( pMac ); |
| 4806 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4807 | case eCsrSilentlyStopRoaming: |
| 4808 | // We are here because we try to start the same IBSS |
| 4809 | //No message to PE |
| 4810 | // return the roaming state to Joined. |
| 4811 | smsLog(pMac, LOGW, FL("receives silently roaming indication\n")); |
| 4812 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
| 4813 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 4814 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 4815 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 4816 | if( roamInfo.pBssDesc ) |
| 4817 | { |
| 4818 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid)); |
| 4819 | } |
| 4820 | //Since there is no change in the current state, simply pass back no result otherwise |
| 4821 | //HDD may be mistakenly mark to disconnected state. |
| 4822 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4823 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4824 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4825 | case eCsrSilentlyStopRoamingSaveState: |
| 4826 | //We are here because we try to connect to the same AP |
| 4827 | //No message to PE |
| 4828 | smsLog(pMac, LOGW, FL("receives silently stop roaming indication\n")); |
| 4829 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 4830 | |
| 4831 | //to aviod resetting the substate to NONE |
| 4832 | pMac->roam.curState[sessionId] = eCSR_ROAMING_STATE_JOINED; |
| 4833 | //No need to change substate to wai_for_key because there is no state change |
| 4834 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 4835 | if( roamInfo.pBssDesc ) |
| 4836 | { |
| 4837 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid)); |
| 4838 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4839 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4840 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4841 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 4842 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 4843 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 4844 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 4845 | roamInfo.staId = pSession->connectedInfo.staId; |
| 4846 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 4847 | #if defined(VOSS_ENABLED) |
| 4848 | VOS_ASSERT( roamInfo.staId != 0 ); |
| 4849 | #endif |
| 4850 | pSession->bRefAssocStartCnt--; |
| 4851 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4852 | eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 4853 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_ASSOCIATED, eANI_BOOLEAN_TRUE); |
| 4854 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4855 | case eCsrReassocFailure: |
| 4856 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4857 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_REASSOC_FAILURE, NULL); |
| 4858 | #endif |
| 4859 | case eCsrJoinWdsFailure: |
| 4860 | smsLog(pMac, LOGW, FL("failed to join WDS\n")); |
| 4861 | csrFreeConnectBssDesc(pMac, sessionId); |
| 4862 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 4863 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 4864 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 4865 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 4866 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4867 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4868 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4869 | eCSR_ROAM_WDS_IND, |
| 4870 | eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED); |
| 4871 | //Need to issue stop_bss |
| 4872 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4873 | case eCsrJoinFailure: |
| 4874 | case eCsrNothingToJoin: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 4875 | case eCsrJoinFailureDueToConcurrency: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4876 | default: |
| 4877 | { |
| 4878 | smsLog(pMac, LOGW, FL("receives no association indication\n")); |
| 4879 | if( CSR_IS_INFRASTRUCTURE( &pSession->connectedProfile ) || |
| 4880 | CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, sessionId ) ) |
| 4881 | { |
| 4882 | //do not free for the other profiles as we need to send down stop BSS later |
| 4883 | csrFreeConnectBssDesc(pMac, sessionId); |
| 4884 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 4885 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 4886 | csrSetDefaultDot11Mode( pMac ); |
| 4887 | } |
| 4888 | |
| 4889 | switch( pCommand->u.roamCmd.roamReason ) |
| 4890 | { |
| 4891 | // If this transition is because of an 802.11 OID, then we transition |
| 4892 | // back to INIT state so we sit waiting for more OIDs to be issued and |
| 4893 | // we don't start the IDLE timer. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 4894 | case eCsrSmeIssuedFTReassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4895 | case eCsrSmeIssuedAssocToSimilarAP: |
| 4896 | case eCsrHddIssued: |
| 4897 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 4898 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 4899 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 4900 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4901 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4902 | /* Defeaturize this later if needed */ |
| 4903 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4904 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 4905 | if (csrRoamIsHandoffInProgress(pMac)) |
| 4906 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4907 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 4908 | csrNeighborRoamIndicateConnect(pMac, (tANI_U8)sessionId, VOS_STATUS_E_FAILURE); |
| 4909 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4910 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4911 | if(pSession->bRefAssocStartCnt > 0) |
| 4912 | { |
| 4913 | pSession->bRefAssocStartCnt--; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 4914 | if(eCsrJoinFailureDueToConcurrency == Result) |
| 4915 | { |
| 4916 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4917 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 4918 | eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL); |
| 4919 | } |
| 4920 | else |
| 4921 | { |
| 4922 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4923 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 4924 | eCSR_ROAM_RESULT_FAILURE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 4925 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4926 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4927 | smsLog(pMac, LOG1, FL(" roam(reason %d) failed\n"), pCommand->u.roamCmd.roamReason); |
| 4928 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4929 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 4930 | #endif |
| 4931 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 4932 | csrScanStartIdleScan(pMac); |
| 4933 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 4934 | //For WDS STA. To fix the issue where the WDS AP side may be too busy by |
| 4935 | //BT activity and not able to recevie WLAN traffic. Retry the join |
| 4936 | if( CSR_IS_WDS_STA(pProfile) ) |
| 4937 | { |
| 4938 | csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD); |
| 4939 | } |
| 4940 | #endif |
| 4941 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4942 | case eCsrHddIssuedReassocToSameAP: |
| 4943 | case eCsrSmeIssuedReassocToSameAP: |
| 4944 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 4945 | |
| 4946 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 4947 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4948 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 4949 | #endif |
| 4950 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 4951 | csrScanStartIdleScan(pMac); |
| 4952 | break; |
| 4953 | case eCsrForcedDisassoc: |
| 4954 | case eCsrForcedDeauth: |
| 4955 | case eCsrSmeIssuedIbssJoinFailure: |
| 4956 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 4957 | |
| 4958 | if(eCsrSmeIssuedIbssJoinFailure == pCommand->u.roamCmd.roamReason) |
| 4959 | { |
| 4960 | // Notify HDD that IBSS join failed |
| 4961 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 4962 | } |
| 4963 | else |
| 4964 | { |
| 4965 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 4966 | pCommand->u.roamCmd.roamId, |
| 4967 | eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 4968 | } |
| 4969 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4970 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 4971 | #endif |
| 4972 | csrRoamLinkDown(pMac, sessionId); |
| 4973 | csrScanStartIdleScan(pMac); |
| 4974 | break; |
| 4975 | case eCsrForcedIbssLeave: |
| 4976 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 4977 | pCommand->u.roamCmd.roamId, |
| 4978 | eCSR_ROAM_IBSS_LEAVE, |
| 4979 | eCSR_ROAM_RESULT_IBSS_STOP); |
| 4980 | break; |
| 4981 | case eCsrForcedDisassocMICFailure: |
| 4982 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 4983 | |
| 4984 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_MIC_FAILURE); |
| 4985 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4986 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 4987 | #endif |
| 4988 | csrScanStartIdleScan(pMac); |
| 4989 | break; |
| 4990 | #ifdef WLAN_SOFTAP_FEATURE |
| 4991 | case eCsrStopBss: |
| 4992 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 4993 | pCommand->u.roamCmd.roamId, |
| 4994 | eCSR_ROAM_INFRA_IND, |
| 4995 | eCSR_ROAM_RESULT_INFRA_STOPPED); |
| 4996 | break; |
| 4997 | case eCsrForcedDisassocSta: |
| 4998 | case eCsrForcedDeauthSta: |
| 4999 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId); |
| 5000 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 5001 | { |
| 5002 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5003 | if (!pSession) |
| 5004 | break; |
| 5005 | |
| 5006 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 5007 | { |
| 5008 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5009 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, |
| 5010 | pCommand->u.roamCmd.peerMac, sizeof(tSirMacAddr)); |
| 5011 | roamInfo.reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 5012 | roamInfo.statusCode = eSIR_SME_SUCCESS; |
| 5013 | status = csrRoamCallCallback(pMac, sessionId, |
| 5014 | &roamInfo, pCommand->u.roamCmd.roamId, |
| 5015 | eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 5016 | } |
| 5017 | } |
| 5018 | break; |
| 5019 | #endif |
| 5020 | case eCsrLostLink1: |
| 5021 | // if lost link roam1 failed, then issue lost link Scan2 ... |
| 5022 | csrScanRequestLostLink2(pMac, sessionId); |
| 5023 | break; |
| 5024 | case eCsrLostLink2: |
| 5025 | // if lost link roam2 failed, then issue lost link scan3 ... |
| 5026 | csrScanRequestLostLink3(pMac, sessionId); |
| 5027 | break; |
| 5028 | case eCsrLostLink3: |
| 5029 | default: |
| 5030 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5031 | |
| 5032 | //We are done with one round of lostlink roaming here |
| 5033 | csrScanHandleFailedLostlink3(pMac, sessionId); |
| 5034 | break; |
| 5035 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5036 | break; |
| 5037 | } |
| 5038 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5039 | return ( fReleaseCommand ); |
| 5040 | } |
| 5041 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5042 | eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext) |
| 5043 | { |
| 5044 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5045 | return (status); |
| 5046 | } |
| 5047 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5048 | eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile) |
| 5049 | { |
| 5050 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5051 | tANI_U32 size = 0; |
| 5052 | |
| 5053 | do |
| 5054 | { |
| 5055 | palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile)); |
| 5056 | if(pSrcProfile->BSSIDs.numOfBSSIDs) |
| 5057 | { |
| 5058 | size = sizeof(tCsrBssid) * pSrcProfile->BSSIDs.numOfBSSIDs; |
| 5059 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, size); |
| 5060 | if(!HAL_STATUS_SUCCESS(status)) |
| 5061 | { |
| 5062 | break; |
| 5063 | } |
| 5064 | pDstProfile->BSSIDs.numOfBSSIDs = pSrcProfile->BSSIDs.numOfBSSIDs; |
| 5065 | palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->BSSIDs.bssid, size); |
| 5066 | } |
| 5067 | if(pSrcProfile->SSIDs.numOfSSIDs) |
| 5068 | { |
| 5069 | size = sizeof(tCsrSSIDInfo) * pSrcProfile->SSIDs.numOfSSIDs; |
| 5070 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, size); |
| 5071 | if(!HAL_STATUS_SUCCESS(status)) |
| 5072 | { |
| 5073 | break; |
| 5074 | } |
| 5075 | pDstProfile->SSIDs.numOfSSIDs = pSrcProfile->SSIDs.numOfSSIDs; |
| 5076 | palCopyMemory(pMac->hHdd, pDstProfile->SSIDs.SSIDList, pSrcProfile->SSIDs.SSIDList, size); |
| 5077 | } |
| 5078 | if(pSrcProfile->nWPAReqIELength) |
| 5079 | { |
| 5080 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength); |
| 5081 | if(!HAL_STATUS_SUCCESS(status)) |
| 5082 | { |
| 5083 | break; |
| 5084 | } |
| 5085 | pDstProfile->nWPAReqIELength = pSrcProfile->nWPAReqIELength; |
| 5086 | palCopyMemory(pMac->hHdd, pDstProfile->pWPAReqIE, pSrcProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength); |
| 5087 | } |
| 5088 | if(pSrcProfile->nRSNReqIELength) |
| 5089 | { |
| 5090 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength); |
| 5091 | if(!HAL_STATUS_SUCCESS(status)) |
| 5092 | { |
| 5093 | break; |
| 5094 | } |
| 5095 | pDstProfile->nRSNReqIELength = pSrcProfile->nRSNReqIELength; |
| 5096 | palCopyMemory(pMac->hHdd, pDstProfile->pRSNReqIE, pSrcProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength); |
| 5097 | } |
| 5098 | #ifdef FEATURE_WLAN_WAPI |
| 5099 | if(pSrcProfile->nWAPIReqIELength) |
| 5100 | { |
| 5101 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength); |
| 5102 | if(!HAL_STATUS_SUCCESS(status)) |
| 5103 | { |
| 5104 | break; |
| 5105 | } |
| 5106 | pDstProfile->nWAPIReqIELength = pSrcProfile->nWAPIReqIELength; |
| 5107 | palCopyMemory(pMac->hHdd, pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength); |
| 5108 | } |
| 5109 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5110 | if(pSrcProfile->nAddIEScanLength) |
| 5111 | { |
| 5112 | status = palAllocateMemory(pMac->hHdd, |
| 5113 | (void **)&pDstProfile->pAddIEScan, pSrcProfile->nAddIEScanLength); |
| 5114 | if(!HAL_STATUS_SUCCESS(status)) |
| 5115 | { |
| 5116 | break; |
| 5117 | } |
| 5118 | pDstProfile->nAddIEScanLength = pSrcProfile->nAddIEScanLength; |
| 5119 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEScan, pSrcProfile->pAddIEScan, |
| 5120 | pSrcProfile->nAddIEScanLength); |
| 5121 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5122 | if(pSrcProfile->nAddIEAssocLength) |
| 5123 | { |
| 5124 | status = palAllocateMemory(pMac->hHdd, |
| 5125 | (void **)&pDstProfile->pAddIEAssoc, pSrcProfile->nAddIEAssocLength); |
| 5126 | if(!HAL_STATUS_SUCCESS(status)) |
| 5127 | { |
| 5128 | break; |
| 5129 | } |
| 5130 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
| 5131 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 5132 | pSrcProfile->nAddIEAssocLength); |
| 5133 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5134 | if(pSrcProfile->ChannelInfo.ChannelList) |
| 5135 | { |
| 5136 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); |
| 5137 | if(!HAL_STATUS_SUCCESS(status)) |
| 5138 | { |
| 5139 | break; |
| 5140 | } |
| 5141 | pDstProfile->ChannelInfo.numOfChannels = pSrcProfile->ChannelInfo.numOfChannels; |
| 5142 | palCopyMemory(pMac->hHdd, pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); |
| 5143 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5144 | pDstProfile->AuthType = pSrcProfile->AuthType; |
| 5145 | pDstProfile->EncryptionType = pSrcProfile->EncryptionType; |
| 5146 | pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType; |
| 5147 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->negotiatedUCEncryptionType; |
| 5148 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->negotiatedMCEncryptionType; |
| 5149 | pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType; |
| 5150 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 5151 | pDstProfile->phyMode = pSrcProfile->phyMode; |
| 5152 | pDstProfile->csrPersona = pSrcProfile->csrPersona; |
| 5153 | |
| 5154 | #ifdef FEATURE_WLAN_WAPI |
| 5155 | if(csrIsProfileWapi(pSrcProfile)) |
| 5156 | { |
| 5157 | if(pDstProfile->phyMode & eCSR_DOT11_MODE_11n) |
| 5158 | { |
| 5159 | pDstProfile->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 5160 | } |
| 5161 | } |
| 5162 | #endif /* FEATURE_WLAN_WAPI */ |
| 5163 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 5164 | /*Save the WPS info*/ |
| 5165 | pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation; |
| 5166 | pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5167 | pDstProfile->beaconInterval = pSrcProfile->beaconInterval; |
| 5168 | #ifdef WLAN_SOFTAP_FEATURE |
| 5169 | pDstProfile->privacy = pSrcProfile->privacy; |
| 5170 | pDstProfile->fwdWPSPBCProbeReq = pSrcProfile->fwdWPSPBCProbeReq; |
| 5171 | pDstProfile->csr80211AuthType = pSrcProfile->csr80211AuthType; |
| 5172 | pDstProfile->dtimPeriod = pSrcProfile->dtimPeriod; |
| 5173 | pDstProfile->ApUapsdEnable = pSrcProfile->ApUapsdEnable; |
| 5174 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->SSIDs.SSIDList[0].ssidHidden; |
| 5175 | pDstProfile->protEnabled = pSrcProfile->protEnabled; |
| 5176 | pDstProfile->obssProtEnabled = pSrcProfile->obssProtEnabled; |
| 5177 | pDstProfile->cfg_protection = pSrcProfile->cfg_protection; |
| 5178 | pDstProfile->wps_state = pSrcProfile->wps_state; |
| 5179 | pDstProfile->ieee80211d = pSrcProfile->ieee80211d; |
| 5180 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5181 | palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5182 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5183 | if (pSrcProfile->MDID.mdiePresent) |
| 5184 | { |
| 5185 | pDstProfile->MDID.mdiePresent = 1; |
| 5186 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 5187 | } |
| 5188 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5189 | }while(0); |
| 5190 | |
| 5191 | if(!HAL_STATUS_SUCCESS(status)) |
| 5192 | { |
| 5193 | csrReleaseProfile(pMac, pDstProfile); |
| 5194 | pDstProfile = NULL; |
| 5195 | } |
| 5196 | |
| 5197 | return (status); |
| 5198 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5199 | eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile ) |
| 5200 | { |
| 5201 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5202 | tCsrRoamConnectedProfile *pSrcProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 5203 | do |
| 5204 | { |
| 5205 | palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile)); |
| 5206 | if(pSrcProfile->bssid) |
| 5207 | { |
| 5208 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 5209 | if(!HAL_STATUS_SUCCESS(status)) |
| 5210 | { |
| 5211 | break; |
| 5212 | } |
| 5213 | pDstProfile->BSSIDs.numOfBSSIDs = 1; |
| 5214 | palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->bssid, sizeof(tCsrBssid)); |
| 5215 | } |
| 5216 | if(pSrcProfile->SSID.ssId) |
| 5217 | { |
| 5218 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, sizeof(tCsrSSIDInfo)); |
| 5219 | if(!HAL_STATUS_SUCCESS(status)) |
| 5220 | { |
| 5221 | break; |
| 5222 | } |
| 5223 | pDstProfile->SSIDs.numOfSSIDs = 1; |
| 5224 | pDstProfile->SSIDs.SSIDList[0].handoffPermitted = pSrcProfile->handoffPermitted; |
| 5225 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->ssidHidden; |
| 5226 | palCopyMemory(pMac->hHdd, &pDstProfile->SSIDs.SSIDList[0].SSID, &pSrcProfile->SSID, sizeof(tSirMacSSid)); |
| 5227 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5228 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, 1); |
| 5229 | if(!HAL_STATUS_SUCCESS(status)) |
| 5230 | { |
| 5231 | break; |
| 5232 | } |
| 5233 | pDstProfile->ChannelInfo.numOfChannels = 1; |
| 5234 | pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5235 | pDstProfile->AuthType.numEntries = 1; |
| 5236 | pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType; |
| 5237 | pDstProfile->negotiatedAuthType = pSrcProfile->AuthType; |
| 5238 | pDstProfile->EncryptionType.numEntries = 1; |
| 5239 | pDstProfile->EncryptionType.encryptionType[0] = pSrcProfile->EncryptionType; |
| 5240 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->EncryptionType; |
| 5241 | pDstProfile->mcEncryptionType.numEntries = 1; |
| 5242 | pDstProfile->mcEncryptionType.encryptionType[0] = pSrcProfile->mcEncryptionType; |
| 5243 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->mcEncryptionType; |
| 5244 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 5245 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 5246 | palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys)); |
| 5247 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5248 | if (pSrcProfile->MDID.mdiePresent) |
| 5249 | { |
| 5250 | pDstProfile->MDID.mdiePresent = 1; |
| 5251 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 5252 | } |
| 5253 | #endif |
| 5254 | |
| 5255 | }while(0); |
| 5256 | |
| 5257 | if(!HAL_STATUS_SUCCESS(status)) |
| 5258 | { |
| 5259 | csrReleaseProfile(pMac, pDstProfile); |
| 5260 | pDstProfile = NULL; |
| 5261 | } |
| 5262 | |
| 5263 | return (status); |
| 5264 | } |
| 5265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5266 | eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5267 | tScanResultHandle hBSSList, |
| 5268 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate, |
| 5269 | tANI_BOOLEAN fClearScan) |
| 5270 | { |
| 5271 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5272 | tSmeCmd *pCommand; |
| 5273 | |
| 5274 | pCommand = csrGetCommandBuffer(pMac); |
| 5275 | if(NULL == pCommand) |
| 5276 | { |
| 5277 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 5278 | status = eHAL_STATUS_RESOURCES; |
| 5279 | } |
| 5280 | else |
| 5281 | { |
| 5282 | if( fClearScan ) |
| 5283 | { |
| 5284 | csrScanCancelIdleScan(pMac); |
| 5285 | csrScanAbortMacScanNotForConnect(pMac); |
| 5286 | } |
| 5287 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 5288 | if(NULL == pProfile) |
| 5289 | { |
| 5290 | //We can roam now |
| 5291 | //Since pProfile is NULL, we need to build our own profile, set everything to default |
| 5292 | //We can only support open and no encryption |
| 5293 | pCommand->u.roamCmd.roamProfile.AuthType.numEntries = 1; |
| 5294 | pCommand->u.roamCmd.roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5295 | pCommand->u.roamCmd.roamProfile.EncryptionType.numEntries = 1; |
| 5296 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 5297 | pCommand->u.roamCmd.roamProfile.csrPersona = VOS_STA_MODE; |
| 5298 | } |
| 5299 | else |
| 5300 | { |
| 5301 | //make a copy of the profile |
| 5302 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 5303 | if(HAL_STATUS_SUCCESS(status)) |
| 5304 | { |
| 5305 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 5306 | } |
| 5307 | } |
| 5308 | pCommand->command = eSmeCommandRoam; |
| 5309 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5310 | pCommand->u.roamCmd.hBSSList = hBSSList; |
| 5311 | pCommand->u.roamCmd.roamId = roamId; |
| 5312 | pCommand->u.roamCmd.roamReason = reason; |
| 5313 | //We need to free the BssList when the command is done |
| 5314 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_TRUE; |
| 5315 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5316 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 5317 | FL("CSR PERSONA=%d"), |
| 5318 | pCommand->u.roamCmd.roamProfile.csrPersona); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5319 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 5320 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5321 | { |
| 5322 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 5323 | csrReleaseCommandRoam( pMac, pCommand ); |
| 5324 | } |
| 5325 | } |
| 5326 | |
| 5327 | return (status); |
| 5328 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5329 | eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5330 | tCsrRoamModifyProfileFields *pMmodProfileFields, |
| 5331 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 5332 | { |
| 5333 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5334 | tSmeCmd *pCommand; |
| 5335 | |
| 5336 | pCommand = csrGetCommandBuffer(pMac); |
| 5337 | if(NULL == pCommand) |
| 5338 | { |
| 5339 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 5340 | status = eHAL_STATUS_RESOURCES; |
| 5341 | } |
| 5342 | else |
| 5343 | { |
| 5344 | csrScanCancelIdleScan(pMac); |
| 5345 | csrScanAbortMacScanNotForConnect(pMac); |
| 5346 | if(pProfile) |
| 5347 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5348 | //This is likely trying to reassoc to different profile |
| 5349 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 5350 | //make a copy of the profile |
| 5351 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 5352 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5353 | } |
| 5354 | else |
| 5355 | { |
| 5356 | status = csrRoamCopyConnectedProfile(pMac, sessionId, &pCommand->u.roamCmd.roamProfile); |
| 5357 | //how to update WPA/WPA2 info in roamProfile?? |
| 5358 | pCommand->u.roamCmd.roamProfile.uapsd_mask = pMmodProfileFields->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5359 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5360 | if(HAL_STATUS_SUCCESS(status)) |
| 5361 | { |
| 5362 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 5363 | } |
| 5364 | pCommand->command = eSmeCommandRoam; |
| 5365 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5366 | pCommand->u.roamCmd.roamId = roamId; |
| 5367 | pCommand->u.roamCmd.roamReason = reason; |
| 5368 | //We need to free the BssList when the command is done |
| 5369 | //For reassoc there is no BSS list, so the boolean set to false |
| 5370 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 5371 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 5372 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5373 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 5374 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5375 | { |
| 5376 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 5377 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5378 | csrReleaseCommandRoam( pMac, pCommand ); |
| 5379 | } |
| 5380 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5381 | return (status); |
| 5382 | } |
| 5383 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5384 | eHalStatus csrRoamConnectWithBSSList(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5385 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 5386 | { |
| 5387 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5388 | tScanResultHandle hBSSList; |
| 5389 | tANI_U32 roamId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5390 | status = csrScanCopyResultList(pMac, hBssListIn, &hBSSList); |
| 5391 | if(HAL_STATUS_SUCCESS(status)) |
| 5392 | { |
| 5393 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 5394 | if(pRoamId) |
| 5395 | { |
| 5396 | *pRoamId = roamId; |
| 5397 | } |
| 5398 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 5399 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 5400 | if(!HAL_STATUS_SUCCESS(status)) |
| 5401 | { |
| 5402 | smsLog(pMac, LOGE, FL("failed to start a join process\n")); |
| 5403 | csrScanResultPurge(pMac, hBSSList); |
| 5404 | } |
| 5405 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5406 | return (status); |
| 5407 | } |
| 5408 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5409 | eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5410 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 5411 | { |
| 5412 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5413 | tScanResultHandle hBSSList; |
| 5414 | tCsrScanResultFilter *pScanFilter; |
| 5415 | tANI_U32 roamId = 0; |
| 5416 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_FALSE; |
| 5417 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5418 | if (NULL == pProfile) |
| 5419 | { |
| 5420 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 5421 | return eHAL_STATUS_FAILURE; |
| 5422 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5423 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d\n"), |
| 5424 | pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5425 | if( CSR_IS_WDS( pProfile ) && |
| 5426 | !HAL_STATUS_SUCCESS( status = csrIsBTAMPAllowed( pMac, pProfile->operationChannel ) ) ) |
| 5427 | { |
| 5428 | return status; |
| 5429 | } |
| 5430 | csrRoamCancelRoaming(pMac, sessionId); |
| 5431 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 5432 | csrScanCancelIdleScan(pMac); |
| 5433 | //Only abort the scan if it is not used for other roam/connect purpose |
| 5434 | csrScanAbortMacScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5435 | #ifdef WLAN_SOFTAP_FEATURE |
| 5436 | if (!vos_concurrent_sessions_running() && (VOS_STA_SAP_MODE == pProfile->csrPersona))//In case of AP mode we do not want idle mode scan |
| 5437 | { |
| 5438 | csrScanDisable(pMac); |
| 5439 | } |
| 5440 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5441 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 5442 | //Check whether ssid changes |
| 5443 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 5444 | { |
| 5445 | if(pProfile->SSIDs.numOfSSIDs && !csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 5446 | { |
| 5447 | csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 5448 | } |
| 5449 | } |
| 5450 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5451 | pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; |
| 5452 | #endif |
| 5453 | if(CSR_INVALID_SCANRESULT_HANDLE != hBssListIn) |
| 5454 | { |
| 5455 | smsLog(pMac, LOGW, FL("is called with BSSList\n")); |
| 5456 | status = csrRoamConnectWithBSSList(pMac, sessionId, pProfile, hBssListIn, pRoamId); |
| 5457 | if(pRoamId) |
| 5458 | { |
| 5459 | roamId = *pRoamId; |
| 5460 | } |
| 5461 | if(!HAL_STATUS_SUCCESS(status)) |
| 5462 | { |
| 5463 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5464 | } |
| 5465 | } |
| 5466 | else |
| 5467 | { |
| 5468 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 5469 | if(HAL_STATUS_SUCCESS(status)) |
| 5470 | { |
| 5471 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 5472 | //Try to connect to any BSS |
| 5473 | if(NULL == pProfile) |
| 5474 | { |
| 5475 | //No encryption |
| 5476 | pScanFilter->EncryptionType.numEntries = 1; |
| 5477 | pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 5478 | }//we don't have a profile |
| 5479 | else |
| 5480 | { |
| 5481 | //Here is the profile we need to connect to |
| 5482 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 5483 | }//We have a profile |
| 5484 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 5485 | if(pRoamId) |
| 5486 | { |
| 5487 | *pRoamId = roamId; |
| 5488 | } |
| 5489 | |
| 5490 | if(HAL_STATUS_SUCCESS(status)) |
| 5491 | { |
| 5492 | /*Save the WPS info*/ |
| 5493 | if(NULL != pProfile) |
| 5494 | { |
| 5495 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
| 5496 | } |
| 5497 | else |
| 5498 | { |
| 5499 | pScanFilter->bWPSAssociation = 0; |
| 5500 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5501 | do |
| 5502 | { |
| 5503 | if( (pProfile && CSR_IS_WDS_AP( pProfile ) ) |
| 5504 | #ifdef WLAN_SOFTAP_FEATURE |
| 5505 | || (pProfile && CSR_IS_INFRA_AP ( pProfile )) |
| 5506 | #endif |
| 5507 | ) |
| 5508 | { |
| 5509 | //This can be start right away |
| 5510 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 5511 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 5512 | if(!HAL_STATUS_SUCCESS(status)) |
| 5513 | { |
| 5514 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5515 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5516 | break; |
| 5517 | } |
| 5518 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 5519 | smsLog(pMac, LOGE, "************ csrScanGetResult Status ********* %d\n", status); |
| 5520 | if(HAL_STATUS_SUCCESS(status)) |
| 5521 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5522 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 5523 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 5524 | if(!HAL_STATUS_SUCCESS(status)) |
| 5525 | { |
| 5526 | csrScanResultPurge(pMac, hBSSList); |
| 5527 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5528 | } |
| 5529 | }//Have scan result |
| 5530 | else if(NULL != pProfile) |
| 5531 | { |
| 5532 | //Check whether it is for start ibss |
| 5533 | if(CSR_IS_START_IBSS(pProfile)) |
| 5534 | { |
| 5535 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 5536 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 5537 | if(!HAL_STATUS_SUCCESS(status)) |
| 5538 | { |
| 5539 | smsLog(pMac, LOGE, " CSR failed to issue startIBSS command with status = 0x%08X\n", status); |
| 5540 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5541 | } |
| 5542 | } |
| 5543 | else |
| 5544 | { |
| 5545 | //scan for this SSID |
| 5546 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId); |
| 5547 | if(!HAL_STATUS_SUCCESS(status)) |
| 5548 | { |
| 5549 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5550 | } |
| 5551 | } |
| 5552 | } |
| 5553 | else |
| 5554 | { |
| 5555 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5556 | } |
| 5557 | } while (0); |
| 5558 | if(NULL != pProfile) |
| 5559 | { |
| 5560 | //we need to free memory for filter if profile exists |
| 5561 | csrFreeScanFilter(pMac, pScanFilter); |
| 5562 | } |
| 5563 | }//Got the scan filter from profile |
| 5564 | |
| 5565 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 5566 | }//allocated memory for pScanFilter |
| 5567 | }//No Bsslist coming in |
| 5568 | //tell the caller if we fail to trigger a join request |
| 5569 | if( fCallCallback ) |
| 5570 | { |
| 5571 | csrRoamCallCallback(pMac, sessionId, NULL, roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 5572 | } |
| 5573 | |
| 5574 | return (status); |
| 5575 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5576 | eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5577 | tCsrRoamModifyProfileFields modProfileFields, |
| 5578 | tANI_U32 *pRoamId) |
| 5579 | { |
| 5580 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5581 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_TRUE; |
| 5582 | tANI_U32 roamId = 0; |
| 5583 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5584 | if (NULL == pProfile) |
| 5585 | { |
| 5586 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 5587 | return eHAL_STATUS_FAILURE; |
| 5588 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5589 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d\n"), pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
| 5590 | csrRoamCancelRoaming(pMac, sessionId); |
| 5591 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 5592 | csrScanCancelIdleScan(pMac); |
| 5593 | csrScanAbortMacScanNotForConnect(pMac); |
| 5594 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssuedReassocToSameAP); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5595 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 5596 | { |
| 5597 | if(pProfile) |
| 5598 | { |
| 5599 | if(pProfile->SSIDs.numOfSSIDs && |
| 5600 | csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 5601 | { |
| 5602 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 5603 | } |
| 5604 | else |
| 5605 | { |
| 5606 | smsLog(pMac, LOG1, FL("Not connected to the same SSID asked in the profile\n")); |
| 5607 | } |
| 5608 | } |
| 5609 | else if(!palEqualMemory(pMac->hHdd, &modProfileFields, |
| 5610 | &pSession->connectedProfile.modifyProfileFields, |
| 5611 | sizeof(tCsrRoamModifyProfileFields))) |
| 5612 | { |
| 5613 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 5614 | } |
| 5615 | else |
| 5616 | { |
| 5617 | smsLog(pMac, LOG1, FL("Either the profile is NULL or none of the fields " |
| 5618 | "in tCsrRoamModifyProfileFields got modified\n")); |
| 5619 | } |
| 5620 | } |
| 5621 | else |
| 5622 | { |
| 5623 | smsLog(pMac, LOG1, FL("Not connected! No need to reassoc\n")); |
| 5624 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5625 | if(!fCallCallback) |
| 5626 | { |
| 5627 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 5628 | if(pRoamId) |
| 5629 | { |
| 5630 | *pRoamId = roamId; |
| 5631 | } |
| 5632 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5633 | status = csrRoamIssueReassoc(pMac, sessionId, pProfile, &modProfileFields, |
| 5634 | eCsrHddIssuedReassocToSameAP, roamId, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5635 | } |
| 5636 | else |
| 5637 | { |
| 5638 | status = csrRoamCallCallback(pMac, sessionId, NULL, roamId, |
| 5639 | eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 5640 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5641 | return status; |
| 5642 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5643 | eHalStatus csrRoamJoinLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 5644 | { |
| 5645 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5646 | tScanResultHandle hBSSList = NULL; |
| 5647 | tCsrScanResultFilter *pScanFilter = NULL; |
| 5648 | tANI_U32 roamId; |
| 5649 | tCsrRoamProfile *pProfile = NULL; |
| 5650 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5651 | do |
| 5652 | { |
| 5653 | if(pSession->pCurRoamProfile) |
| 5654 | { |
| 5655 | csrScanCancelIdleScan(pMac); |
| 5656 | csrScanAbortMacScanNotForConnect(pMac); |
| 5657 | //We have to make a copy of pCurRoamProfile because it will be free inside csrRoamIssueConnect |
| 5658 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile, sizeof(tCsrRoamProfile)); |
| 5659 | if(!HAL_STATUS_SUCCESS(status)) |
| 5660 | break; |
| 5661 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile)); |
| 5662 | status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile); |
| 5663 | if(!HAL_STATUS_SUCCESS(status)) |
| 5664 | break; |
| 5665 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 5666 | if(!HAL_STATUS_SUCCESS(status)) |
| 5667 | { |
| 5668 | break; |
| 5669 | } |
| 5670 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 5671 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 5672 | if(!HAL_STATUS_SUCCESS(status)) |
| 5673 | { |
| 5674 | break; |
| 5675 | } |
| 5676 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 5677 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 5678 | if(HAL_STATUS_SUCCESS(status)) |
| 5679 | { |
| 5680 | //we want to put the last connected BSS to the very beginning, if possible |
| 5681 | csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList); |
| 5682 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 5683 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 5684 | if(!HAL_STATUS_SUCCESS(status)) |
| 5685 | { |
| 5686 | csrScanResultPurge(pMac, hBSSList); |
| 5687 | break; |
| 5688 | } |
| 5689 | } |
| 5690 | else |
| 5691 | { |
| 5692 | //Do a scan on this profile |
| 5693 | //scan for this SSID only in case the AP suppresses SSID |
| 5694 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId); |
| 5695 | if(!HAL_STATUS_SUCCESS(status)) |
| 5696 | { |
| 5697 | break; |
| 5698 | } |
| 5699 | } |
| 5700 | }//We have a profile |
| 5701 | else |
| 5702 | { |
| 5703 | smsLog(pMac, LOGW, FL("cannot find a roaming profile\n")); |
| 5704 | break; |
| 5705 | } |
| 5706 | }while(0); |
| 5707 | if(pScanFilter) |
| 5708 | { |
| 5709 | csrFreeScanFilter(pMac, pScanFilter); |
| 5710 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 5711 | } |
| 5712 | if(NULL != pProfile) |
| 5713 | { |
| 5714 | csrReleaseProfile(pMac, pProfile); |
| 5715 | palFreeMemory(pMac->hHdd, pProfile); |
| 5716 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5717 | return (status); |
| 5718 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5719 | eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 5720 | { |
| 5721 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5722 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 5723 | { |
| 5724 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 5725 | if(HAL_STATUS_SUCCESS(status)) |
| 5726 | { |
| 5727 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 5728 | } |
| 5729 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5730 | return (status); |
| 5731 | } |
| 5732 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5733 | eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 5734 | { |
| 5735 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5736 | smsLog(pMac, LOGW, FL("is called\n")); |
| 5737 | csrRoamCancelRoaming(pMac, sessionId); |
| 5738 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 5739 | if(csrIsConnStateDisconnected(pMac, sessionId)) |
| 5740 | { |
| 5741 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 5742 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5743 | return (status); |
| 5744 | } |
| 5745 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5746 | eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure ) |
| 5747 | { |
| 5748 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5749 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
| 5750 | eCsrRoamSubState NewSubstate; |
| 5751 | tANI_U32 sessionId = pCommand->sessionId; |
| 5752 | |
| 5753 | // change state to 'Roaming'... |
| 5754 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 5755 | |
| 5756 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 5757 | { |
| 5758 | // If we are in an IBSS, then stop the IBSS... |
| 5759 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 5760 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 5761 | } |
| 5762 | else if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 5763 | { |
| 5764 | smsLog(pMac, LOGE, FL(" restore AC weights (%d-%d-%d-%d)\n"), pMac->roam.ucACWeights[0], pMac->roam.ucACWeights[1], |
| 5765 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 5766 | //Restore AC weight in case we change it |
| 5767 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 5768 | // in Infrasturcture, we need to disassociate from the Infrastructure network... |
| 5769 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED; |
| 5770 | if(eCsrSmeIssuedDisassocForHandoff == pCommand->u.roamCmd.roamReason) |
| 5771 | { |
| 5772 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF; |
| 5773 | } |
| 5774 | if( fDisassoc ) |
| 5775 | { |
| 5776 | status = csrRoamIssueDisassociate( pMac, sessionId, NewSubstate, fMICFailure ); |
| 5777 | } |
| 5778 | else |
| 5779 | { |
| 5780 | status = csrRoamIssueDeauth( pMac, sessionId, eCSR_ROAM_SUBSTATE_DEAUTH_REQ ); |
| 5781 | } |
| 5782 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 5783 | } |
| 5784 | else if ( csrIsConnStateWds( pMac, sessionId ) ) |
| 5785 | { |
| 5786 | if( CSR_IS_WDS_AP( &pMac->roam.roamSession[sessionId].connectedProfile ) ) |
| 5787 | { |
| 5788 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 5789 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 5790 | } |
| 5791 | //This has to be WDS station |
| 5792 | else if( csrIsConnStateConnectedWds( pMac, sessionId ) ) //This has to be WDS station |
| 5793 | { |
| 5794 | |
| 5795 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 5796 | if( fDisassoc ) |
| 5797 | { |
| 5798 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 5799 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, fMICFailure ); |
| 5800 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 5801 | } |
| 5802 | } |
| 5803 | } else { |
| 5804 | // we got a dis-assoc request while not connected to any peer |
| 5805 | // just complete the command |
| 5806 | fComplete = eANI_BOOLEAN_TRUE; |
| 5807 | status = eHAL_STATUS_FAILURE; |
| 5808 | } |
| 5809 | if(fComplete) |
| 5810 | { |
| 5811 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 5812 | } |
| 5813 | |
| 5814 | if(HAL_STATUS_SUCCESS(status)) |
| 5815 | { |
| 5816 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 5817 | { |
| 5818 | //Set the state to disconnect here |
| 5819 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 5820 | } |
| 5821 | } |
| 5822 | return (status); |
| 5823 | } |
| 5824 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5825 | /* This is been removed from latest code base */ |
| 5826 | /* |
| 5827 | static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 5828 | { |
| 5829 | eHalStatus status; |
| 5830 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5831 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING ); |
| 5832 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5833 | return ( status ); |
| 5834 | } |
| 5835 | */ |
| 5836 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5837 | eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason ) |
| 5838 | { |
| 5839 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5840 | tSmeCmd *pCommand; |
| 5841 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5842 | do |
| 5843 | { |
| 5844 | smsLog( pMac, LOGE, FL(" reason = %d\n"), reason ); |
| 5845 | pCommand = csrGetCommandBuffer( pMac ); |
| 5846 | if ( !pCommand ) |
| 5847 | { |
| 5848 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 5849 | status = eHAL_STATUS_RESOURCES; |
| 5850 | break; |
| 5851 | } |
| 5852 | //Change the substate in case it is wait-for-key |
| 5853 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 5854 | { |
| 5855 | csrRoamStopWaitForKeyTimer( pMac ); |
| 5856 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 5857 | } |
| 5858 | pCommand->command = eSmeCommandRoam; |
| 5859 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5860 | switch ( reason ) |
| 5861 | { |
| 5862 | case eCSR_DISCONNECT_REASON_MIC_ERROR: |
| 5863 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocMICFailure; |
| 5864 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5865 | case eCSR_DISCONNECT_REASON_DEAUTH: |
| 5866 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauth; |
| 5867 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5868 | case eCSR_DISCONNECT_REASON_HANDOFF: |
| 5869 | fHighPriority = eANI_BOOLEAN_TRUE; |
| 5870 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff; |
| 5871 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5872 | case eCSR_DISCONNECT_REASON_UNSPECIFIED: |
| 5873 | case eCSR_DISCONNECT_REASON_DISASSOC: |
| 5874 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 5875 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5876 | case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE: |
| 5877 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedIbssJoinFailure; |
| 5878 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5879 | case eCSR_DISCONNECT_REASON_IBSS_LEAVE: |
| 5880 | pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave; |
| 5881 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5882 | default: |
| 5883 | break; |
| 5884 | } |
| 5885 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 5886 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5887 | { |
| 5888 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 5889 | csrReleaseCommandRoam( pMac, pCommand ); |
| 5890 | } |
| 5891 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5892 | return( status ); |
| 5893 | } |
| 5894 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5895 | eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority ) |
| 5896 | { |
| 5897 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5898 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5899 | pCommand = csrGetCommandBuffer( pMac ); |
| 5900 | if ( NULL != pCommand ) |
| 5901 | { |
| 5902 | //Change the substate in case it is wait-for-key |
| 5903 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 5904 | { |
| 5905 | csrRoamStopWaitForKeyTimer( pMac ); |
| 5906 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 5907 | } |
| 5908 | pCommand->command = eSmeCommandRoam; |
| 5909 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5910 | pCommand->u.roamCmd.roamReason = eCsrStopBss; |
| 5911 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 5912 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5913 | { |
| 5914 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 5915 | csrReleaseCommandRoam( pMac, pCommand ); |
| 5916 | } |
| 5917 | } |
| 5918 | else |
| 5919 | { |
| 5920 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 5921 | status = eHAL_STATUS_RESOURCES; |
| 5922 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5923 | return ( status ); |
| 5924 | } |
| 5925 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5926 | eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 5927 | { |
| 5928 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5929 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 5930 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5931 | //Stop te retry |
| 5932 | pSession->maxRetryCount = 0; |
| 5933 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 5934 | #endif |
| 5935 | //Not to call cancel roaming here |
| 5936 | //Only issue disconnect when necessary |
| 5937 | if(csrIsConnStateConnected(pMac, sessionId) || csrIsBssTypeIBSS(pSession->connectedProfile.BSSType) |
| 5938 | || csrIsBssTypeWDS(pSession->connectedProfile.BSSType) |
| 5939 | || csrIsRoamCommandWaitingForSession(pMac, sessionId) ) |
| 5940 | |
| 5941 | { |
| 5942 | smsLog(pMac, LOG2, FL("called\n")); |
| 5943 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, reason); |
| 5944 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5945 | return (status); |
| 5946 | } |
| 5947 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5948 | eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 5949 | { |
| 5950 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5951 | csrRoamCancelRoaming(pMac, sessionId); |
| 5952 | pSession->ibss_join_pending = FALSE; |
| 5953 | csrRoamStopIbssJoinTimer(pMac, sessionId); |
| 5954 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrForcedDisassoc); |
| 5955 | |
| 5956 | return (csrRoamDisconnectInternal(pMac, sessionId, reason)); |
| 5957 | } |
| 5958 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5959 | eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5960 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes) |
| 5961 | { |
| 5962 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5963 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 5964 | tANI_U8 index; |
| 5965 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 5966 | tCsrRoamConnectedProfile *pConnectProfile = &pSession->connectedProfile; |
| 5967 | |
| 5968 | palZeroMemory(pMac->hHdd, &pSession->connectedProfile, sizeof(tCsrRoamConnectedProfile)); |
| 5969 | pConnectProfile->AuthType = pProfile->negotiatedAuthType; |
| 5970 | pConnectProfile->AuthInfo = pProfile->AuthType; |
| 5971 | pConnectProfile->CBMode = pProfile->CBMode; //*** this may not be valid |
| 5972 | pConnectProfile->EncryptionType = pProfile->negotiatedUCEncryptionType; |
| 5973 | pConnectProfile->EncryptionInfo = pProfile->EncryptionType; |
| 5974 | pConnectProfile->mcEncryptionType = pProfile->negotiatedMCEncryptionType; |
| 5975 | pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType; |
| 5976 | pConnectProfile->BSSType = pProfile->BSSType; |
| 5977 | pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask; |
| 5978 | pConnectProfile->operationChannel = pSirBssDesc->channelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 5979 | pConnectProfile->beaconInterval = pSirBssDesc->beaconInterval; |
| 5980 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5981 | palCopyMemory(pMac->hHdd, &pConnectProfile->Keys, &pProfile->Keys, sizeof(tCsrKeys)); |
| 5982 | //Save bssid |
| 5983 | csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid); |
| 5984 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5985 | if (pSirBssDesc->mdiePresent) |
| 5986 | { |
| 5987 | pConnectProfile->MDID.mdiePresent = 1; |
| 5988 | pConnectProfile->MDID.mobilityDomain = (pSirBssDesc->mdie[1] << 8) | (pSirBssDesc->mdie[0]); |
| 5989 | } |
| 5990 | #endif |
| 5991 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5992 | if ((csrIsProfileCCX(pProfile) || |
| 5993 | ((pIesTemp->CCXVersion.present) |
| 5994 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 5995 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 5996 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 5997 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
| 5998 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
| 5999 | && (!(csrIsProfile11r( pProfile ))) |
| 6000 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6001 | { |
| 6002 | pConnectProfile->isCCXAssoc = 1; |
| 6003 | } |
| 6004 | #endif |
| 6005 | //save ssid |
| 6006 | if( NULL == pIesTemp ) |
| 6007 | { |
| 6008 | status = csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp); |
| 6009 | } |
| 6010 | if(HAL_STATUS_SUCCESS(status)) |
| 6011 | { |
| 6012 | if(pIesTemp->SSID.present) |
| 6013 | { |
| 6014 | pConnectProfile->SSID.length = pIesTemp->SSID.num_ssid; |
| 6015 | palCopyMemory(pMac->hHdd, pConnectProfile->SSID.ssId, |
| 6016 | pIesTemp->SSID.ssid, pIesTemp->SSID.num_ssid); |
| 6017 | } |
| 6018 | |
| 6019 | //Save the bss desc |
| 6020 | status = csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6021 | if( CSR_IS_QOS_BSS(pIesTemp) ) |
| 6022 | { |
| 6023 | pConnectProfile->qap = TRUE; |
| 6024 | } |
| 6025 | else |
| 6026 | { |
| 6027 | pConnectProfile->qap = FALSE; |
| 6028 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6029 | if ( NULL == pIes ) |
| 6030 | { |
| 6031 | //Free memory if it allocated locally |
| 6032 | palFreeMemory(pMac->hHdd, pIesTemp); |
| 6033 | } |
| 6034 | } |
| 6035 | //Save Qos connection |
| 6036 | pConnectProfile->qosConnection = pMac->roam.roamSession[sessionId].fWMMConnection; |
| 6037 | |
| 6038 | if(!HAL_STATUS_SUCCESS(status)) |
| 6039 | { |
| 6040 | csrFreeConnectBssDesc(pMac, sessionId); |
| 6041 | } |
| 6042 | for(index = 0; index < pProfile->SSIDs.numOfSSIDs; index++) |
| 6043 | { |
| 6044 | if((pProfile->SSIDs.SSIDList[index].SSID.length == pConnectProfile->SSID.length) && |
| 6045 | palEqualMemory(pMac->hHdd, pProfile->SSIDs.SSIDList[index].SSID.ssId, |
| 6046 | pConnectProfile->SSID.ssId, pConnectProfile->SSID.length)) |
| 6047 | { |
| 6048 | pConnectProfile->handoffPermitted = pProfile->SSIDs.SSIDList[index].handoffPermitted; |
| 6049 | break; |
| 6050 | } |
| 6051 | pConnectProfile->handoffPermitted = FALSE; |
| 6052 | } |
| 6053 | |
| 6054 | return (status); |
| 6055 | } |
| 6056 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6057 | static void csrRoamJoinRspProcessor( tpAniSirGlobal pMac, tSirSmeJoinRsp *pSmeJoinRsp ) |
| 6058 | { |
| 6059 | tListElem *pEntry = NULL; |
| 6060 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6061 | //The head of the active list is the request we sent |
| 6062 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6063 | if(pEntry) |
| 6064 | { |
| 6065 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6066 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6067 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 6068 | { |
| 6069 | if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason) |
| 6070 | { |
| 6071 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6072 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 6073 | #endif |
| 6074 | } |
| 6075 | csrRoamComplete( pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp ); |
| 6076 | } |
| 6077 | else |
| 6078 | { |
| 6079 | tANI_U32 roamId = 0; |
| 6080 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId ); |
| 6081 | |
| 6082 | //The head of the active list is the request we sent |
| 6083 | //Try to get back the same profile and roam again |
| 6084 | if(pCommand) |
| 6085 | { |
| 6086 | roamId = pCommand->u.roamCmd.roamId; |
| 6087 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6088 | pSession->joinFailStatusCode.statusCode = pSmeJoinRsp->statusCode; |
| 6089 | pSession->joinFailStatusCode.reasonCode = pSmeJoinRsp->protStatusCode; |
| 6090 | smsLog( pMac, LOGW, "SmeJoinReq failed with statusCode= 0x%08lX [%d]\n", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); |
| 6091 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 6092 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 6093 | if (csrRoamIsHandoffInProgress(pMac)) |
| 6094 | { |
| 6095 | csrRoamCallCallback(pMac, pSmeJoinRsp->sessionId, NULL, roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 6096 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 6097 | csrNeighborRoamIndicateConnect(pMac, pSmeJoinRsp->sessionId, VOS_STATUS_E_FAILURE); |
| 6098 | } |
| 6099 | #endif |
| 6100 | if (pCommand) |
| 6101 | { |
| 6102 | if(CSR_IS_WDS_STA( &pCommand->u.roamCmd.roamProfile )) |
| 6103 | { |
| 6104 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 6105 | pSession->connectedProfile.BSSType = eCSR_BSS_TYPE_WDS_STA; |
| 6106 | csrRoamReissueRoamCommand(pMac); |
| 6107 | } |
| 6108 | else if( CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) ) |
| 6109 | { |
| 6110 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6111 | } |
| 6112 | else |
| 6113 | { |
| 6114 | csrRoam(pMac, pCommand); |
| 6115 | } |
| 6116 | } |
| 6117 | else |
| 6118 | { |
| 6119 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6120 | } |
| 6121 | } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */ |
| 6122 | } |
| 6123 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6124 | eHalStatus csrRoamIssueJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 6125 | tDot11fBeaconIEs *pIes, |
| 6126 | tCsrRoamProfile *pProfile, tANI_U32 roamId ) |
| 6127 | { |
| 6128 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6129 | smsLog( pMac, LOG1, "Attempting to Join Bssid= %02x-%02x-%02x-%02x-%02x-%02x\n", |
| 6130 | pSirBssDesc->bssId[ 0 ],pSirBssDesc->bssId[ 1 ],pSirBssDesc->bssId[ 2 ], |
| 6131 | pSirBssDesc->bssId[ 3 ],pSirBssDesc->bssId[ 4 ],pSirBssDesc->bssId[ 5 ] ); |
| 6132 | |
| 6133 | // Set the roaming substate to 'join attempt'... |
| 6134 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6135 | // attempt to Join this BSS... |
| 6136 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6137 | return (status); |
| 6138 | } |
| 6139 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6140 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 6141 | tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile) |
| 6142 | { |
| 6143 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6144 | // Set the roaming substate to 'join attempt'... |
| 6145 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId ); |
| 6146 | |
| 6147 | smsLog(pMac, LOGE, FL(" calling csrSendSmeReassocReqMsg\n")); |
| 6148 | |
| 6149 | // attempt to Join this BSS... |
| 6150 | return csrSendSmeReassocReqMsg( pMac, sessionId, pSirBssDesc, pIes, pProfile ); |
| 6151 | } |
| 6152 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6153 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac) |
| 6154 | { |
| 6155 | tListElem *pEntry; |
| 6156 | tSmeCmd *pCommand; |
| 6157 | tCsrRoamInfo roamInfo; |
| 6158 | tANI_U32 sessionId; |
| 6159 | tCsrRoamSession *pSession; |
| 6160 | |
| 6161 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6162 | if(pEntry) |
| 6163 | { |
| 6164 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6165 | if ( eSmeCommandRoam == pCommand->command ) |
| 6166 | { |
| 6167 | sessionId = pCommand->sessionId; |
| 6168 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 6169 | if( pCommand->u.roamCmd.fStopWds ) |
| 6170 | { |
| 6171 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 6172 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 6173 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 6174 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 6175 | #ifdef WLAN_SOFTAP_FEATURE |
| 6176 | if (CSR_IS_WDS(&pSession->connectedProfile)){ |
| 6177 | #endif |
| 6178 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 6179 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 6180 | eCSR_ROAM_WDS_IND, |
| 6181 | eCSR_ROAM_RESULT_WDS_DISASSOCIATED); |
| 6182 | #ifdef WLAN_SOFTAP_FEATURE |
| 6183 | }else if (CSR_IS_INFRA_AP(&pSession->connectedProfile)){ |
| 6184 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 6185 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 6186 | eCSR_ROAM_INFRA_IND, |
| 6187 | eCSR_ROAM_RESULT_INFRA_DISASSOCIATED); |
| 6188 | } |
| 6189 | |
| 6190 | #endif |
| 6191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6192 | if( !HAL_STATUS_SUCCESS( csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ) ) ) |
| 6193 | { |
| 6194 | smsLog(pMac, LOGE, " Failed to reissue stop_bss command for WDS after disassociated\n"); |
| 6195 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6196 | } |
| 6197 | } |
| 6198 | else if(eCsrStopRoaming == csrRoamJoinNextBss(pMac, pCommand, eANI_BOOLEAN_TRUE)) |
| 6199 | { |
| 6200 | smsLog(pMac, LOGW, " Failed to reissue join command after disassociated\n"); |
| 6201 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6202 | } |
| 6203 | } |
| 6204 | else |
| 6205 | { |
| 6206 | smsLog(pMac, LOGW, " Command is not roaming after disassociated\n"); |
| 6207 | } |
| 6208 | } |
| 6209 | else |
| 6210 | { |
| 6211 | smsLog(pMac, LOGE, " Disassoc rsp cannot continue because no command is available\n"); |
| 6212 | } |
| 6213 | } |
| 6214 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6215 | tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6216 | { |
| 6217 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 6218 | tListElem *pEntry; |
| 6219 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6220 | //alwasy lock active list before locking pending list |
| 6221 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 6222 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 6223 | if(pEntry) |
| 6224 | { |
| 6225 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6226 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 6227 | { |
| 6228 | fRet = eANI_BOOLEAN_TRUE; |
| 6229 | } |
| 6230 | } |
| 6231 | if(eANI_BOOLEAN_FALSE == fRet) |
| 6232 | { |
| 6233 | csrLLLock(&pMac->sme.smeCmdPendingList); |
| 6234 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK); |
| 6235 | while(pEntry) |
| 6236 | { |
| 6237 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6238 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 6239 | { |
| 6240 | fRet = eANI_BOOLEAN_TRUE; |
| 6241 | break; |
| 6242 | } |
| 6243 | pEntry = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK); |
| 6244 | } |
| 6245 | csrLLUnlock(&pMac->sme.smeCmdPendingList); |
| 6246 | } |
| 6247 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6248 | return (fRet); |
| 6249 | } |
| 6250 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6251 | tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac) |
| 6252 | { |
| 6253 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 6254 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6255 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 6256 | { |
| 6257 | if( CSR_IS_SESSION_VALID( pMac, i ) && ( fRet = csrIsRoamCommandWaitingForSession( pMac, i ) ) ) |
| 6258 | { |
| 6259 | break; |
| 6260 | } |
| 6261 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6262 | return ( fRet ); |
| 6263 | } |
| 6264 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6265 | tANI_BOOLEAN csrIsCommandWaiting(tpAniSirGlobal pMac) |
| 6266 | { |
| 6267 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6268 | //alwasy lock active list before locking pending list |
| 6269 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 6270 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 6271 | if(eANI_BOOLEAN_FALSE == fRet) |
| 6272 | { |
| 6273 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK); |
| 6274 | } |
| 6275 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6276 | return (fRet); |
| 6277 | } |
| 6278 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6279 | tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac ) |
| 6280 | { |
| 6281 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 6282 | tListElem *pEntry; |
| 6283 | tCsrCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6284 | //alwasy lock active list before locking pending list |
| 6285 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 6286 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 6287 | if( pEntry ) |
| 6288 | { |
| 6289 | pCommand = GET_BASE_ADDR(pEntry, tCsrCmd, Link); |
| 6290 | if( ( eCsrRoamCommandScan == pCommand->command ) && |
| 6291 | ( ( eCsrScanForSsid == pCommand->u.scanCmd.reason ) || |
| 6292 | ( eCsrScanForCapsChange == pCommand->u.scanCmd.reason ) || |
| 6293 | ( eCsrScanP2PFindPeer == pCommand->u.scanCmd.reason ) ) ) |
| 6294 | { |
| 6295 | fRet = eANI_BOOLEAN_TRUE; |
| 6296 | } |
| 6297 | } |
| 6298 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6299 | return (fRet); |
| 6300 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6301 | eHalStatus csrRoamIssueReassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 6302 | { |
| 6303 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6304 | tSmeCmd *pCommand = NULL; |
| 6305 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_TRUE; |
| 6306 | tANI_BOOLEAN fRemoveCmd = FALSE; |
| 6307 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6308 | // Delete the old assoc command. All is setup for reassoc to be serialized |
| 6309 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 6310 | if ( pEntry ) |
| 6311 | { |
| 6312 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 6313 | if ( !pCommand ) |
| 6314 | { |
| 6315 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 6316 | return eHAL_STATUS_RESOURCES; |
| 6317 | } |
| 6318 | if ( eSmeCommandRoam == pCommand->command ) |
| 6319 | { |
| 6320 | if (pCommand->u.roamCmd.roamReason == eCsrSmeIssuedAssocToSimilarAP) |
| 6321 | { |
| 6322 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 6323 | } |
| 6324 | else |
| 6325 | { |
| 6326 | smsLog( pMac, LOGE, FL(" Unexpected active roam command present \n") ); |
| 6327 | } |
| 6328 | if (fRemoveCmd == FALSE) |
| 6329 | { |
| 6330 | // Implies we did not get the serialized assoc command we |
| 6331 | // were expecting |
| 6332 | pCommand = NULL; |
| 6333 | } |
| 6334 | } |
| 6335 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6336 | if(NULL == pCommand) |
| 6337 | { |
| 6338 | smsLog( pMac, LOGE, FL(" fail to get command buffer as expected based on previous connect roam command\n") ); |
| 6339 | return eHAL_STATUS_RESOURCES; |
| 6340 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6341 | do |
| 6342 | { |
| 6343 | //Change the substate in case it is wait-for-key |
| 6344 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 6345 | { |
| 6346 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6347 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 6348 | } |
| 6349 | pCommand->command = eSmeCommandRoam; |
| 6350 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6351 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedFTReassoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6352 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6353 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6354 | { |
| 6355 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 6356 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6357 | } |
| 6358 | } while( 0 ); |
| 6359 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6360 | return( status ); |
| 6361 | } |
| 6362 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ) |
| 6363 | { |
| 6364 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6365 | tCsrScanResult *pScanResult = NULL; |
| 6366 | tSirBssDescription *pBssDesc = NULL; |
| 6367 | tSmeCmd *pCommand = NULL; |
| 6368 | tANI_U32 sessionId; |
| 6369 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6370 | if(NULL == pEntry) |
| 6371 | { |
| 6372 | smsLog(pMac, LOGW, " CFG_CNF with active list empty\n"); |
| 6373 | return; |
| 6374 | } |
| 6375 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6376 | sessionId = pCommand->sessionId; |
| 6377 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 6378 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 6379 | { |
| 6380 | //the roaming is cancelled. Simply complete the command |
| 6381 | smsLog(pMac, LOGW, FL(" Roam command cancelled\n")); |
| 6382 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 6383 | } |
| 6384 | else |
| 6385 | { |
| 6386 | if ( CCM_IS_RESULT_SUCCESS(result) ) |
| 6387 | { |
| 6388 | smsLog(pMac, LOG2, "Cfg sequence complete\n"); |
| 6389 | // Successfully set the configuration parameters for the new Bss. Attempt to |
| 6390 | // join the roaming Bss. |
| 6391 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 6392 | { |
| 6393 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 6394 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 6395 | } |
| 6396 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) || |
| 6397 | CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) |
| 6398 | #ifdef WLAN_SOFTAP_FEATURE |
| 6399 | || CSR_IS_INFRA_AP(&pCommand->u.roamCmd.roamProfile) |
| 6400 | #endif |
| 6401 | ) |
| 6402 | { |
| 6403 | if(!HAL_STATUS_SUCCESS(csrRoamIssueStartBss( pMac, sessionId, |
| 6404 | &pSession->bssParams, &pCommand->u.roamCmd.roamProfile, |
| 6405 | pBssDesc, pCommand->u.roamCmd.roamId ))) |
| 6406 | { |
| 6407 | smsLog(pMac, LOGW, " CSR start BSS failed\n"); |
| 6408 | //We need to complete the command |
| 6409 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 6410 | } |
| 6411 | } |
| 6412 | else |
| 6413 | { |
| 6414 | if (!pCommand->u.roamCmd.pRoamBssEntry) |
| 6415 | { |
| 6416 | smsLog(pMac, LOGW, " pRoamBssEntry is NULL\n"); |
| 6417 | //We need to complete the command |
| 6418 | csrRoamComplete(pMac, eCsrJoinFailure, NULL); |
| 6419 | return; |
| 6420 | } |
| 6421 | // If we are roaming TO an Infrastructure BSS... |
| 6422 | VOS_ASSERT(pScanResult != NULL); |
| 6423 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 6424 | { |
| 6425 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6426 | if(pIesLocal || (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 6427 | { |
| 6428 | // ..and currently in an Infrastructure connection.... |
| 6429 | if( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 6430 | { |
| 6431 | // ...and the SSIDs are equal, then we Reassoc. |
| 6432 | if ( csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, |
| 6433 | pIesLocal ) ) |
| 6434 | // ..and currently in an infrastructure connection |
| 6435 | { |
| 6436 | // then issue a Reassoc. |
| 6437 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
| 6438 | csrRoamIssueReassociate( pMac, sessionId, pBssDesc, pIesLocal, |
| 6439 | &pCommand->u.roamCmd.roamProfile ); |
| 6440 | } |
| 6441 | else |
| 6442 | { |
| 6443 | |
| 6444 | // otherwise, we have to issue a new Join request to LIM because we disassociated from the |
| 6445 | // previously associated AP. |
| 6446 | if(!HAL_STATUS_SUCCESS(csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 6447 | pIesLocal, |
| 6448 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ))) |
| 6449 | { |
| 6450 | //try something else |
| 6451 | csrRoam( pMac, pCommand ); |
| 6452 | } |
| 6453 | } |
| 6454 | } |
| 6455 | else |
| 6456 | { |
| 6457 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6458 | |
| 6459 | /* We need to come with other way to figure out that this is because of HO in BMP |
| 6460 | The below API will be only available for Android as it uses a different HO algorithm */ |
| 6461 | /* Reassoc request will be used only for CCX and 11r handoff whereas other legacy roaming should |
| 6462 | * use join request */ |
| 6463 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6464 | if (csrRoamIsHandoffInProgress(pMac) && |
| 6465 | csrRoamIs11rAssoc(pMac)) |
| 6466 | { |
| 6467 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 6468 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 6469 | } |
| 6470 | else |
| 6471 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6472 | #ifdef FEATURE_WLAN_CCX |
| 6473 | if (csrRoamIsHandoffInProgress(pMac) && |
| 6474 | csrRoamIsCCXAssoc(pMac)) |
| 6475 | { |
| 6476 | // Now serialize the reassoc command. |
| 6477 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 6478 | } |
| 6479 | else |
| 6480 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6481 | #ifdef FEATURE_WLAN_LFR |
| 6482 | if (csrRoamIsHandoffInProgress(pMac) && |
| 6483 | csrRoamIsFastRoamEnabled(pMac)) |
| 6484 | { |
| 6485 | // Now serialize the reassoc command. |
| 6486 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 6487 | } |
| 6488 | else |
| 6489 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6490 | // else we are not connected and attempting to Join. Issue the |
| 6491 | // Join request. |
| 6492 | { |
| 6493 | status = csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 6494 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), |
| 6495 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ); |
| 6496 | } |
| 6497 | if(!HAL_STATUS_SUCCESS(status)) |
| 6498 | { |
| 6499 | //try something else |
| 6500 | csrRoam( pMac, pCommand ); |
| 6501 | } |
| 6502 | } |
| 6503 | if( !pScanResult->Result.pvIes ) |
| 6504 | { |
| 6505 | //Locally allocated |
| 6506 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 6507 | } |
| 6508 | } |
| 6509 | }//if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 6510 | else |
| 6511 | { |
| 6512 | smsLog(pMac, LOGW, FL(" found BSSType mismatching the one in BSS description\n")); |
| 6513 | } |
| 6514 | }//else |
| 6515 | }//if ( WNI_CFG_SUCCESS == result ) |
| 6516 | else |
| 6517 | { |
| 6518 | // In the event the configuration failed, for infra let the roam processor |
| 6519 | //attempt to join something else... |
| 6520 | if( pCommand->u.roamCmd.pRoamBssEntry && CSR_IS_INFRASTRUCTURE( &pCommand->u.roamCmd.roamProfile ) ) |
| 6521 | { |
| 6522 | csrRoam(pMac, pCommand); |
| 6523 | } |
| 6524 | else |
| 6525 | { |
| 6526 | //We need to complete the command |
| 6527 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) ) |
| 6528 | { |
| 6529 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 6530 | } |
| 6531 | else |
| 6532 | { |
| 6533 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6534 | } |
| 6535 | } |
| 6536 | } |
| 6537 | }//we have active entry |
| 6538 | } |
| 6539 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6540 | static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp ) |
| 6541 | { |
| 6542 | //No one is sending eWNI_SME_AUTH_REQ to PE. |
| 6543 | smsLog(pMac, LOGW, FL("is no-op\n")); |
| 6544 | if ( eSIR_SME_SUCCESS == pSmeAuthRsp->statusCode ) |
| 6545 | { |
| 6546 | smsLog( pMac, LOGW, "CSR SmeAuthReq Successful\n" ); |
| 6547 | // Successfully authenticated with a new Bss. Attempt to stop the current Bss and |
| 6548 | // join the new one... |
| 6549 | /***pBssDesc = profGetRoamingBssDesc( pAdapter, &pHddProfile ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6550 | roamStopNetwork( pAdapter, &pBssDesc->SirBssDescription );***/ |
| 6551 | } |
| 6552 | else { |
| 6553 | smsLog( pMac, LOGW, "CSR SmeAuthReq failed with statusCode= 0x%08lX [%d]\n", pSmeAuthRsp->statusCode, pSmeAuthRsp->statusCode ); |
| 6554 | /***profHandleLostLinkAfterReset(pAdapter); |
| 6555 | // In the event the authenticate fails, let the roam processor attempt to join something else... |
| 6556 | roamRoam( pAdapter );***/ |
| 6557 | } |
| 6558 | } |
| 6559 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6560 | static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSmeJoinRsp pSmeJoinRsp ) |
| 6561 | { |
| 6562 | eCsrRoamCompleteResult result; |
| 6563 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 6564 | tCsrRoamInfo roamInfo; |
| 6565 | tANI_U32 roamId = 0; |
| 6566 | |
| 6567 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 6568 | { |
| 6569 | smsLog( pMac, LOGW, "CSR SmeReassocReq Successful\n" ); |
| 6570 | result = eCsrReassocSuccess; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6571 | /* Defeaturize this part later if needed */ |
| 6572 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 6573 | /* Since the neighbor roam algorithm uses reassoc req for handoff instead of join, |
| 6574 | * we need the response contents while processing the result in csrRoamProcessResults() */ |
| 6575 | if (csrRoamIsHandoffInProgress(pMac)) |
| 6576 | { |
| 6577 | /* Need to dig more on indicating events to SME QoS module */ |
| 6578 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 6579 | csrRoamComplete( pMac, result, pSmeJoinRsp); |
| 6580 | } |
| 6581 | else |
| 6582 | #endif |
| 6583 | { |
| 6584 | csrRoamComplete( pMac, result, NULL ); |
| 6585 | } |
| 6586 | } |
| 6587 | /* Should we handle this similar to handling the join failure? Is it ok |
| 6588 | * to call csrRoamComplete() with state as CsrJoinFailure */ |
| 6589 | else |
| 6590 | { |
| 6591 | smsLog( pMac, LOGW, "CSR SmeReassocReq failed with statusCode= 0x%08lX [%d]\n", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); |
| 6592 | result = eCsrReassocFailure; |
| 6593 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6594 | if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) || |
| 6595 | (eSIR_SME_FT_REASSOC_FAILURE == pSmeJoinRsp->statusCode)) |
| 6596 | { |
| 6597 | // Inform HDD to turn off FT flag in HDD |
| 6598 | if (pNeighborRoamInfo) |
| 6599 | { |
| 6600 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 6601 | csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, |
| 6602 | &roamInfo, roamId, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
| 6603 | } |
| 6604 | } |
| 6605 | #endif |
| 6606 | // In the event that the Reassociation fails, then we need to Disassociate the current association and keep |
| 6607 | // roaming. Note that we will attempt to Join the AP instead of a Reassoc since we may have attempted a |
| 6608 | // 'Reassoc to self', which AP's that don't support Reassoc will force a Disassoc. |
| 6609 | //The disassoc rsp message will remove the command from active list |
| 6610 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, pSmeJoinRsp->sessionId, |
| 6611 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE ))) |
| 6612 | { |
| 6613 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 6614 | } |
| 6615 | } |
| 6616 | } |
| 6617 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6618 | static void csrRoamRoamingStateStopBssRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSmeRsp) |
| 6619 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6620 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 6621 | { |
| 6622 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6623 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 6624 | if(pIbssLog) |
| 6625 | { |
| 6626 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_RSP; |
| 6627 | if(eSIR_SME_SUCCESS != pSmeRsp->statusCode) |
| 6628 | { |
| 6629 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 6630 | } |
| 6631 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 6632 | } |
| 6633 | } |
| 6634 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6635 | pMac->roam.roamSession[pSmeRsp->sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 6636 | if(CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, pSmeRsp->sessionId)) |
| 6637 | { |
| 6638 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6639 | } |
| 6640 | else if(CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId)) |
| 6641 | { |
| 6642 | csrRoamReissueRoamCommand(pMac); |
| 6643 | } |
| 6644 | } |
| 6645 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6646 | void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeRsp ) |
| 6647 | { |
| 6648 | tSirResultCodes statusCode; |
| 6649 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 6650 | tScanResultHandle hBSSList; |
| 6651 | tANI_BOOLEAN fCallCallback, fRemoveCmd; |
| 6652 | eHalStatus status; |
| 6653 | tCsrRoamInfo roamInfo; |
| 6654 | tCsrScanResultFilter *pScanFilter = NULL; |
| 6655 | tANI_U32 roamId = 0; |
| 6656 | tCsrRoamProfile *pCurRoamProfile = NULL; |
| 6657 | tListElem *pEntry = NULL; |
| 6658 | tSmeCmd *pCommand = NULL; |
| 6659 | #endif |
| 6660 | tANI_U32 sessionId; |
| 6661 | tCsrRoamSession *pSession; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 6662 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6663 | tSirSmeDisassocRsp SmeDisassocRsp; |
| 6664 | |
| 6665 | csrSerDesUnpackDiassocRsp((tANI_U8 *)pSmeRsp, &SmeDisassocRsp); |
| 6666 | sessionId = SmeDisassocRsp.sessionId; |
| 6667 | statusCode = SmeDisassocRsp.statusCode; |
| 6668 | |
| 6669 | smsLog( pMac, LOG2, "csrRoamRoamingStateDisassocRspProcessor sessionId %d\n", sessionId); |
| 6670 | |
| 6671 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6672 | { |
| 6673 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 6674 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6675 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 6676 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) ) |
| 6677 | { |
| 6678 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6679 | } |
| 6680 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, sessionId ) || |
| 6681 | CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, sessionId ) ) |
| 6682 | { |
| 6683 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 6684 | { |
| 6685 | smsLog( pMac, LOG2, "CSR SmeDisassocReq force disassociated Successfully\n" ); |
| 6686 | //A callback to HDD will be issued from csrRoamComplete so no need to do anything here |
| 6687 | } |
| 6688 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6689 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6690 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId ) ) |
| 6691 | { |
| 6692 | smsLog( pMac, LOGE, "CSR SmeDisassocReq due to HO\n" ); |
| 6693 | #if defined (WLAN_FEATURE_NEIGHBOR_ROAMING) |
| 6694 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 6695 | if ( pEntry ) |
| 6696 | { |
| 6697 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6698 | // If the head of the queue is Active and it is a ROAM command, remove |
| 6699 | // and put this on the Free queue. |
| 6700 | if ( eSmeCommandRoam == pCommand->command ) |
| 6701 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 6702 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6703 | //we need to process the result first before removing it from active list because state changes |
| 6704 | //still happening insides roamQProcessRoamResults so no other roam command should be issued |
| 6705 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 6706 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 6707 | { |
| 6708 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 6709 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 6710 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6711 | if( fRemoveCmd ) |
| 6712 | { |
| 6713 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6714 | } |
| 6715 | else |
| 6716 | { |
| 6717 | smsLog( pMac, LOGE, " ********csrRoamRoamingStateDisassocRspProcessor fail to remove cmd reason %d\n", |
| 6718 | pCommand->u.roamCmd.roamReason ); |
| 6719 | } |
| 6720 | } |
| 6721 | else |
| 6722 | { |
| 6723 | smsLog( pMac, LOGW, "CSR: Roam Completion called but ROAM command is not ACTIVE ...\n" ); |
| 6724 | } |
| 6725 | } |
| 6726 | else |
| 6727 | { |
| 6728 | smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ...\n" ); |
| 6729 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6730 | //notify HDD for handoff, providing the BSSID too |
| 6731 | roamInfo.reasonCode = eCsrRoamReasonBetterAP; |
| 6732 | |
| 6733 | palCopyMemory(pMac->hHdd, roamInfo.bssid, pMac->roam.neighborRoamInfo.csrNeighborRoamProfile.BSSIDs.bssid, sizeof(tSirMacAddr)); |
| 6734 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 6735 | csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6736 | |
| 6737 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6738 | if(HAL_STATUS_SUCCESS(status)) |
| 6739 | { |
| 6740 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6741 | status = csrRoamPrepareFilterFromProfile(pMac, &pMac->roam.neighborRoamInfo.csrNeighborRoamProfile, pScanFilter); |
| 6742 | if(!HAL_STATUS_SUCCESS(status)) |
| 6743 | { |
| 6744 | smsLog(pMac, LOGE, FL(" csrRoamPrepareFilterFromProfile fail to create scan filter\n")); |
| 6745 | } |
| 6746 | |
| 6747 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 6748 | if(HAL_STATUS_SUCCESS(status)) |
| 6749 | { |
| 6750 | //copy over the connected profile to apply the same for this connection as well |
| 6751 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pCurRoamProfile, sizeof(tCsrRoamProfile)))) |
| 6752 | { |
| 6753 | palZeroMemory(pMac->hHdd, pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 6754 | csrRoamCopyProfile(pMac, pCurRoamProfile, pSession->pCurRoamProfile); |
| 6755 | } |
| 6756 | //make sure to put it at the head of the cmd queue |
| 6757 | status = csrRoamIssueConnect(pMac, sessionId, pCurRoamProfile, |
| 6758 | hBSSList, eCsrSmeIssuedAssocToSimilarAP, |
| 6759 | roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE); |
| 6760 | if(!HAL_STATUS_SUCCESS(status)) |
| 6761 | { |
| 6762 | //msg |
| 6763 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6764 | } |
| 6765 | /* Notify sub-modules like QoS etc. that handoff happening */ |
| 6766 | sme_QosCsrEventInd(pMac, sessionId, SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL); |
| 6767 | palFreeMemory(pMac->hHdd, pCurRoamProfile); |
| 6768 | } |
| 6769 | else |
| 6770 | { |
| 6771 | //msg |
| 6772 | smsLog( pMac, LOGE,"csrRoamRoamingStateDisassocRspProcessor: csrScanGetResult failed"); |
| 6773 | // should have asserted, sending up roam complete instead. Let upper layer |
| 6774 | // decide what to do next |
| 6775 | csrCallRoamingCompletionCallback(pMac, pSession, &roamInfo, 0, eCSR_ROAM_RESULT_FAILURE); |
| 6776 | } |
| 6777 | } |
| 6778 | else |
| 6779 | { |
| 6780 | smsLog(pMac, LOGE, FL(" fail to allocate memory for scan filter\n")); |
| 6781 | csrCallRoamingCompletionCallback(pMac, pSession, &roamInfo, 0, eCSR_ROAM_RESULT_FAILURE); |
| 6782 | } |
| 6783 | if( pScanFilter ) |
| 6784 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 6785 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6786 | csrFreeScanFilter(pMac, pScanFilter); |
| 6787 | palFreeMemory( pMac->hHdd, pScanFilter ); |
| 6788 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6789 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 6790 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6791 | } //else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) ) |
| 6792 | else if ( CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, sessionId ) ) |
| 6793 | { |
| 6794 | // Disassoc due to Reassoc failure falls into this codepath.... |
| 6795 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 6796 | } |
| 6797 | else |
| 6798 | { |
| 6799 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 6800 | { |
| 6801 | // Successfully disassociated from the 'old' Bss... |
| 6802 | // |
| 6803 | // We get Disassociate response in three conditions. |
| 6804 | // - First is the case where we are disasociating from an Infra Bss to start an IBSS. |
| 6805 | // - Second is the when we are disassociating from an Infra Bss to join an IBSS or a new |
| 6806 | // Infrastructure network. |
| 6807 | // - Third is where we are doing an Infra to Infra roam between networks with different |
| 6808 | // SSIDs. In all cases, we set the new Bss configuration here and attempt to join |
| 6809 | |
| 6810 | smsLog( pMac, LOG2, "CSR SmeDisassocReq disassociated Successfully\n" ); |
| 6811 | } |
| 6812 | else |
| 6813 | { |
| 6814 | smsLog( pMac, LOGE, "SmeDisassocReq failed with statusCode= 0x%08lX\n", statusCode ); |
| 6815 | } |
| 6816 | //We are not done yet. Get the data and continue roaming |
| 6817 | csrRoamReissueRoamCommand(pMac); |
| 6818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6819 | } |
| 6820 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6821 | static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp ) |
| 6822 | { |
| 6823 | tSirResultCodes statusCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6824 | //No one is sending eWNI_SME_DEAUTH_REQ to PE. |
| 6825 | smsLog(pMac, LOGW, FL("is no-op\n")); |
| 6826 | statusCode = csrGetDeAuthRspStatusCode( pSmeRsp ); |
| 6827 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 6828 | { |
| 6829 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6830 | } |
| 6831 | else |
| 6832 | { |
| 6833 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 6834 | { |
| 6835 | // Successfully deauth from the 'old' Bss... |
| 6836 | // |
| 6837 | smsLog( pMac, LOG2, "CSR SmeDeauthReq disassociated Successfully\n" ); |
| 6838 | } |
| 6839 | else |
| 6840 | { |
| 6841 | smsLog( pMac, LOGW, "SmeDeauthReq failed with statusCode= 0x%08lX\n", statusCode ); |
| 6842 | } |
| 6843 | //We are not done yet. Get the data and continue roaming |
| 6844 | csrRoamReissueRoamCommand(pMac); |
| 6845 | } |
| 6846 | } |
| 6847 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6848 | static void csrRoamRoamingStateStartBssRspProcessor( tpAniSirGlobal pMac, tSirSmeStartBssRsp *pSmeStartBssRsp ) |
| 6849 | { |
| 6850 | eCsrRoamCompleteResult result; |
| 6851 | |
| 6852 | if ( eSIR_SME_SUCCESS == pSmeStartBssRsp->statusCode ) |
| 6853 | { |
| 6854 | smsLog( pMac, LOGW, "SmeStartBssReq Successful\n" ); |
| 6855 | result = eCsrStartBssSuccess; |
| 6856 | } |
| 6857 | else |
| 6858 | { |
| 6859 | smsLog( pMac, LOGW, "SmeStartBssReq failed with statusCode= 0x%08lX\n", pSmeStartBssRsp->statusCode ); |
| 6860 | //Let csrRoamComplete decide what to do |
| 6861 | result = eCsrStartBssFailure; |
| 6862 | } |
| 6863 | #ifdef WLAN_SOFTAP_FEATURE |
| 6864 | csrRoamComplete( pMac, result, pSmeStartBssRsp); |
| 6865 | #else |
| 6866 | csrRoamComplete( pMac, result, &pSmeStartBssRsp->bssDescription ); |
| 6867 | #endif |
| 6868 | } |
| 6869 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6870 | /* |
| 6871 | We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of strucutres. |
| 6872 | It depends on how the message is constructed. If the message is sent by limSendSmeRsp, |
| 6873 | the pMsgBuf is only a generic response and can only be used as pointer to tSirSmeRsp. |
| 6874 | For the messages where sender allocates memory for specific structures, then it can be |
| 6875 | cast accordingly. |
| 6876 | */ |
| 6877 | void csrRoamingStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 6878 | { |
| 6879 | tSirSmeRsp *pSmeRsp; |
| 6880 | tSmeIbssPeerInd *pIbssPeerInd; |
| 6881 | tCsrRoamInfo roamInfo; |
| 6882 | // TODO Session Id need to be acquired in this function |
| 6883 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6884 | pSmeRsp = (tSirSmeRsp *)pMsgBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6885 | smsLog( pMac, LOG2, "Message %d[0x%04X] received in substate %d\n", |
| 6886 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 6887 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
| 6888 | #if defined ANI_PRODUCT_TYPE_AP |
| 6889 | pSmeRsp->messageType = pal_be16_to_cpu(pSmeRsp->messageType); |
| 6890 | pSmeRsp->length = pal_be16_to_cpu(pSmeRsp->length); |
| 6891 | pSmeRsp->statusCode = pal_be32_to_cpu(pSmeRsp->statusCode); |
| 6892 | #else |
| 6893 | pSmeRsp->messageType = (pSmeRsp->messageType); |
| 6894 | pSmeRsp->length = (pSmeRsp->length); |
| 6895 | pSmeRsp->statusCode = (pSmeRsp->statusCode); |
| 6896 | #endif |
| 6897 | switch (pSmeRsp->messageType) |
| 6898 | { |
| 6899 | |
| 6900 | case eWNI_SME_JOIN_RSP: // in Roaming state, process the Join response message... |
| 6901 | if (CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, pSmeRsp->sessionId)) |
| 6902 | { |
| 6903 | //We sent a JOIN_REQ |
| 6904 | csrRoamJoinRspProcessor( pMac, (tSirSmeJoinRsp *)pSmeRsp ); |
| 6905 | } |
| 6906 | break; |
| 6907 | |
| 6908 | case eWNI_SME_AUTH_RSP: // or the Authenticate response message... |
| 6909 | if (CSR_IS_ROAM_SUBSTATE_AUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 6910 | { |
| 6911 | //We sent a AUTH_REQ |
| 6912 | csrRoamRoamingStateAuthRspProcessor( pMac, (tSirSmeAuthRsp *)pSmeRsp ); |
| 6913 | } |
| 6914 | break; |
| 6915 | |
| 6916 | case eWNI_SME_REASSOC_RSP: // or the Reassociation response message... |
| 6917 | if (CSR_IS_ROAM_SUBSTATE_REASSOC_REQ( pMac, pSmeRsp->sessionId) ) |
| 6918 | { |
| 6919 | csrRoamRoamingStateReassocRspProcessor( pMac, (tpSirSmeJoinRsp )pSmeRsp ); |
| 6920 | } |
| 6921 | break; |
| 6922 | |
| 6923 | case eWNI_SME_STOP_BSS_RSP: // or the Stop Bss response message... |
| 6924 | { |
| 6925 | csrRoamRoamingStateStopBssRspProcessor(pMac, pSmeRsp); |
| 6926 | } |
| 6927 | break; |
| 6928 | |
| 6929 | case eWNI_SME_DISASSOC_RSP: // or the Disassociate response message... |
| 6930 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, pSmeRsp->sessionId ) || |
| 6931 | CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, pSmeRsp->sessionId ) || |
| 6932 | CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, pSmeRsp->sessionId ) || |
| 6933 | CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, pSmeRsp->sessionId ) || |
| 6934 | CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId ) || |
| 6935 | //HO |
| 6936 | CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, pSmeRsp->sessionId ) ) |
| 6937 | { |
| 6938 | smsLog(pMac, LOGE, FL("eWNI_SME_DISASSOC_RSP subState = %d\n"), pMac->roam.curSubState[pSmeRsp->sessionId]); |
| 6939 | csrRoamRoamingStateDisassocRspProcessor( pMac, (tSirSmeDisassocRsp *)pSmeRsp ); |
| 6940 | } |
| 6941 | break; |
| 6942 | |
| 6943 | case eWNI_SME_DEAUTH_RSP: // or the Deauthentication response message... |
| 6944 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId ) ) |
| 6945 | { |
| 6946 | csrRoamRoamingStateDeauthRspProcessor( pMac, (tSirSmeDeauthRsp *)pSmeRsp ); |
| 6947 | } |
| 6948 | break; |
| 6949 | |
| 6950 | case eWNI_SME_START_BSS_RSP: // or the Start BSS response message... |
| 6951 | if (CSR_IS_ROAM_SUBSTATE_START_BSS_REQ( pMac, pSmeRsp->sessionId ) ) |
| 6952 | { |
| 6953 | csrRoamRoamingStateStartBssRspProcessor( pMac, (tSirSmeStartBssRsp *)pSmeRsp ); |
| 6954 | } |
| 6955 | break; |
| 6956 | |
| 6957 | case WNI_CFG_SET_CNF: // process the Config Confirm messages when we are in 'Config' substate... |
| 6958 | if ( CSR_IS_ROAM_SUBSTATE_CONFIG( pMac, pSmeRsp->sessionId ) ) |
| 6959 | { |
| 6960 | csrRoamingStateConfigCnfProcessor( pMac, ((tCsrCfgSetRsp *)pSmeRsp)->respStatus ); |
| 6961 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6962 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6963 | //In case CSR issues STOP_BSS, we need to tell HDD about peer departed becasue PE is removing them |
| 6964 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 6965 | pIbssPeerInd = (tSmeIbssPeerInd*)pSmeRsp; |
| 6966 | smsLog(pMac, LOGE, "CSR: Peer departed notification from LIM in joining state\n"); |
| 6967 | palZeroMemory( pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo) ); |
| 6968 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 6969 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 6970 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 6971 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 6972 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 6973 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 6974 | eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 6975 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6976 | default: |
| 6977 | smsLog( pMac, LOG1, "Unexpected message type = %d[0x%X] received in substate %d\n", |
| 6978 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 6979 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
| 6980 | |
| 6981 | //If we are connected, check the link status change |
| 6982 | if(!csrIsConnStateDisconnected(pMac, sessionId)) |
| 6983 | { |
| 6984 | csrRoamCheckForLinkStatusChange( pMac, pSmeRsp ); |
| 6985 | } |
| 6986 | break; |
| 6987 | } |
| 6988 | } |
| 6989 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6990 | void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 6991 | { |
| 6992 | tSirSmeRsp *pSirMsg = (tSirSmeRsp *)pMsgBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6993 | switch (pSirMsg->messageType) |
| 6994 | { |
| 6995 | case eWNI_SME_GET_STATISTICS_RSP: |
| 6996 | smsLog( pMac, LOGW, FL("Stats rsp from PE\n")); |
| 6997 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 6998 | break; |
| 6999 | #ifdef WLAN_SOFTAP_FEATURE |
| 7000 | case eWNI_SME_UPPER_LAYER_ASSOC_CNF: |
| 7001 | { |
| 7002 | tCsrRoamSession *pSession; |
| 7003 | tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf; |
| 7004 | tCsrRoamInfo roamInfo; |
| 7005 | tCsrRoamInfo *pRoamInfo = NULL; |
| 7006 | tANI_U32 sessionId; |
| 7007 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7008 | smsLog( pMac, LOG1, FL("ASSOCIATION confirmation can be given to upper layer \n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7009 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 7010 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7011 | pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf; |
| 7012 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId ); |
| 7013 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7014 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 7015 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7016 | pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid; |
| 7017 | pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length; |
| 7018 | pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7019 | pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length; |
| 7020 | pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7021 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, sizeof(tSirMacAddr)); |
| 7022 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7023 | pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7024 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) ) |
| 7025 | { |
| 7026 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED; |
| 7027 | pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq; |
| 7028 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 7029 | } |
| 7030 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 7031 | { |
| 7032 | vos_sleep( 100 ); |
| 7033 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta |
| 7034 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
| 7035 | } |
| 7036 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7037 | } |
| 7038 | break; |
| 7039 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7040 | default: |
| 7041 | csrRoamCheckForLinkStatusChange( pMac, pSirMsg ); |
| 7042 | break; |
| 7043 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7044 | } |
| 7045 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7046 | eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, |
| 7047 | tSirBssDescription *pBssDescription, |
| 7048 | tSirMacAddr *bssId, tANI_BOOLEAN addKey, |
| 7049 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 7050 | tANI_U8 keyId, tANI_U16 keyLength, |
| 7051 | tANI_U8 *pKey, tANI_U8 paeRole ) |
| 7052 | { |
| 7053 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7054 | tAniEdType edType; |
| 7055 | |
| 7056 | if(eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType) |
| 7057 | { |
| 7058 | EncryptType = eCSR_ENCRYPT_TYPE_NONE; //*** |
| 7059 | } |
| 7060 | |
| 7061 | edType = csrTranslateEncryptTypeToEdType( EncryptType ); |
| 7062 | |
| 7063 | // Allow 0 keys to be set for the non-WPA encrypt types... For WPA encrypt types, the num keys must be non-zero |
| 7064 | // or LIM will reject the set context (assumes the SET_CONTEXT does not occur until the keys are distrubuted). |
| 7065 | if ( CSR_IS_ENC_TYPE_STATIC( EncryptType ) || |
| 7066 | addKey ) |
| 7067 | { |
| 7068 | tCsrRoamSetKey setKey; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7069 | setKey.encType = EncryptType; |
| 7070 | setKey.keyDirection = aniKeyDirection; //Tx, Rx or Tx-and-Rx |
| 7071 | palCopyMemory( pMac->hHdd, &setKey.peerMac, bssId, sizeof(tCsrBssid) ); |
| 7072 | setKey.paeRole = paeRole; //0 for supplicant |
| 7073 | setKey.keyId = keyId; // Kye index |
| 7074 | setKey.keyLength = keyLength; |
| 7075 | if( keyLength ) |
| 7076 | { |
| 7077 | palCopyMemory( pMac->hHdd, setKey.Key, pKey, keyLength ); |
| 7078 | } |
| 7079 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, &setKey, 0 ); |
| 7080 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7081 | return (status); |
| 7082 | } |
| 7083 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7084 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 7085 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 7086 | { |
| 7087 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 7088 | tSmeCmd *pCommand = NULL; |
| 7089 | #ifdef FEATURE_WLAN_CCX |
| 7090 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7091 | #endif /* FEATURE_WLAN_CCX */ |
| 7092 | |
| 7093 | do |
| 7094 | { |
| 7095 | pCommand = csrGetCommandBuffer(pMac); |
| 7096 | if(NULL == pCommand) |
| 7097 | { |
| 7098 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 7099 | status = eHAL_STATUS_RESOURCES; |
| 7100 | break; |
| 7101 | } |
| 7102 | pCommand->command = eSmeCommandSetKey; |
| 7103 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7104 | // validate the key length, Adjust if too long... |
| 7105 | // for static WEP the keys are not set thru' SetContextReq |
| 7106 | if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || |
| 7107 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ) ) |
| 7108 | { |
| 7109 | //KeyLength maybe 0 for static WEP |
| 7110 | if( pSetKey->keyLength ) |
| 7111 | { |
| 7112 | if ( pSetKey->keyLength < CSR_WEP40_KEY_LEN ) |
| 7113 | { |
| 7114 | smsLog( pMac, LOGW, "Invalid WEP40 keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7115 | break; |
| 7116 | } |
| 7117 | |
| 7118 | pCommand->u.setKeyCmd.keyLength = CSR_WEP40_KEY_LEN; |
| 7119 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP40_KEY_LEN ); |
| 7120 | } |
| 7121 | } |
| 7122 | else if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || |
| 7123 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ) ) |
| 7124 | { |
| 7125 | //KeyLength maybe 0 for static WEP |
| 7126 | if( pSetKey->keyLength ) |
| 7127 | { |
| 7128 | if ( pSetKey->keyLength < CSR_WEP104_KEY_LEN ) |
| 7129 | { |
| 7130 | smsLog( pMac, LOGW, "Invalid WEP104 keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7131 | break; |
| 7132 | } |
| 7133 | |
| 7134 | pCommand->u.setKeyCmd.keyLength = CSR_WEP104_KEY_LEN; |
| 7135 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP104_KEY_LEN ); |
| 7136 | } |
| 7137 | } |
| 7138 | else if ( eCSR_ENCRYPT_TYPE_TKIP == pSetKey->encType ) |
| 7139 | { |
| 7140 | if ( pSetKey->keyLength < CSR_TKIP_KEY_LEN ) |
| 7141 | { |
| 7142 | smsLog( pMac, LOGW, "Invalid TKIP keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7143 | break; |
| 7144 | } |
| 7145 | pCommand->u.setKeyCmd.keyLength = CSR_TKIP_KEY_LEN; |
| 7146 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_TKIP_KEY_LEN ); |
| 7147 | } |
| 7148 | else if ( eCSR_ENCRYPT_TYPE_AES == pSetKey->encType ) |
| 7149 | { |
| 7150 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 7151 | { |
| 7152 | smsLog( pMac, LOGW, "Invalid AES/CCMP keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7153 | break; |
| 7154 | } |
| 7155 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
| 7156 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN ); |
| 7157 | } |
| 7158 | #ifdef FEATURE_WLAN_WAPI |
| 7159 | else if ( eCSR_ENCRYPT_TYPE_WPI == pSetKey->encType ) |
| 7160 | { |
| 7161 | if ( pSetKey->keyLength < CSR_WAPI_KEY_LEN ) |
| 7162 | { |
| 7163 | smsLog( pMac, LOGW, "Invalid WAPI keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7164 | break; |
| 7165 | } |
| 7166 | pCommand->u.setKeyCmd.keyLength = CSR_WAPI_KEY_LEN; |
| 7167 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WAPI_KEY_LEN ); |
| 7168 | } |
| 7169 | #endif /* FEATURE_WLAN_WAPI */ |
| 7170 | #ifdef FEATURE_WLAN_CCX |
| 7171 | else if ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 7172 | { |
| 7173 | if ( pSetKey->keyLength < CSR_KRK_KEY_LEN ) |
| 7174 | { |
| 7175 | smsLog( pMac, LOGW, "Invalid KRK keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7176 | break; |
| 7177 | } |
| 7178 | palCopyMemory( pMac->hHdd, pSession->ccxCckmInfo.krk, pSetKey->Key, CSR_KRK_KEY_LEN ); |
| 7179 | pSession->ccxCckmInfo.reassoc_req_num=1; |
| 7180 | pSession->ccxCckmInfo.krk_plumbed = eANI_BOOLEAN_TRUE; |
| 7181 | status = eHAL_STATUS_SUCCESS; |
| 7182 | break; |
| 7183 | } |
| 7184 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 7185 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7186 | #ifdef WLAN_FEATURE_11W |
| 7187 | //Check for 11w BIP |
| 7188 | else if ( eCSR_ENCRYPT_TYPE_AES_CMAC == pSetKey->encType ) |
| 7189 | { |
| 7190 | tANI_U16 count = 0; |
| 7191 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 7192 | { |
| 7193 | smsLog( pMac, LOGW, "Invalid AES/CCMP keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7194 | break; |
| 7195 | } |
| 7196 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
| 7197 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN ); |
| 7198 | } |
| 7199 | #endif |
| 7200 | status = eHAL_STATUS_SUCCESS; |
| 7201 | pCommand->u.setKeyCmd.roamId = roamId; |
| 7202 | pCommand->u.setKeyCmd.encType = pSetKey->encType; |
| 7203 | pCommand->u.setKeyCmd.keyDirection = pSetKey->keyDirection; //Tx, Rx or Tx-and-Rx |
| 7204 | palCopyMemory( pMac->hHdd, &pCommand->u.setKeyCmd.peerMac, &pSetKey->peerMac, sizeof(tCsrBssid) ); |
| 7205 | pCommand->u.setKeyCmd.paeRole = pSetKey->paeRole; //0 for supplicant |
| 7206 | pCommand->u.setKeyCmd.keyId = pSetKey->keyId; |
| 7207 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.keyRsc, pSetKey->keyRsc, CSR_MAX_RSC_LEN ); |
| 7208 | //Always put set key to the head of the Q because it is the only thing to get executed in case of WT_KEY state |
| 7209 | |
| 7210 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 7211 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7212 | { |
| 7213 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 7214 | } |
| 7215 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7216 | // Free the command if there has been a failure, or it is a |
| 7217 | // "local" operation like the set CCX CCKM KRK key. |
| 7218 | if( (!HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand )) |
| 7219 | #ifdef FEATURE_WLAN_CCX |
| 7220 | || ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 7221 | #endif /* FEATURE_WLAN_CCX */ |
| 7222 | ) |
| 7223 | { |
| 7224 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 7225 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7226 | return( status ); |
| 7227 | } |
| 7228 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7229 | eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 7230 | tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId ) |
| 7231 | { |
| 7232 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 7233 | tSmeCmd *pCommand = NULL; |
| 7234 | tANI_BOOLEAN fImediate = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7235 | do |
| 7236 | { |
| 7237 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 7238 | { |
| 7239 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key\n") ); |
| 7240 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 7241 | break; |
| 7242 | } |
| 7243 | pCommand = csrGetCommandBuffer(pMac); |
| 7244 | if(NULL == pCommand) |
| 7245 | { |
| 7246 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 7247 | status = eHAL_STATUS_RESOURCES; |
| 7248 | break; |
| 7249 | } |
| 7250 | pCommand->command = eSmeCommandRemoveKey; |
| 7251 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7252 | pCommand->u.removeKeyCmd.roamId = roamId; |
| 7253 | pCommand->u.removeKeyCmd.encType = pRemoveKey->encType; |
| 7254 | palCopyMemory( pMac->hHdd, &pCommand->u.removeKeyCmd.peerMac, &pRemoveKey->peerMac, sizeof(tSirMacAddr) ); |
| 7255 | pCommand->u.removeKeyCmd.keyId = pRemoveKey->keyId; |
| 7256 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7257 | { |
| 7258 | //in this case, put it to the end of the Q incase there is a set key pending. |
| 7259 | fImediate = eANI_BOOLEAN_FALSE; |
| 7260 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7261 | smsLog( pMac, LOGE, FL("keyType=%d, keyId=%d, PeerMac=%02x, %02x, %02x, %02x, %02x, %02x\n"), |
| 7262 | pRemoveKey->encType, pRemoveKey->keyId, |
| 7263 | pCommand->u.removeKeyCmd.peerMac[0], |
| 7264 | pCommand->u.removeKeyCmd.peerMac[1], |
| 7265 | pCommand->u.removeKeyCmd.peerMac[2], |
| 7266 | pCommand->u.removeKeyCmd.peerMac[3], |
| 7267 | pCommand->u.removeKeyCmd.peerMac[4], |
| 7268 | pCommand->u.removeKeyCmd.peerMac[5]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7269 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 7270 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7271 | { |
| 7272 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 7273 | break; |
| 7274 | } |
| 7275 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7276 | if( !HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand ) ) |
| 7277 | { |
| 7278 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 7279 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7280 | return (status ); |
| 7281 | } |
| 7282 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7283 | eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 7284 | { |
| 7285 | eHalStatus status; |
| 7286 | tANI_U8 numKeys = ( pCommand->u.setKeyCmd.keyLength ) ? 1 : 0; |
| 7287 | tAniEdType edType = csrTranslateEncryptTypeToEdType( pCommand->u.setKeyCmd.encType ); |
| 7288 | tANI_BOOLEAN fUnicast = ( pCommand->u.setKeyCmd.peerMac[0] == 0xFF ) ? eANI_BOOLEAN_FALSE : eANI_BOOLEAN_TRUE; |
| 7289 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7290 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7291 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7292 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7293 | if(eCSR_ENCRYPT_TYPE_NONE != edType) |
| 7294 | { |
| 7295 | palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 7296 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 7297 | { |
| 7298 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ; |
| 7299 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 7300 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 7301 | } |
| 7302 | else |
| 7303 | { |
| 7304 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_REQ; |
| 7305 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 7306 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 7307 | } |
| 7308 | palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 7309 | if(CSR_IS_ENC_TYPE_STATIC(edType)) |
| 7310 | { |
| 7311 | tANI_U32 defKeyId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7312 | //It has to be static WEP here |
| 7313 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, &defKeyId))) |
| 7314 | { |
| 7315 | setKeyEvent.keyId = (v_U8_t)defKeyId; |
| 7316 | } |
| 7317 | } |
| 7318 | else |
| 7319 | { |
| 7320 | setKeyEvent.keyId = pCommand->u.setKeyCmd.keyId; |
| 7321 | } |
| 7322 | setKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 7323 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 7324 | } |
| 7325 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7326 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 7327 | { |
| 7328 | status = csrSendMBSetContextReqMsg( pMac, sessionId, |
| 7329 | ( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac, |
| 7330 | numKeys, edType, fUnicast, pCommand->u.setKeyCmd.keyDirection, |
| 7331 | pCommand->u.setKeyCmd.keyId, pCommand->u.setKeyCmd.keyLength, |
| 7332 | pCommand->u.setKeyCmd.Key, pCommand->u.setKeyCmd.paeRole, |
| 7333 | pCommand->u.setKeyCmd.keyRsc); |
| 7334 | } |
| 7335 | else |
| 7336 | { |
| 7337 | smsLog( pMac, LOGW, FL(" cannot process not connected\n") ); |
| 7338 | //Set this status so the error handling take care of the case. |
| 7339 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 7340 | } |
| 7341 | if( !HAL_STATUS_SUCCESS(status) ) |
| 7342 | { |
| 7343 | smsLog( pMac, LOGE, FL(" error status %d\n"), status ); |
| 7344 | csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.setKeyCmd.roamId, eCSR_ROAM_SET_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7345 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7346 | if(eCSR_ENCRYPT_TYPE_NONE != edType) |
| 7347 | { |
| 7348 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 7349 | { |
| 7350 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 7351 | } |
| 7352 | else |
| 7353 | { |
| 7354 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 7355 | } |
| 7356 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 7357 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 7358 | } |
| 7359 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7360 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7361 | return ( status ); |
| 7362 | } |
| 7363 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7364 | eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 7365 | { |
| 7366 | eHalStatus status; |
| 7367 | tpSirSmeRemoveKeyReq pMsg = NULL; |
| 7368 | tANI_U16 wMsgLen = sizeof(tSirSmeRemoveKeyReq); |
| 7369 | tANI_U8 *p; |
| 7370 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7371 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7372 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7373 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7374 | palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 7375 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_REQ; |
| 7376 | removeKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 7377 | removeKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 7378 | palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 7379 | removeKeyEvent.keyId = pCommand->u.removeKeyCmd.keyId; |
| 7380 | removeKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 7381 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 7382 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7383 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 7384 | { |
| 7385 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, wMsgLen ); |
| 7386 | } |
| 7387 | else |
| 7388 | { |
| 7389 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key\n") ); |
| 7390 | //Set the error status so error handling kicks in below |
| 7391 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 7392 | } |
| 7393 | if( HAL_STATUS_SUCCESS( status ) ) |
| 7394 | { |
| 7395 | palZeroMemory(pMac->hHdd, pMsg, wMsgLen); |
| 7396 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REMOVEKEY_REQ); |
| 7397 | pMsg->length = pal_cpu_to_be16(wMsgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7398 | pMsg->sessionId = (tANI_U8)sessionId; |
| 7399 | pMsg->transactionId = 0; |
| 7400 | p = (tANI_U8 *)pMsg + sizeof(pMsg->messageType) + sizeof(pMsg->length) + |
| 7401 | sizeof(pMsg->sessionId) + sizeof(pMsg->transactionId); |
| 7402 | // bssId - copy from session Info |
| 7403 | palCopyMemory( pMac->hHdd, p, &pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 7404 | p += sizeof(tSirMacAddr); |
| 7405 | // peerMacAddr |
| 7406 | palCopyMemory( pMac->hHdd, p, pCommand->u.removeKeyCmd.peerMac, sizeof(tSirMacAddr) ); |
| 7407 | p += sizeof(tSirMacAddr); |
| 7408 | // edType |
| 7409 | *p = (tANI_U8)csrTranslateEncryptTypeToEdType( pCommand->u.removeKeyCmd.encType ); |
| 7410 | p++; |
| 7411 | // weptype |
| 7412 | if( ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pCommand->u.removeKeyCmd.encType ) || |
| 7413 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pCommand->u.removeKeyCmd.encType ) ) |
| 7414 | { |
| 7415 | *p = (tANI_U8)eSIR_WEP_STATIC; |
| 7416 | } |
| 7417 | else |
| 7418 | { |
| 7419 | *p = (tANI_U8)eSIR_WEP_DYNAMIC; |
| 7420 | } |
| 7421 | p++; |
| 7422 | //keyid |
| 7423 | *p = pCommand->u.removeKeyCmd.keyId; |
| 7424 | p++; |
| 7425 | *p = (pCommand->u.removeKeyCmd.peerMac[0] == 0xFF ) ? 0 : 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7426 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 7427 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7428 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7429 | { |
| 7430 | smsLog( pMac, LOGE, FL(" error status \n"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7431 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7432 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
| 7433 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE;; |
| 7434 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 7435 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7436 | csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.removeKeyCmd.roamId, eCSR_ROAM_REMOVE_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE); |
| 7437 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7438 | return ( status ); |
| 7439 | } |
| 7440 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7441 | eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 7442 | { |
| 7443 | eHalStatus status; |
| 7444 | |
| 7445 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 7446 | { |
| 7447 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 7448 | } |
| 7449 | else |
| 7450 | { |
| 7451 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, pSetKey, roamId ); |
| 7452 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7453 | return ( status ); |
| 7454 | } |
| 7455 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7456 | /* |
| 7457 | Prepare a filter base on a profile for parsing the scan results. |
| 7458 | Upon successful return, caller MUST call csrFreeScanFilter on |
| 7459 | pScanFilter when it is done with the filter. |
| 7460 | */ |
| 7461 | eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 7462 | tCsrScanResultFilter *pScanFilter) |
| 7463 | { |
| 7464 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7465 | tANI_U32 size = 0; |
| 7466 | tANI_U8 index = 0; |
| 7467 | |
| 7468 | do |
| 7469 | { |
| 7470 | if(pProfile->BSSIDs.numOfBSSIDs) |
| 7471 | { |
| 7472 | size = sizeof(tCsrBssid) * pProfile->BSSIDs.numOfBSSIDs; |
| 7473 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, size); |
| 7474 | if(!HAL_STATUS_SUCCESS(status)) |
| 7475 | { |
| 7476 | break; |
| 7477 | } |
| 7478 | pScanFilter->BSSIDs.numOfBSSIDs = pProfile->BSSIDs.numOfBSSIDs; |
| 7479 | palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, pProfile->BSSIDs.bssid, size); |
| 7480 | } |
| 7481 | if(pProfile->SSIDs.numOfSSIDs) |
| 7482 | { |
| 7483 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 7484 | { |
| 7485 | pScanFilter->SSIDs.numOfSSIDs = pProfile->SSIDs.numOfSSIDs; |
| 7486 | } |
| 7487 | else |
| 7488 | { |
| 7489 | //For WDS station |
| 7490 | //We always use index 1 for self SSID. Index 0 for peer's SSID that we want to join |
| 7491 | pScanFilter->SSIDs.numOfSSIDs = 1; |
| 7492 | } |
| 7493 | size = sizeof(tCsrSSIDInfo) * pProfile->SSIDs.numOfSSIDs; |
| 7494 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, size); |
| 7495 | if(!HAL_STATUS_SUCCESS(status)) |
| 7496 | { |
| 7497 | break; |
| 7498 | } |
| 7499 | palCopyMemory(pMac->hHdd, pScanFilter->SSIDs.SSIDList, pProfile->SSIDs.SSIDList, size); |
| 7500 | } |
| 7501 | if(!pProfile->ChannelInfo.ChannelList || (pProfile->ChannelInfo.ChannelList[0] == 0) ) |
| 7502 | { |
| 7503 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 7504 | pScanFilter->ChannelInfo.ChannelList = NULL; |
| 7505 | } |
| 7506 | else if(pProfile->ChannelInfo.numOfChannels) |
| 7507 | { |
| 7508 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->ChannelInfo.ChannelList, sizeof(*pScanFilter->ChannelInfo.ChannelList) * pProfile->ChannelInfo.numOfChannels); |
| 7509 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 7510 | if(HAL_STATUS_SUCCESS(status)) |
| 7511 | { |
| 7512 | for(index = 0; index < pProfile->ChannelInfo.numOfChannels; index++) |
| 7513 | { |
| 7514 | if(csrRoamIsChannelValid(pMac, pProfile->ChannelInfo.ChannelList[index])) |
| 7515 | { |
| 7516 | pScanFilter->ChannelInfo.ChannelList[pScanFilter->ChannelInfo.numOfChannels] |
| 7517 | = pProfile->ChannelInfo.ChannelList[index]; |
| 7518 | pScanFilter->ChannelInfo.numOfChannels++; |
| 7519 | } |
| 7520 | else |
| 7521 | { |
| 7522 | smsLog(pMac, LOG1, FL("process a channel (%d) that is invalid\n"), pProfile->ChannelInfo.ChannelList[index]); |
| 7523 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7524 | } |
| 7525 | } |
| 7526 | else |
| 7527 | { |
| 7528 | break; |
| 7529 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7530 | } |
| 7531 | else |
| 7532 | { |
| 7533 | smsLog(pMac, LOGW, FL("Channel list empty\n")); |
| 7534 | status = eHAL_STATUS_FAILURE; |
| 7535 | break; |
| 7536 | } |
| 7537 | pScanFilter->uapsd_mask = pProfile->uapsd_mask; |
| 7538 | pScanFilter->authType = pProfile->AuthType; |
| 7539 | pScanFilter->EncryptionType = pProfile->EncryptionType; |
| 7540 | pScanFilter->mcEncryptionType = pProfile->mcEncryptionType; |
| 7541 | pScanFilter->BSSType = pProfile->BSSType; |
| 7542 | pScanFilter->phyMode = pProfile->phyMode; |
| 7543 | #ifdef FEATURE_WLAN_WAPI |
| 7544 | //check if user asked for WAPI with 11n or auto mode, in that case modify |
| 7545 | //the phymode to 11g |
| 7546 | if(csrIsProfileWapi(pProfile)) |
| 7547 | { |
| 7548 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_11n) |
| 7549 | { |
| 7550 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 7551 | } |
| 7552 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_AUTO) |
| 7553 | { |
| 7554 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_AUTO; |
| 7555 | } |
| 7556 | if(!pScanFilter->phyMode) |
| 7557 | { |
| 7558 | pScanFilter->phyMode = eCSR_DOT11_MODE_11g; |
| 7559 | } |
| 7560 | } |
| 7561 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7562 | /*Save the WPS info*/ |
| 7563 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7564 | if( pProfile->countryCode[0] ) |
| 7565 | { |
| 7566 | //This causes the matching function to use countryCode as one of the criteria. |
| 7567 | palCopyMemory( pMac->hHdd, pScanFilter->countryCode, pProfile->countryCode, |
| 7568 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 7569 | } |
| 7570 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7571 | if (pProfile->MDID.mdiePresent) |
| 7572 | { |
| 7573 | pScanFilter->MDID.mdiePresent = 1; |
| 7574 | pScanFilter->MDID.mobilityDomain = pProfile->MDID.mobilityDomain; |
| 7575 | } |
| 7576 | #endif |
| 7577 | |
| 7578 | }while(0); |
| 7579 | |
| 7580 | if(!HAL_STATUS_SUCCESS(status)) |
| 7581 | { |
| 7582 | csrFreeScanFilter(pMac, pScanFilter); |
| 7583 | } |
| 7584 | |
| 7585 | return(status); |
| 7586 | } |
| 7587 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7588 | tANI_BOOLEAN csrRoamIssueWmStatusChange( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 7589 | eCsrRoamWmStatusChangeTypes Type, tSirSmeRsp *pSmeRsp ) |
| 7590 | { |
| 7591 | tANI_BOOLEAN fCommandQueued = eANI_BOOLEAN_FALSE; |
| 7592 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7593 | do |
| 7594 | { |
| 7595 | // Validate the type is ok... |
| 7596 | if ( ( eCsrDisassociated != Type ) && ( eCsrDeauthenticated != Type ) ) break; |
| 7597 | pCommand = csrGetCommandBuffer( pMac ); |
| 7598 | if ( !pCommand ) |
| 7599 | { |
| 7600 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 7601 | break; |
| 7602 | } |
| 7603 | //Change the substate in case it is waiting for key |
| 7604 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7605 | { |
| 7606 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7607 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 7608 | } |
| 7609 | pCommand->command = eSmeCommandWmStatusChange; |
| 7610 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7611 | pCommand->u.wmStatusChangeCmd.Type = Type; |
| 7612 | if ( eCsrDisassociated == Type ) |
| 7613 | { |
| 7614 | palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg, pSmeRsp, |
| 7615 | sizeof( pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg ) ); |
| 7616 | } |
| 7617 | else |
| 7618 | { |
| 7619 | palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg, pSmeRsp, |
| 7620 | sizeof( pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg ) ); |
| 7621 | } |
| 7622 | if( HAL_STATUS_SUCCESS( csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE) ) ) |
| 7623 | { |
| 7624 | fCommandQueued = eANI_BOOLEAN_TRUE; |
| 7625 | } |
| 7626 | else |
| 7627 | { |
| 7628 | smsLog( pMac, LOGE, FL(" fail to send message \n") ); |
| 7629 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 7630 | } |
| 7631 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7632 | /* AP has issued Dissac/Deauth, Set the operating mode value to configured value */ |
| 7633 | csrSetDefaultDot11Mode( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7634 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7635 | return( fCommandQueued ); |
| 7636 | } |
| 7637 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7638 | static void csrUpdateRssi(tpAniSirGlobal pMac, void* pMsg) |
| 7639 | { |
| 7640 | v_S7_t rssi = 0; |
| 7641 | tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq*)pMsg; |
| 7642 | if(pGetRssiReq) |
| 7643 | { |
| 7644 | if(NULL != pGetRssiReq->pVosContext) |
| 7645 | { |
| 7646 | WLANTL_GetRssi(pGetRssiReq->pVosContext, pGetRssiReq->staId, &rssi); |
| 7647 | } |
| 7648 | else |
| 7649 | { |
| 7650 | smsLog( pMac, LOGE, FL("pGetRssiReq->pVosContext is NULL\n")); |
| 7651 | return; |
| 7652 | } |
| 7653 | |
| 7654 | if(NULL != pGetRssiReq->rssiCallback) |
| 7655 | { |
| 7656 | ((tCsrRssiCallback)(pGetRssiReq->rssiCallback))(rssi, pGetRssiReq->staId, pGetRssiReq->pDevContext); |
| 7657 | } |
| 7658 | else |
| 7659 | { |
| 7660 | smsLog( pMac, LOGE, FL("pGetRssiReq->rssiCallback is NULL\n")); |
| 7661 | return; |
| 7662 | } |
| 7663 | } |
| 7664 | else |
| 7665 | { |
| 7666 | smsLog( pMac, LOGE, FL("pGetRssiReq is NULL\n")); |
| 7667 | } |
| 7668 | return; |
| 7669 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 7670 | static void csrRoamRssiIndHdlr(tpAniSirGlobal pMac, void* pMsg) |
| 7671 | { |
| 7672 | WLANTL_TlIndicationReq *pTlRssiInd = (WLANTL_TlIndicationReq*)pMsg; |
| 7673 | if(pTlRssiInd) |
| 7674 | { |
| 7675 | if(NULL != pTlRssiInd->tlCallback) |
| 7676 | { |
| 7677 | ((WLANTL_RSSICrossThresholdCBType)(pTlRssiInd->tlCallback)) |
| 7678 | (pTlRssiInd->pAdapter, pTlRssiInd->rssiNotification, pTlRssiInd->pUserCtxt); |
| 7679 | } |
| 7680 | else |
| 7681 | { |
| 7682 | smsLog( pMac, LOGE, FL("pTlRssiInd->tlCallback is NULL\n")); |
| 7683 | } |
| 7684 | } |
| 7685 | else |
| 7686 | { |
| 7687 | smsLog( pMac, LOGE, FL("pTlRssiInd is NULL\n")); |
| 7688 | } |
| 7689 | return; |
| 7690 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7691 | |
| 7692 | void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) |
| 7693 | { |
| 7694 | tSirSmeAssocInd *pAssocInd; |
| 7695 | tSirSmeDisassocInd *pDisassocInd; |
| 7696 | tSirSmeDeauthInd *pDeauthInd; |
| 7697 | tSirSmeWmStatusChangeNtf *pStatusChangeMsg; |
| 7698 | tSirSmeNewBssInfo *pNewBss; |
| 7699 | tSmeIbssPeerInd *pIbssPeerInd; |
| 7700 | tSirMacAddr Broadcastaddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 7701 | tSirSmeApNewCaps *pApNewCaps; |
| 7702 | eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; |
| 7703 | eRoamCmdStatus roamStatus = eCSR_ROAM_FAILED; |
| 7704 | tCsrRoamInfo *pRoamInfo = NULL; |
| 7705 | tCsrRoamInfo roamInfo; |
| 7706 | eHalStatus status; |
| 7707 | tANI_U32 sessionId = CSR_SESSION_ID_INVALID; |
| 7708 | tCsrRoamSession *pSession = NULL; |
| 7709 | tpSirSmeSwitchChannelInd pSwitchChnInd; |
| 7710 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7711 | #if defined ANI_PRODUCT_TYPE_AP |
| 7712 | pSirMsg->messageType = pal_be16_to_cpu(pSirMsg->messageType); |
| 7713 | pSirMsg->length = pal_be16_to_cpu(pSirMsg->length); |
| 7714 | pSirMsg->statusCode = pal_be32_to_cpu(pSirMsg->statusCode); |
| 7715 | #else |
| 7716 | pSirMsg->messageType = (pSirMsg->messageType); |
| 7717 | pSirMsg->length = (pSirMsg->length); |
| 7718 | pSirMsg->statusCode = (pSirMsg->statusCode); |
| 7719 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7720 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7721 | switch( pSirMsg->messageType ) |
| 7722 | { |
| 7723 | case eWNI_SME_ASSOC_IND: |
| 7724 | { |
| 7725 | tCsrRoamSession *pSession; |
| 7726 | smsLog( pMac, LOG1, FL("ASSOCIATION Indication from SME\n")); |
| 7727 | pAssocInd = (tSirSmeAssocInd *)pSirMsg; |
| 7728 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pAssocInd->bssId, &sessionId ); |
| 7729 | if( HAL_STATUS_SUCCESS( status ) ) |
| 7730 | { |
| 7731 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 7732 | |
| 7733 | pRoamInfo = &roamInfo; |
| 7734 | |
| 7735 | // Required for indicating the frames to upper layer |
| 7736 | pRoamInfo->assocReqLength = pAssocInd->assocReqLength; |
| 7737 | pRoamInfo->assocReqPtr = pAssocInd->assocReqPtr; |
| 7738 | |
| 7739 | pRoamInfo->beaconPtr = pAssocInd->beaconPtr; |
| 7740 | pRoamInfo->beaconLength = pAssocInd->beaconLength; |
| 7741 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 7742 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 7743 | |
| 7744 | pRoamInfo->staId = (tANI_U8)pAssocInd->staId; |
| 7745 | pRoamInfo->rsnIELen = (tANI_U8)pAssocInd->rsnIE.length; |
| 7746 | pRoamInfo->prsnIE = pAssocInd->rsnIE.rsnIEdata; |
| 7747 | |
| 7748 | pRoamInfo->addIELen = (tANI_U8)pAssocInd->addIE.length; |
| 7749 | pRoamInfo->paddIE = pAssocInd->addIE.addIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7750 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 7751 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pAssocInd->bssId, sizeof(tCsrBssid)); |
| 7752 | #ifdef WLAN_SOFTAP_FEATURE |
| 7753 | pRoamInfo->wmmEnabledSta = pAssocInd->wmmEnabledSta; |
| 7754 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 7755 | #endif |
| 7756 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
| 7757 | #ifdef WLAN_SOFTAP_FEATURE |
| 7758 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile)) |
| 7759 | { |
| 7760 | if( CSR_IS_ENC_TYPE_STATIC( pSession->pCurRoamProfile->negotiatedUCEncryptionType )) |
| 7761 | { |
| 7762 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->pCurRoamProfile->negotiatedUCEncryptionType, |
| 7763 | pSession->pConnectBssDesc, |
| 7764 | &(pRoamInfo->peerMac), |
| 7765 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 7766 | pRoamInfo->fAuthRequired = FALSE; |
| 7767 | } |
| 7768 | else |
| 7769 | { |
| 7770 | pRoamInfo->fAuthRequired = TRUE; |
| 7771 | } |
| 7772 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND); |
| 7773 | if (!HAL_STATUS_SUCCESS(status)) |
| 7774 | pRoamInfo->statusCode = eSIR_SME_ASSOC_REFUSED;// Refused due to Mac filtering |
| 7775 | } |
| 7776 | #endif |
| 7777 | /* Send Association completion message to PE */ |
| 7778 | status = csrSendAssocCnfMsg( pMac, pAssocInd, status );//Sta |
| 7779 | |
| 7780 | /* send a message to CSR itself just to avoid the EAPOL frames going |
| 7781 | * OTA before association response */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7782 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 7783 | { |
| 7784 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 7785 | } |
| 7786 | #ifdef WLAN_SOFTAP_FEATURE |
| 7787 | else if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) && (pRoamInfo->statusCode != eSIR_SME_ASSOC_REFUSED)) |
| 7788 | { |
| 7789 | pRoamInfo->fReassocReq = pAssocInd->reassocReq; |
| 7790 | //status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 7791 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 7792 | } |
| 7793 | #endif |
| 7794 | } |
| 7795 | } |
| 7796 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7797 | case eWNI_SME_DISASSOC_IND: |
| 7798 | smsLog( pMac, LOGE, FL("DISASSOCIATION Indication from MAC\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7799 | // Check if AP dis-associated us because of MIC failure. If so, |
| 7800 | // then we need to take action immediately and not wait till the |
| 7801 | // the WmStatusChange requests is pushed and processed |
| 7802 | pDisassocInd = (tSirSmeDisassocInd *)pSirMsg; |
| 7803 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDisassocInd->bssId, &sessionId ); |
| 7804 | if( HAL_STATUS_SUCCESS( status ) ) |
| 7805 | { |
| 7806 | // If we are in neighbor preauth done state then on receiving |
| 7807 | // disassoc or deauth we dont roam instead we just disassoc |
| 7808 | // from current ap and then go to disconnected state |
| 7809 | // This happens for CCX and 11r FT connections ONLY. |
| 7810 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7811 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 7812 | { |
| 7813 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 7814 | } |
| 7815 | #endif |
| 7816 | #ifdef FEATURE_WLAN_CCX |
| 7817 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 7818 | { |
| 7819 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 7820 | } |
| 7821 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7822 | #ifdef FEATURE_WLAN_LFR |
| 7823 | if (csrRoamIsFastRoamEnabled(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 7824 | { |
| 7825 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 7826 | } |
| 7827 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7828 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7829 | |
| 7830 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 7831 | { |
| 7832 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7833 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7834 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 7835 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 7836 | #endif |
| 7837 | csrRoamLinkDown(pMac, sessionId); |
| 7838 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDisassociated, pSirMsg ); |
| 7839 | #ifdef WLAN_SOFTAP_FEATURE |
| 7840 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 7841 | { |
| 7842 | |
| 7843 | pRoamInfo = &roamInfo; |
| 7844 | |
| 7845 | pRoamInfo->statusCode = pDisassocInd->statusCode; |
| 7846 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 7847 | |
| 7848 | pRoamInfo->staId = (tANI_U8)pDisassocInd->staId; |
| 7849 | |
| 7850 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 7851 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDisassocInd->bssId, sizeof(tCsrBssid)); |
| 7852 | |
| 7853 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DISASSOC_IND); |
| 7854 | } |
| 7855 | #endif |
| 7856 | } |
| 7857 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7858 | case eWNI_SME_DEAUTH_IND: |
| 7859 | smsLog( pMac, LOG1, FL("DEAUTHENTICATION Indication from MAC\n")); |
| 7860 | pDeauthInd = (tpSirSmeDeauthInd)pSirMsg; |
| 7861 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDeauthInd->bssId, &sessionId ); |
| 7862 | if( HAL_STATUS_SUCCESS( status ) ) |
| 7863 | { |
| 7864 | // If we are in neighbor preauth done state then on receiving |
| 7865 | // disassoc or deauth we dont roam instead we just disassoc |
| 7866 | // from current ap and then go to disconnected state |
| 7867 | // This happens for CCX and 11r FT connections ONLY. |
| 7868 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7869 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 7870 | { |
| 7871 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 7872 | } |
| 7873 | #endif |
| 7874 | #ifdef FEATURE_WLAN_CCX |
| 7875 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 7876 | { |
| 7877 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 7878 | } |
| 7879 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7880 | #ifdef FEATURE_WLAN_LFR |
| 7881 | if (csrRoamIsFastRoamEnabled(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 7882 | { |
| 7883 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 7884 | } |
| 7885 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7886 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7887 | |
| 7888 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 7889 | { |
| 7890 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7892 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 7893 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 7894 | #endif |
| 7895 | csrRoamLinkDown(pMac, sessionId); |
| 7896 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDeauthenticated, pSirMsg ); |
| 7897 | #ifdef WLAN_SOFTAP_FEATURE |
| 7898 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 7899 | { |
| 7900 | |
| 7901 | pRoamInfo = &roamInfo; |
| 7902 | |
| 7903 | pRoamInfo->statusCode = pDeauthInd->statusCode; |
| 7904 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 7905 | |
| 7906 | pRoamInfo->staId = (tANI_U8)pDeauthInd->staId; |
| 7907 | |
| 7908 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 7909 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDeauthInd->bssId, sizeof(tCsrBssid)); |
| 7910 | |
| 7911 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DEAUTH_IND); |
| 7912 | } |
| 7913 | #endif |
| 7914 | } |
| 7915 | break; |
| 7916 | |
| 7917 | case eWNI_SME_SWITCH_CHL_REQ: // in case of STA, the SWITCH_CHANNEL originates from its AP |
| 7918 | smsLog( pMac, LOGW, FL("eWNI_SME_SWITCH_CHL_REQ from SME\n")); |
| 7919 | pSwitchChnInd = (tpSirSmeSwitchChannelInd)pSirMsg; |
| 7920 | //Update with the new channel id. |
| 7921 | //The channel id is hidden in the statusCode. |
| 7922 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pSwitchChnInd->bssId, &sessionId ); |
| 7923 | if( HAL_STATUS_SUCCESS( status ) ) |
| 7924 | { |
| 7925 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7926 | pSession->connectedProfile.operationChannel = (tANI_U8)pSwitchChnInd->newChannelId; |
| 7927 | if(pSession->pConnectBssDesc) |
| 7928 | { |
| 7929 | pSession->pConnectBssDesc->channelId = (tANI_U8)pSwitchChnInd->newChannelId; |
| 7930 | } |
| 7931 | } |
| 7932 | break; |
| 7933 | |
| 7934 | case eWNI_SME_DEAUTH_RSP: |
| 7935 | smsLog( pMac, LOGW, FL("eWNI_SME_DEAUTH_RSP from SME\n")); |
| 7936 | #ifdef WLAN_SOFTAP_FEATURE |
| 7937 | { |
| 7938 | tSirSmeDeauthRsp* pDeauthRsp = (tSirSmeDeauthRsp *)pSirMsg; |
| 7939 | sessionId = pDeauthRsp->sessionId; |
| 7940 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 7941 | { |
| 7942 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7943 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 7944 | { |
| 7945 | pRoamInfo = &roamInfo; |
| 7946 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 7947 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthRsp->peerMacAddr, sizeof(tSirMacAddr)); |
| 7948 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 7949 | pRoamInfo->statusCode = pDeauthRsp->statusCode; |
| 7950 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 7951 | } |
| 7952 | } |
| 7953 | } |
| 7954 | #endif |
| 7955 | break; |
| 7956 | |
| 7957 | case eWNI_SME_DISASSOC_RSP: |
| 7958 | smsLog( pMac, LOGW, FL("eWNI_SME_DISASSOC_RSP from SME subState = %d\n"), pMac->roam.curSubState[sessionId]); |
| 7959 | #ifdef WLAN_SOFTAP_FEATURE |
| 7960 | { |
| 7961 | tSirSmeDisassocRsp *pDisassocRsp = (tSirSmeDisassocRsp *)pSirMsg; |
| 7962 | sessionId = pDisassocRsp->sessionId; |
| 7963 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 7964 | { |
| 7965 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7966 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 7967 | { |
| 7968 | pRoamInfo = &roamInfo; |
| 7969 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 7970 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocRsp->peerMacAddr, sizeof(tSirMacAddr)); |
| 7971 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 7972 | pRoamInfo->statusCode = pDisassocRsp->statusCode; |
| 7973 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 7974 | } |
| 7975 | } |
| 7976 | } |
| 7977 | #endif |
| 7978 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7979 | case eWNI_SME_MIC_FAILURE_IND: |
| 7980 | { |
| 7981 | tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg; |
| 7982 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 7983 | eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7984 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7985 | { |
| 7986 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7987 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
| 7988 | palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 7989 | secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR; |
| 7990 | secEvent.encryptionModeMulticast = |
| 7991 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 7992 | secEvent.encryptionModeUnicast = |
| 7993 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 7994 | secEvent.authMode = |
| 7995 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 7996 | palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 7997 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 7998 | } |
| 7999 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8000 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pMicInd->bssId, &sessionId ); |
| 8001 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8002 | { |
| 8003 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 8004 | roamInfo.u.pMICFailureInfo = &pMicInd->info; |
| 8005 | pRoamInfo = &roamInfo; |
| 8006 | if(pMicInd->info.multicast) |
| 8007 | { |
| 8008 | result = eCSR_ROAM_RESULT_MIC_ERROR_GROUP; |
| 8009 | } |
| 8010 | else |
| 8011 | { |
| 8012 | result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
| 8013 | } |
| 8014 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_MIC_ERROR_IND, result); |
| 8015 | } |
| 8016 | } |
| 8017 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8018 | #ifdef WLAN_SOFTAP_FEATURE |
| 8019 | case eWNI_SME_WPS_PBC_PROBE_REQ_IND: |
| 8020 | { |
| 8021 | tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd)pSirMsg; |
| 8022 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8023 | smsLog( pMac, LOG1, FL("WPS PBC Probe request Indication from SME\n")); |
| 8024 | |
| 8025 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pProbeReqInd->bssId, &sessionId ); |
| 8026 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8027 | { |
| 8028 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 8029 | roamInfo.u.pWPSPBCProbeReq = &pProbeReqInd->WPSPBCProbeReq; |
| 8030 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_WPS_PBC_PROBE_REQ_IND, |
| 8031 | eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND); |
| 8032 | } |
| 8033 | } |
| 8034 | break; |
| 8035 | #endif |
| 8036 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8037 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 8038 | pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *)pSirMsg; |
| 8039 | switch( pStatusChangeMsg->statusChangeCode ) |
| 8040 | { |
| 8041 | case eSIR_SME_IBSS_ACTIVE: |
| 8042 | sessionId = csrFindIbssSession( pMac ); |
| 8043 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8044 | { |
| 8045 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8046 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED; |
| 8047 | if(pSession->pConnectBssDesc) |
| 8048 | { |
| 8049 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 8050 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 8051 | pRoamInfo = &roamInfo; |
| 8052 | } |
| 8053 | else |
| 8054 | { |
| 8055 | smsLog(pMac, LOGE, " CSR eSIR_SME_IBSS_NEW_PEER connected BSS is empty\n"); |
| 8056 | } |
| 8057 | result = eCSR_ROAM_RESULT_IBSS_CONNECT; |
| 8058 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 8059 | } |
| 8060 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8061 | case eSIR_SME_IBSS_INACTIVE: |
| 8062 | sessionId = csrFindIbssSession( pMac ); |
| 8063 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8064 | { |
| 8065 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8066 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 8067 | result = eCSR_ROAM_RESULT_IBSS_INACTIVE; |
| 8068 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 8069 | } |
| 8070 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8071 | case eSIR_SME_JOINED_NEW_BSS: // IBSS coalescing. |
| 8072 | sessionId = csrFindIbssSession( pMac ); |
| 8073 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8074 | { |
| 8075 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8076 | // update the connection state information |
| 8077 | pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8078 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8079 | { |
| 8080 | vos_log_ibss_pkt_type *pIbssLog; |
| 8081 | tANI_U32 bi; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8082 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 8083 | if(pIbssLog) |
| 8084 | { |
| 8085 | pIbssLog->eventId = WLAN_IBSS_EVENT_COALESCING; |
| 8086 | if(pNewBss) |
| 8087 | { |
| 8088 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pNewBss->bssId, 6); |
| 8089 | if(pNewBss->ssId.length) |
| 8090 | { |
| 8091 | palCopyMemory(pMac->hHdd, pIbssLog->ssid, pNewBss->ssId.ssId, pNewBss->ssId.length); |
| 8092 | } |
| 8093 | pIbssLog->operatingChannel = pNewBss->channelNumber; |
| 8094 | } |
| 8095 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 8096 | { |
| 8097 | //***U8 is not enough for beacon interval |
| 8098 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 8099 | } |
| 8100 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 8101 | } |
| 8102 | } |
| 8103 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8104 | csrRoamUpdateConnectedProfileFromNewBss( pMac, sessionId, pNewBss ); |
| 8105 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->connectedProfile.EncryptionType, |
| 8106 | pSession->pConnectBssDesc, |
| 8107 | &Broadcastaddr, |
| 8108 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); |
| 8109 | result = eCSR_ROAM_RESULT_IBSS_COALESCED; |
| 8110 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 8111 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pNewBss->bssId, sizeof(tCsrBssid)); |
| 8112 | pRoamInfo = &roamInfo; |
| 8113 | //This BSSID is th ereal BSSID, let's save it |
| 8114 | if(pSession->pConnectBssDesc) |
| 8115 | { |
| 8116 | palCopyMemory(pMac->hHdd, pSession->pConnectBssDesc->bssId, &pNewBss->bssId, sizeof(tCsrBssid)); |
| 8117 | } |
| 8118 | // Stop the join IBSS timer in case of join, for |
| 8119 | // genuine merge do nothing |
| 8120 | if(pSession->ibss_join_pending) |
| 8121 | { |
| 8122 | pSession->ibss_join_pending = FALSE; |
| 8123 | csrRoamStopIbssJoinTimer(pMac, sessionId); |
| 8124 | result = eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS; |
| 8125 | } |
| 8126 | } |
| 8127 | smsLog(pMac, LOGW, "CSR: eSIR_SME_JOINED_NEW_BSS received from PE\n"); |
| 8128 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8129 | // detection by LIM that the capabilities of the associated AP have changed. |
| 8130 | case eSIR_SME_AP_CAPS_CHANGED: |
| 8131 | pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps; |
| 8132 | smsLog(pMac, LOGW, "CSR handling eSIR_SME_AP_CAPS_CHANGED\n"); |
| 8133 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pApNewCaps->bssId, &sessionId ); |
| 8134 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8135 | { |
| 8136 | csrScanForCapabilityChange( pMac, pApNewCaps ); |
| 8137 | result = eCSR_ROAM_RESULT_CAP_CHANGED; |
| 8138 | roamStatus = eCSR_ROAM_GEN_INFO; |
| 8139 | } |
| 8140 | break; |
| 8141 | |
| 8142 | default: |
| 8143 | roamStatus = eCSR_ROAM_FAILED; |
| 8144 | result = eCSR_ROAM_RESULT_NONE; |
| 8145 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8146 | } // end switch on statusChangeCode |
| 8147 | if(eCSR_ROAM_RESULT_NONE != result) |
| 8148 | { |
| 8149 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, roamStatus, result); |
| 8150 | } |
| 8151 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8152 | case eWNI_SME_IBSS_NEW_PEER_IND: |
| 8153 | pIbssPeerInd = (tSmeIbssPeerInd *)pSirMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8154 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8155 | { |
| 8156 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8157 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 8158 | if(pIbssLog) |
| 8159 | { |
| 8160 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_JOIN; |
| 8161 | palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
| 8162 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 8163 | } |
| 8164 | } |
| 8165 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8166 | sessionId = csrFindIbssSession( pMac ); |
| 8167 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8168 | { |
| 8169 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8170 | // Issue the set Context request to LIM to establish the Unicast STA context for the new peer... |
| 8171 | if(pSession->pConnectBssDesc) |
| 8172 | { |
| 8173 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 8174 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 8175 | if(pIbssPeerInd->mesgLen > sizeof(tSmeIbssPeerInd)) |
| 8176 | { |
| 8177 | status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pbFrames, |
| 8178 | (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd))); |
| 8179 | if(HAL_STATUS_SUCCESS(status)) |
| 8180 | { |
| 8181 | roamInfo.nBeaconLength = (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd)); |
| 8182 | palCopyMemory(pMac->hHdd, roamInfo.pbFrames, ((tANI_U8 *)pIbssPeerInd) + sizeof(tSmeIbssPeerInd), |
| 8183 | roamInfo.nBeaconLength); |
| 8184 | } |
| 8185 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 8186 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 8187 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 8188 | status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pBssDesc, |
| 8189 | pSession->pConnectBssDesc->length); |
| 8190 | if(HAL_STATUS_SUCCESS(status)) |
| 8191 | { |
| 8192 | palCopyMemory(pMac->hHdd, roamInfo.pBssDesc, pSession->pConnectBssDesc, |
| 8193 | pSession->pConnectBssDesc->length); |
| 8194 | } |
| 8195 | if(HAL_STATUS_SUCCESS(status)) |
| 8196 | { |
| 8197 | pRoamInfo = &roamInfo; |
| 8198 | } |
| 8199 | else |
| 8200 | { |
| 8201 | if(roamInfo.pbFrames) |
| 8202 | { |
| 8203 | palFreeMemory(pMac->hHdd, roamInfo.pbFrames); |
| 8204 | } |
| 8205 | if(roamInfo.pBssDesc) |
| 8206 | { |
| 8207 | palFreeMemory(pMac->hHdd, roamInfo.pBssDesc); |
| 8208 | } |
| 8209 | } |
| 8210 | } |
| 8211 | else |
| 8212 | { |
| 8213 | pRoamInfo = &roamInfo; |
| 8214 | } |
| 8215 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->connectedProfile.EncryptionType, |
| 8216 | pSession->pConnectBssDesc, |
| 8217 | &(pIbssPeerInd->peerAddr), |
| 8218 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 8219 | } |
| 8220 | else |
| 8221 | { |
| 8222 | smsLog(pMac, LOGW, " CSR eSIR_SME_IBSS_NEW_PEER connected BSS is empty\n"); |
| 8223 | } |
| 8224 | //send up the sec type for the new peer |
| 8225 | if (pRoamInfo) |
| 8226 | { |
| 8227 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8228 | } |
| 8229 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, |
| 8230 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_NEW_PEER); |
| 8231 | if(pRoamInfo) |
| 8232 | { |
| 8233 | if(roamInfo.pbFrames) |
| 8234 | { |
| 8235 | palFreeMemory(pMac->hHdd, roamInfo.pbFrames); |
| 8236 | } |
| 8237 | if(roamInfo.pBssDesc) |
| 8238 | { |
| 8239 | palFreeMemory(pMac->hHdd, roamInfo.pBssDesc); |
| 8240 | } |
| 8241 | } |
| 8242 | } |
| 8243 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8244 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 8245 | pIbssPeerInd = (tSmeIbssPeerInd*)pSirMsg; |
| 8246 | sessionId = csrFindIbssSession( pMac ); |
| 8247 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8248 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8249 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8250 | { |
| 8251 | vos_log_ibss_pkt_type *pIbssLog; |
| 8252 | |
| 8253 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 8254 | if(pIbssLog) |
| 8255 | { |
| 8256 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_LEAVE; |
| 8257 | if(pIbssPeerInd) |
| 8258 | { |
| 8259 | palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
| 8260 | } |
| 8261 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 8262 | } |
| 8263 | } |
| 8264 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8265 | smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM\n"); |
| 8266 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 8267 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 8268 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 8269 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 8270 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 8271 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 8272 | } |
| 8273 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8274 | case eWNI_SME_SETCONTEXT_RSP: |
| 8275 | { |
| 8276 | tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *)pSirMsg; |
| 8277 | tListElem *pEntry; |
| 8278 | tSmeCmd *pCommand; |
| 8279 | |
| 8280 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 8281 | if ( pEntry ) |
| 8282 | { |
| 8283 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 8284 | if ( eSmeCommandSetKey == pCommand->command ) |
| 8285 | { |
| 8286 | sessionId = pCommand->sessionId; |
| 8287 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8288 | |
| 8289 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8290 | if(eCSR_ENCRYPT_TYPE_NONE != pSession->connectedProfile.EncryptionType) |
| 8291 | { |
| 8292 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
| 8293 | palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8294 | if( pRsp->peerMacAddr[0] & 0x01 ) |
| 8295 | { |
| 8296 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 8297 | } |
| 8298 | else |
| 8299 | { |
| 8300 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 8301 | } |
| 8302 | setKeyEvent.encryptionModeMulticast = |
| 8303 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8304 | setKeyEvent.encryptionModeUnicast = |
| 8305 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8306 | palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 8307 | setKeyEvent.authMode = |
| 8308 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8309 | if( eSIR_SUCCESS != pRsp->statusCode ) |
| 8310 | { |
| 8311 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 8312 | } |
| 8313 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8314 | } |
| 8315 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8316 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 8317 | { |
| 8318 | //We are done with authentication, whethere succeed or not |
| 8319 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 8320 | |
| 8321 | csrRoamStopWaitForKeyTimer( pMac ); |
| 8322 | //We do it here because this linkup function is not called after association |
| 8323 | //when a key needs to be set. |
| 8324 | if( csrIsConnStateConnectedInfra(pMac, sessionId) ) |
| 8325 | { |
| 8326 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 8327 | } |
| 8328 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 8329 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8330 | { |
| 8331 | palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 8332 | //Make sure we install the GTK before indicating to HDD as authenticated |
| 8333 | //This is to prevent broadcast packets go out after PTK and before GTK. |
| 8334 | if( palEqualMemory( pMac->hHdd, &Broadcastaddr, pRsp->peerMacAddr, |
| 8335 | sizeof(tSirMacAddr) ) ) |
| 8336 | { |
| 8337 | result = eCSR_ROAM_RESULT_AUTHENTICATED; |
| 8338 | } |
| 8339 | else |
| 8340 | { |
| 8341 | result = eCSR_ROAM_RESULT_NONE; |
| 8342 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8343 | pRoamInfo = &roamInfo; |
| 8344 | } |
| 8345 | else |
| 8346 | { |
| 8347 | result = eCSR_ROAM_RESULT_FAILURE; |
| 8348 | smsLog( pMac, LOGE, "CSR: Roam Completion setkey command failed(%d) PeerMac %02X-%02X-%02X-%02X-%02X-%02X...\n", |
| 8349 | pRsp->statusCode, pRsp->peerMacAddr[0], pRsp->peerMacAddr[1], pRsp->peerMacAddr[2], |
| 8350 | pRsp->peerMacAddr[3], pRsp->peerMacAddr[4], pRsp->peerMacAddr[5] ); |
| 8351 | } |
| 8352 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 8353 | eCSR_ROAM_SET_KEY_COMPLETE, result); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8354 | // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS |
| 8355 | // can go ahead and initiate the TSPEC if any are pending |
| 8356 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_SET_KEY_SUCCESS_IND, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8357 | #ifdef FEATURE_WLAN_CCX |
| 8358 | //Send Adjacent AP repot to new AP. |
| 8359 | if (result == eCSR_ROAM_RESULT_AUTHENTICATED && |
| 8360 | pSession->isPrevApInfoValid && |
| 8361 | pSession->connectedProfile.isCCXAssoc) |
| 8362 | { |
| 8363 | #ifdef WLAN_FEATURE_VOWIFI |
| 8364 | csrCcxSendAdjacentApRepMsg(pMac, pSession); |
| 8365 | #endif |
| 8366 | pSession->isPrevApInfoValid = FALSE; |
| 8367 | } |
| 8368 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8369 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 8370 | { |
| 8371 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 8372 | } |
| 8373 | } |
| 8374 | else |
| 8375 | { |
| 8376 | smsLog( pMac, LOGE, "CSR: Roam Completion called but setkey command is not ACTIVE ...\n" ); |
| 8377 | } |
| 8378 | } |
| 8379 | else |
| 8380 | { |
| 8381 | smsLog( pMac, LOGE, "CSR: SetKey Completion called but NO commands are ACTIVE ...\n" ); |
| 8382 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8383 | smeProcessPendingQueue( pMac ); |
| 8384 | } |
| 8385 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8386 | case eWNI_SME_REMOVEKEY_RSP: |
| 8387 | { |
| 8388 | tSirSmeRemoveKeyRsp *pRsp = (tSirSmeRemoveKeyRsp *)pSirMsg; |
| 8389 | tListElem *pEntry; |
| 8390 | tSmeCmd *pCommand; |
| 8391 | |
| 8392 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 8393 | if ( pEntry ) |
| 8394 | { |
| 8395 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 8396 | if ( eSmeCommandRemoveKey == pCommand->command ) |
| 8397 | { |
| 8398 | sessionId = pCommand->sessionId; |
| 8399 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8400 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8401 | { |
| 8402 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
| 8403 | palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8404 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
| 8405 | removeKeyEvent.encryptionModeMulticast = |
| 8406 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8407 | removeKeyEvent.encryptionModeUnicast = |
| 8408 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8409 | palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 8410 | removeKeyEvent.authMode = |
| 8411 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8412 | if( eSIR_SUCCESS != pRsp->statusCode ) |
| 8413 | { |
| 8414 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 8415 | } |
| 8416 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8417 | } |
| 8418 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 8419 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8420 | { |
| 8421 | palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) ); |
| 8422 | result = eCSR_ROAM_RESULT_NONE; |
| 8423 | pRoamInfo = &roamInfo; |
| 8424 | } |
| 8425 | else |
| 8426 | { |
| 8427 | result = eCSR_ROAM_RESULT_FAILURE; |
| 8428 | } |
| 8429 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 8430 | eCSR_ROAM_REMOVE_KEY_COMPLETE, result); |
| 8431 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 8432 | { |
| 8433 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 8434 | } |
| 8435 | } |
| 8436 | else |
| 8437 | { |
| 8438 | smsLog( pMac, LOGW, "CSR: Roam Completion called but setkey command is not ACTIVE ...\n" ); |
| 8439 | } |
| 8440 | } |
| 8441 | else |
| 8442 | { |
| 8443 | smsLog( pMac, LOGW, "CSR: SetKey Completion called but NO commands are ACTIVE ...\n" ); |
| 8444 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8445 | smeProcessPendingQueue( pMac ); |
| 8446 | } |
| 8447 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8448 | case eWNI_SME_GET_STATISTICS_RSP: |
| 8449 | smsLog( pMac, LOGW, FL("Stats rsp from PE\n")); |
| 8450 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 8451 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8452 | case eWNI_SME_GET_RSSI_REQ: |
| 8453 | smsLog( pMac, LOGW, FL("GetRssiReq from self\n")); |
| 8454 | csrUpdateRssi( pMac, pSirMsg ); |
| 8455 | break; |
| 8456 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8457 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8458 | case eWNI_SME_FT_PRE_AUTH_RSP: |
| 8459 | csrRoamFTPreAuthRspProcessor( pMac, (tpSirFTPreAuthRsp)pSirMsg ); |
| 8460 | break; |
| 8461 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8462 | case eWNI_SME_MAX_ASSOC_EXCEEDED: |
| 8463 | pSmeMaxAssocInd = (tSmeMaxAssocInd*)pSirMsg; |
| 8464 | smsLog( pMac, LOG1, FL("send indication that max assoc have been reached and the new peer cannot be accepted\n")); |
| 8465 | sessionId = pSmeMaxAssocInd->sessionId; |
| 8466 | roamInfo.sessionId = sessionId; |
| 8467 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pSmeMaxAssocInd->peerMac, sizeof(tCsrBssid)); |
| 8468 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 8469 | eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED); |
| 8470 | break; |
| 8471 | |
| 8472 | case eWNI_SME_BTAMP_LOG_LINK_IND: |
| 8473 | smsLog( pMac, LOG1, FL("Establish logical link req from HCI serialized through MC thread\n")); |
| 8474 | btampEstablishLogLinkHdlr( pSirMsg ); |
| 8475 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 8476 | case eWNI_SME_RSSI_IND: |
| 8477 | smsLog( pMac, LOG1, FL("RSSI indication from TL serialized through MC thread\n")); |
| 8478 | csrRoamRssiIndHdlr( pMac, pSirMsg ); |
| 8479 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8480 | |
| 8481 | default: |
| 8482 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8483 | } // end switch on message type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8484 | } |
| 8485 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8486 | void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, |
| 8487 | tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult) |
| 8488 | { |
| 8489 | if(pSession) |
| 8490 | { |
| 8491 | if(pSession->bRefAssocStartCnt) |
| 8492 | { |
| 8493 | pSession->bRefAssocStartCnt--; |
| 8494 | VOS_ASSERT( pSession->bRefAssocStartCnt == 0); |
| 8495 | //Need to call association_completion because there is an assoc_start pending. |
| 8496 | csrRoamCallCallback(pMac, pSession->sessionId, NULL, roamId, |
| 8497 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 8498 | eCSR_ROAM_RESULT_FAILURE); |
| 8499 | } |
| 8500 | csrRoamCallCallback(pMac, pSession->sessionId, pRoamInfo, roamId, eCSR_ROAM_ROAMING_COMPLETION, roamResult); |
| 8501 | } |
| 8502 | else |
| 8503 | { |
| 8504 | smsLog(pMac, LOGW, FL(" pSession is NULL")); |
| 8505 | } |
| 8506 | } |
| 8507 | |
| 8508 | |
| 8509 | eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason) |
| 8510 | { |
| 8511 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8512 | if(CSR_IS_LOSTLINK_ROAMING(roamingReason) && |
| 8513 | (eANI_BOOLEAN_FALSE == pMac->roam.roamSession[sessionId].fCancelRoaming)) |
| 8514 | { |
| 8515 | status = csrScanRequestLostLink1( pMac, sessionId ); |
| 8516 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8517 | return(status); |
| 8518 | } |
| 8519 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8520 | //return a boolean to indicate whether roaming completed or continue. |
| 8521 | tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8522 | tANI_BOOLEAN fForce, eCsrRoamResult roamResult) |
| 8523 | { |
| 8524 | tANI_BOOLEAN fCompleted = eANI_BOOLEAN_TRUE; |
| 8525 | tANI_TIMESTAMP roamTime = (tANI_TIMESTAMP)(pMac->roam.configParam.nRoamingTime * PAL_TICKS_PER_SECOND); |
| 8526 | tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 8527 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8528 | //Check whether time is up |
| 8529 | if(pSession->fCancelRoaming || fForce || |
| 8530 | ((curTime - pSession->roamingStartTime) > roamTime) || |
| 8531 | eCsrReassocRoaming == pSession->roamingReason || |
| 8532 | eCsrDynamicRoaming == pSession->roamingReason) |
| 8533 | { |
| 8534 | smsLog(pMac, LOGW, FL(" indicates roaming completion\n")); |
| 8535 | if(pSession->fCancelRoaming && CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason)) |
| 8536 | { |
| 8537 | //roaming is cancelled, tell HDD to indicate disconnect |
| 8538 | //Because LIM overload deauth_ind for both deauth frame and missed beacon |
| 8539 | //we need to use this logic to detinguish it. For missed beacon, LIM set reason |
| 8540 | //to be eSIR_BEACON_MISSED |
| 8541 | if(eSIR_BEACON_MISSED == pSession->roamingStatusCode) |
| 8542 | { |
| 8543 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 8544 | } |
| 8545 | else if(eCsrLostlinkRoamingDisassoc == pSession->roamingReason) |
| 8546 | { |
| 8547 | roamResult = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 8548 | } |
| 8549 | else if(eCsrLostlinkRoamingDeauth == pSession->roamingReason) |
| 8550 | { |
| 8551 | roamResult = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 8552 | } |
| 8553 | else |
| 8554 | { |
| 8555 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 8556 | } |
| 8557 | } |
| 8558 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 8559 | pSession->roamingReason = eCsrNotRoaming; |
| 8560 | } |
| 8561 | else |
| 8562 | { |
| 8563 | pSession->roamResult = roamResult; |
| 8564 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoamingTimer(pMac, sessionId, PAL_TIMER_TO_SEC_UNIT))) |
| 8565 | { |
| 8566 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 8567 | pSession->roamingReason = eCsrNotRoaming; |
| 8568 | } |
| 8569 | else |
| 8570 | { |
| 8571 | fCompleted = eANI_BOOLEAN_FALSE; |
| 8572 | } |
| 8573 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8574 | return(fCompleted); |
| 8575 | } |
| 8576 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8577 | void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 8578 | { |
| 8579 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8580 | if(CSR_IS_ROAMING(pSession)) |
| 8581 | { |
| 8582 | smsLog(pMac, LOGW, " Cancelling roaming\n"); |
| 8583 | pSession->fCancelRoaming = eANI_BOOLEAN_TRUE; |
| 8584 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 8585 | { |
| 8586 | //No need to do anything in here because the handler takes care of it |
| 8587 | } |
| 8588 | else |
| 8589 | { |
| 8590 | eCsrRoamResult roamResult = CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason) ? |
| 8591 | eCSR_ROAM_RESULT_LOSTLINK : eCSR_ROAM_RESULT_NONE; |
| 8592 | //Roaming is stopped after here |
| 8593 | csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_TRUE, roamResult); |
| 8594 | //Since CSR may be in lostlink roaming situation, abort all roaming related activities |
| 8595 | csrScanAbortMacScan(pMac); |
| 8596 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 8597 | } |
| 8598 | } |
| 8599 | } |
| 8600 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8601 | void csrRoamRoamingTimerHandler(void *pv) |
| 8602 | { |
| 8603 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 8604 | tpAniSirGlobal pMac = pInfo->pMac; |
| 8605 | tANI_U32 sessionId = pInfo->sessionId; |
| 8606 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8607 | |
| 8608 | if(eANI_BOOLEAN_FALSE == pSession->fCancelRoaming) |
| 8609 | { |
| 8610 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoaming(pMac, sessionId, pSession->roamingReason))) |
| 8611 | { |
| 8612 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, pSession->roamResult); |
| 8613 | pSession->roamingReason = eCsrNotRoaming; |
| 8614 | } |
| 8615 | } |
| 8616 | } |
| 8617 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8618 | eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 8619 | { |
| 8620 | eHalStatus status; |
| 8621 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8622 | |
| 8623 | smsLog(pMac, LOG1, " csrScanStartRoamingTimer \n "); |
| 8624 | pSession->roamingTimerInfo.sessionId = (tANI_U8)sessionId; |
| 8625 | status = palTimerStart(pMac->hHdd, pSession->hTimerRoaming, interval, eANI_BOOLEAN_FALSE); |
| 8626 | |
| 8627 | return (status); |
| 8628 | } |
| 8629 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8630 | eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 8631 | { |
| 8632 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerRoaming)); |
| 8633 | } |
| 8634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8635 | void csrRoamWaitForKeyTimeOutHandler(void *pv) |
| 8636 | { |
| 8637 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 8638 | tpAniSirGlobal pMac = pInfo->pMac; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8639 | if( CSR_IS_WAIT_FOR_KEY( pMac, pInfo->sessionId ) ) |
| 8640 | { |
| 8641 | smsLog(pMac, LOGW, " SME pre-auth state timeout. \n "); |
| 8642 | //Change the substate so command queue is unblocked. |
| 8643 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, pInfo->sessionId); |
| 8644 | } |
| 8645 | |
| 8646 | } |
| 8647 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8648 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval) |
| 8649 | { |
| 8650 | eHalStatus status; |
| 8651 | |
| 8652 | smsLog(pMac, LOG1, " csrScanStartWaitForKeyTimer \n "); |
| 8653 | status = palTimerStart(pMac->hHdd, pMac->roam.hTimerWaitForKey, interval, eANI_BOOLEAN_FALSE); |
| 8654 | |
| 8655 | return (status); |
| 8656 | } |
| 8657 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8658 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac) |
| 8659 | { |
| 8660 | return (palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey)); |
| 8661 | } |
| 8662 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8663 | void csrRoamIbssJoinTimerHandler(void *pv) |
| 8664 | { |
| 8665 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 8666 | tpAniSirGlobal pMac = pInfo->pMac; |
| 8667 | eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE; |
| 8668 | tANI_U32 sessionId = pInfo->sessionId; |
| 8669 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8670 | |
| 8671 | pSession->ibss_join_pending = FALSE; |
| 8672 | // JEZ100225: As of main/latest "tip", we are no longer doing this. Check on this. |
| 8673 | //csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 8674 | // Send an IBSS stop request to PE |
| 8675 | csrRoamDisconnectInternal(pMac, sessionId, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8676 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8677 | eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 8678 | { |
| 8679 | eHalStatus status; |
| 8680 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8681 | |
| 8682 | smsLog(pMac, LOG1, " csrRoamStartIbssJoinTimer \n "); |
| 8683 | pSession->ibssJoinTimerInfo.sessionId = (tANI_U8)sessionId; |
| 8684 | status = palTimerStart(pMac->hHdd, pSession->hTimerIbssJoining, interval, eANI_BOOLEAN_FALSE); |
| 8685 | |
| 8686 | return (status); |
| 8687 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8688 | eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 8689 | { |
| 8690 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerIbssJoining)); |
| 8691 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8692 | void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, |
| 8693 | eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess) |
| 8694 | { |
| 8695 | eRoamCmdStatus roamStatus = csrGetRoamCompleteStatus(pMac, sessionId); |
| 8696 | tANI_U32 roamId = 0; |
| 8697 | |
| 8698 | if(pCommand) |
| 8699 | { |
| 8700 | roamId = pCommand->u.roamCmd.roamId; |
| 8701 | #if defined(VOSS_ENABLED) |
| 8702 | VOS_ASSERT( sessionId == pCommand->sessionId ); |
| 8703 | #endif |
| 8704 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8705 | if(eCSR_ROAM_ROAMING_COMPLETION == roamStatus) |
| 8706 | { |
| 8707 | //if success, force roaming completion |
| 8708 | csrRoamCompleteRoaming(pMac, sessionId, fSuccess, roamResult); |
| 8709 | } |
| 8710 | else |
| 8711 | { |
| 8712 | VOS_ASSERT((CSR_GET_SESSION( pMac, sessionId ))->bRefAssocStartCnt == 0); |
| 8713 | smsLog(pMac, LOGW, FL(" indicates association completion. roamResult = %d\n"), roamResult); |
| 8714 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, roamId, roamStatus, roamResult); |
| 8715 | } |
| 8716 | } |
| 8717 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8718 | eHalStatus csrRoamLostLink( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 type, tSirSmeRsp *pSirMsg) |
| 8719 | { |
| 8720 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8721 | tSirSmeDeauthInd *pDeauthIndMsg = NULL; |
| 8722 | tSirSmeDisassocInd *pDisassocIndMsg = NULL; |
| 8723 | eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK; |
| 8724 | tCsrRoamInfo *pRoamInfo = NULL; |
| 8725 | tCsrRoamInfo roamInfo; |
| 8726 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8727 | //Only need to roam for infra station. In this case P2P client will roam as well |
| 8728 | tANI_BOOLEAN fToRoam = CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8729 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
| 8730 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 8731 | { |
| 8732 | result = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 8733 | pDisassocIndMsg = (tSirSmeDisassocInd *)pSirMsg; |
| 8734 | pSession->roamingStatusCode = pDisassocIndMsg->statusCode; |
| 8735 | } |
| 8736 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 8737 | { |
| 8738 | result = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 8739 | pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg; |
| 8740 | pSession->roamingStatusCode = pDeauthIndMsg->statusCode; |
| 8741 | } |
| 8742 | else |
| 8743 | { |
| 8744 | smsLog(pMac, LOGW, FL("gets an unknown type (%d)\n"), type); |
| 8745 | result = eCSR_ROAM_RESULT_NONE; |
| 8746 | } |
| 8747 | |
| 8748 | // call profile lost link routine here |
| 8749 | #ifdef WLAN_SOFTAP_FEATURE |
| 8750 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 8751 | #endif |
| 8752 | { |
| 8753 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_LOSTLINK_DETECTED, result); |
| 8754 | } |
| 8755 | |
| 8756 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 8757 | { |
| 8758 | status = csrSendMBDisassocCnfMsg(pMac, pDisassocIndMsg); |
| 8759 | } |
| 8760 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 8761 | { |
| 8762 | status = csrSendMBDeauthCnfMsg(pMac, pDeauthIndMsg); |
| 8763 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8764 | if(!HAL_STATUS_SUCCESS(status)) |
| 8765 | { |
| 8766 | //If fail to send confirmation to PE, not to trigger roaming |
| 8767 | fToRoam = eANI_BOOLEAN_FALSE; |
| 8768 | } |
| 8769 | |
| 8770 | //tell HDD to disconnect |
| 8771 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 8772 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 8773 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 8774 | #ifdef WLAN_SOFTAP_FEATURE |
| 8775 | if( eWNI_SME_DISASSOC_IND == type) |
| 8776 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 8777 | //staMacAddr |
| 8778 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 8779 | roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId; |
| 8780 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8781 | else if( eWNI_SME_DEAUTH_IND == type ) |
| 8782 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 8783 | //staMacAddr |
| 8784 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 8785 | roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId; |
| 8786 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8787 | #endif |
| 8788 | smsLog(pMac, LOGW, FL("roamInfo.staId (%d)\n"), roamInfo.staId); |
| 8789 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result); |
| 8790 | if(fToRoam) |
| 8791 | { |
| 8792 | //Only remove the connected BSS in infrastructure mode |
| 8793 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 8794 | //Not to do anying for lostlink with WDS |
| 8795 | if( pMac->roam.configParam.nRoamingTime ) |
| 8796 | { |
| 8797 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac, sessionId, |
| 8798 | ( eWNI_SME_DEAUTH_IND == type ) ? |
| 8799 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc))) |
| 8800 | { |
| 8801 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 8802 | //For IBSS, we need to give some more info to HDD |
| 8803 | if(csrIsBssTypeIBSS(pSession->connectedProfile.BSSType)) |
| 8804 | { |
| 8805 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 8806 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 8807 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 8808 | } |
| 8809 | else |
| 8810 | { |
| 8811 | roamInfo.reasonCode = eCsrRoamReasonSmeIssuedForLostLink; |
| 8812 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 8813 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8814 | pSession->roamingReason = ( eWNI_SME_DEAUTH_IND == type ) ? |
| 8815 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc; |
| 8816 | pSession->roamingStartTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 8817 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_LOSTLINK); |
| 8818 | } |
| 8819 | else |
| 8820 | { |
| 8821 | smsLog(pMac, LOGW, " %s Fail to start roaming, status = %d", __FUNCTION__, status); |
| 8822 | fToRoam = eANI_BOOLEAN_FALSE; |
| 8823 | } |
| 8824 | } |
| 8825 | else |
| 8826 | { |
| 8827 | //We are told not to roam, indicate lostlink |
| 8828 | fToRoam = eANI_BOOLEAN_FALSE; |
| 8829 | } |
| 8830 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8831 | if(!fToRoam) |
| 8832 | { |
| 8833 | if( eWNI_SME_DISASSOC_IND == type) |
| 8834 | { |
| 8835 | //staMacAddr |
| 8836 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 8837 | roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId; |
| 8838 | } |
| 8839 | else if( eWNI_SME_DEAUTH_IND == type ) |
| 8840 | { |
| 8841 | //staMacAddr |
| 8842 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 8843 | roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId; |
| 8844 | } |
| 8845 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result); |
| 8846 | |
| 8847 | /*No need to start idle scan in case of IBSS/SAP |
| 8848 | Still enable idle scan for polling in case concurrent sessions are running */ |
| 8849 | if(CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile)) |
| 8850 | { |
| 8851 | csrScanStartIdleScan(pMac); |
| 8852 | } |
| 8853 | } |
| 8854 | |
| 8855 | return (status); |
| 8856 | } |
| 8857 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8858 | eHalStatus csrRoamLostLinkAfterhandoffFailure( tpAniSirGlobal pMac,tANI_U32 sessionId) |
| 8859 | { |
| 8860 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8861 | tListElem *pEntry = NULL; |
| 8862 | tSmeCmd *pCommand = NULL; |
| 8863 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8864 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8865 | //Only remove the connected BSS in infrastructure mode |
| 8866 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 8867 | if(pMac->roam.configParam.nRoamingTime) |
| 8868 | { |
| 8869 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac,sessionId, pSession->roamingReason))) |
| 8870 | { |
| 8871 | //before starting the lost link logic release the roam command for handoff |
| 8872 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 8873 | if(pEntry) |
| 8874 | { |
| 8875 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 8876 | } |
| 8877 | if(pCommand) |
| 8878 | { |
| 8879 | if (( eSmeCommandRoam == pCommand->command ) && |
| 8880 | ( eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)) |
| 8881 | { |
| 8882 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 8883 | { |
| 8884 | csrReleaseCommandRoam( pMac, pCommand ); |
| 8885 | } |
| 8886 | } |
| 8887 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8888 | smsLog( pMac, LOGW, "Lost link roaming started ...\n"); |
| 8889 | } |
| 8890 | } |
| 8891 | else |
| 8892 | { |
| 8893 | //We are told not to roam, indicate lostlink |
| 8894 | status = eHAL_STATUS_FAILURE; |
| 8895 | } |
| 8896 | |
| 8897 | return (status); |
| 8898 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8899 | void csrRoamWmStatusChangeComplete( tpAniSirGlobal pMac ) |
| 8900 | { |
| 8901 | tListElem *pEntry; |
| 8902 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8903 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 8904 | if ( pEntry ) |
| 8905 | { |
| 8906 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 8907 | if ( eSmeCommandWmStatusChange == pCommand->command ) |
| 8908 | { |
| 8909 | // Nothing to process in a Lost Link completion.... It just kicks off a |
| 8910 | // roaming sequence. |
| 8911 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 8912 | { |
| 8913 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 8914 | } |
| 8915 | else |
| 8916 | { |
| 8917 | smsLog( pMac, LOGE, " ******csrRoamWmStatusChangeComplete fail to release command\n"); |
| 8918 | } |
| 8919 | |
| 8920 | } |
| 8921 | else |
| 8922 | { |
| 8923 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but LOST LINK command is not ACTIVE ...\n" ); |
| 8924 | } |
| 8925 | } |
| 8926 | else |
| 8927 | { |
| 8928 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but NO commands are ACTIVE ...\n" ); |
| 8929 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8930 | smeProcessPendingQueue( pMac ); |
| 8931 | } |
| 8932 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8933 | void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8934 | { |
| 8935 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 8936 | tSirSmeRsp *pSirSmeMsg; |
| 8937 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pCommand->sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8938 | switch ( pCommand->u.wmStatusChangeCmd.Type ) |
| 8939 | { |
| 8940 | case eCsrDisassociated: |
| 8941 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg; |
| 8942 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DISASSOC_IND, pSirSmeMsg); |
| 8943 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8944 | case eCsrDeauthenticated: |
| 8945 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg; |
| 8946 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DEAUTH_IND, pSirSmeMsg); |
| 8947 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8948 | default: |
| 8949 | smsLog(pMac, LOGW, FL("gets an unknown command %d\n"), pCommand->u.wmStatusChangeCmd.Type); |
| 8950 | break; |
| 8951 | } |
| 8952 | //For WDS, we want to stop BSS as well when it is indicated that it is disconnected. |
| 8953 | if( CSR_IS_CONN_WDS(&pSession->connectedProfile) ) |
| 8954 | { |
| 8955 | if( !HAL_STATUS_SUCCESS(csrRoamIssueStopBssCmd( pMac, pCommand->sessionId, eANI_BOOLEAN_TRUE )) ) |
| 8956 | { |
| 8957 | //This is not good |
| 8958 | smsLog(pMac, LOGE, FL(" failed to issue stopBSS command\n")); |
| 8959 | } |
| 8960 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8961 | // Lost Link just triggers a roaming sequence. We can complte the Lost Link |
| 8962 | // command here since there is nothing else to do. |
| 8963 | csrRoamWmStatusChangeComplete( pMac ); |
| 8964 | } |
| 8965 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8966 | //This function returns band and mode information. |
| 8967 | //The only tricky part is that if phyMode is set to 11abg, this function may return eCSR_CFG_DOT11_MODE_11B |
| 8968 | //instead of eCSR_CFG_DOT11_MODE_11G if everything is set to auto-pick. |
| 8969 | #ifdef WLAN_SOFTAP_FEATURE |
| 8970 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 8971 | tANI_U8 operationChn, eCsrBand *pBand ) |
| 8972 | #else |
| 8973 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, eCsrPhyMode phyModeIn, |
| 8974 | tANI_U8 operationChn, eCsrBand *pBand ) |
| 8975 | #endif |
| 8976 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8977 | #ifdef WLAN_SOFTAP_FEATURE |
| 8978 | eCsrPhyMode phyModeIn = (eCsrPhyMode)pProfile->phyMode; |
| 8979 | eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pProfile, phyModeIn, |
| 8980 | pMac->roam.configParam.ProprietaryRatesEnabled); |
| 8981 | #else |
| 8982 | eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(phyModeIn, |
| 8983 | pMac->roam.configParam.ProprietaryRatesEnabled); |
| 8984 | #endif |
| 8985 | eCsrBand eBand; |
| 8986 | |
| 8987 | //If the global setting for dot11Mode is set to auto/abg, we overwrite the setting in the profile. |
| 8988 | #ifdef WLAN_SOFTAP_FEATURE |
| 8989 | if( ((!CSR_IS_INFRA_AP(pProfile )&& !CSR_IS_WDS(pProfile )) && |
| 8990 | ((eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) || |
| 8991 | (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode))) || |
| 8992 | (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) ) |
| 8993 | #else |
| 8994 | if( (eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) || |
| 8995 | (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode) || |
| 8996 | (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8997 | #endif |
| 8998 | { |
| 8999 | switch( pMac->roam.configParam.uCfgDot11Mode ) |
| 9000 | { |
| 9001 | case eCSR_CFG_DOT11_MODE_11A: |
| 9002 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 9003 | eBand = eCSR_BAND_5G; |
| 9004 | break; |
| 9005 | case eCSR_CFG_DOT11_MODE_11B: |
| 9006 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9007 | eBand = eCSR_BAND_24; |
| 9008 | break; |
| 9009 | case eCSR_CFG_DOT11_MODE_11G: |
| 9010 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 9011 | eBand = eCSR_BAND_24; |
| 9012 | break; |
| 9013 | case eCSR_CFG_DOT11_MODE_11N: |
| 9014 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 9015 | eBand = eCSR_BAND_24; |
| 9016 | break; |
| 9017 | //case eCSR_CFG_DOT11_MODE_BEST: |
| 9018 | // cfgDot11Mode = eCSR_CFG_DOT11_MODE_BEST; |
| 9019 | // eBand = eCSR_BAND_24; |
| 9020 | // break; |
| 9021 | default: |
| 9022 | // Global dot11 Mode setting is 11a/b/g. |
| 9023 | // use the channel number to determine the Mode setting. |
| 9024 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 9025 | { |
| 9026 | eBand = pMac->roam.configParam.eBand; |
| 9027 | if(eCSR_BAND_24 == eBand) |
| 9028 | { |
| 9029 | //See reason in else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) to pick 11B |
| 9030 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9031 | } |
| 9032 | else |
| 9033 | { |
| 9034 | //prefer 5GHz |
| 9035 | eBand = eCSR_BAND_5G; |
| 9036 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 9037 | } |
| 9038 | } |
| 9039 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 9040 | { |
| 9041 | // channel is a 2.4GHz channel. Set mode to 11g. |
| 9042 | // |
| 9043 | // !!LAC - WiFi tests require IBSS networks to start in 11b mode without any change to the |
| 9044 | // default parameter settings on the adapter. We use ACU to start an IBSS through creation |
| 9045 | // of a startIBSS profile. this startIBSS profile has Auto MACProtocol and the |
| 9046 | // adapter property setting for dot11Mode is also AUTO. So in this case, let's start |
| 9047 | // the IBSS network in 11b mode instead of 11g mode. |
| 9048 | // |
| 9049 | // so this is for Auto=profile->MacProtocol && Auto=Global.dot11Mode && profile->channel is < 14, |
| 9050 | // then start the IBSS in b mode. |
| 9051 | // |
| 9052 | // Note: we used to have this start as an 11g IBSS for best performance... now to specify that |
| 9053 | // the user will have to set the do11Mode in the property page to 11g to force it. |
| 9054 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9055 | eBand = eCSR_BAND_24; |
| 9056 | } |
| 9057 | else |
| 9058 | { |
| 9059 | // else, it's a 5.0GHz channel. Set mode to 11a. |
| 9060 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 9061 | eBand = eCSR_BAND_5G; |
| 9062 | } |
| 9063 | break; |
| 9064 | }//switch |
| 9065 | }//if( eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 9066 | else |
| 9067 | { |
| 9068 | //dot11 mode is set, lets pick the band |
| 9069 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 9070 | { |
| 9071 | // channel is Auto also. |
| 9072 | eBand = pMac->roam.configParam.eBand; |
| 9073 | if(eCSR_BAND_ALL == eBand) |
| 9074 | { |
| 9075 | //prefer 5GHz |
| 9076 | eBand = eCSR_BAND_5G; |
| 9077 | } |
| 9078 | } |
| 9079 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 9080 | { |
| 9081 | eBand = eCSR_BAND_24; |
| 9082 | } |
| 9083 | else |
| 9084 | { |
| 9085 | eBand = eCSR_BAND_5G; |
| 9086 | } |
| 9087 | } |
| 9088 | if(pBand) |
| 9089 | { |
| 9090 | *pBand = eBand; |
| 9091 | } |
| 9092 | |
| 9093 | if (operationChn == 14){ |
| 9094 | smsLog(pMac, LOGE, FL(" Switching to Dot11B mode \n")); |
| 9095 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9096 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9097 | return( cfgDot11Mode ); |
| 9098 | } |
| 9099 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9100 | eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 9101 | { |
| 9102 | eHalStatus status; |
| 9103 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9105 | |
| 9106 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9107 | { |
| 9108 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9109 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9110 | if(pIbssLog) |
| 9111 | { |
| 9112 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_REQ; |
| 9113 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9114 | } |
| 9115 | } |
| 9116 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9117 | pSession->ibss_join_pending = FALSE; |
| 9118 | csrRoamStopIbssJoinTimer(pMac, sessionId ); |
| 9119 | // Set the roaming substate to 'stop Bss request'... |
| 9120 | csrRoamSubstateChange( pMac, NewSubstate, sessionId ); |
| 9121 | |
| 9122 | // attempt to stop the Bss (reason code is ignored...) |
| 9123 | status = csrSendMBStopBssReqMsg( pMac, sessionId ); |
| 9124 | |
| 9125 | return (status); |
| 9126 | } |
| 9127 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9128 | //pNumChan is a caller allocated space with the sizeof pChannels |
| 9129 | eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan) |
| 9130 | { |
| 9131 | |
| 9132 | return (ccmCfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 9133 | (tANI_U8 *)pChannels, |
| 9134 | pNumChan)); |
| 9135 | } |
| 9136 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9137 | tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel ) |
| 9138 | { |
| 9139 | tANI_BOOLEAN fValid = FALSE; |
| 9140 | tANI_U32 idxValidChannels; |
| 9141 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 9142 | |
| 9143 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len))) |
| 9144 | { |
| 9145 | for ( idxValidChannels = 0; ( idxValidChannels < len ); idxValidChannels++ ) |
| 9146 | { |
| 9147 | if ( channel == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 9148 | { |
| 9149 | fValid = TRUE; |
| 9150 | break; |
| 9151 | } |
| 9152 | } |
| 9153 | } |
| 9154 | pMac->roam.numValidChannels = len; |
| 9155 | return fValid; |
| 9156 | } |
| 9157 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9158 | tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel) |
| 9159 | { |
| 9160 | tANI_BOOLEAN fValid = eANI_BOOLEAN_FALSE; |
| 9161 | tANI_U8 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9162 | for(i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++) |
| 9163 | { |
| 9164 | if(channel == pMac->scan.base40MHzChannels.channelList[i]) |
| 9165 | { |
| 9166 | fValid = eANI_BOOLEAN_TRUE; |
| 9167 | break; |
| 9168 | } |
| 9169 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9170 | return (fValid); |
| 9171 | } |
| 9172 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9173 | //This function check and validate whether the NIC can do CB (40MHz) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9174 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9175 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9176 | ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9177 | tANI_U8 centerChn; |
| 9178 | tANI_U32 ChannelBondingMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9179 | if(CSR_IS_CHANNEL_24GHZ(primaryChn)) |
| 9180 | { |
| 9181 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 9182 | } |
| 9183 | else |
| 9184 | { |
| 9185 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 9186 | } |
| 9187 | //Figure what the other side's CB mode |
| 9188 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 9189 | { |
| 9190 | if(pIes->HTCaps.present && (eHT_CHANNEL_WIDTH_40MHZ == pIes->HTCaps.supportedChannelWidthSet)) |
| 9191 | { |
| 9192 | if(pIes->HTInfo.present) |
| 9193 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9194 | /* This is called during INFRA STA/CLIENT and should use the merged value of |
| 9195 | * supported channel width and recommended tx width as per standard |
| 9196 | */ |
| 9197 | smsLog(pMac, LOG1, "scws %u rtws %u sco %u\n", |
| 9198 | pIes->HTCaps.supportedChannelWidthSet, |
| 9199 | pIes->HTInfo.recommendedTxWidthSet, |
| 9200 | pIes->HTInfo.secondaryChannelOffset); |
| 9201 | |
| 9202 | if (pIes->HTInfo.recommendedTxWidthSet == eHT_CHANNEL_WIDTH_40MHZ) |
| 9203 | eRet = (ePhyChanBondState)pIes->HTInfo.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9204 | else |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9205 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 9206 | switch (eRet) { |
| 9207 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 9208 | centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET; |
| 9209 | break; |
| 9210 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 9211 | centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET; |
| 9212 | break; |
| 9213 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 9214 | default: |
| 9215 | centerChn = primaryChn; |
| 9216 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9217 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9218 | if((PHY_SINGLE_CHANNEL_CENTERED != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9219 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9220 | smsLog(pMac, LOGE, " Invalid center channel (%d), disable 40MHz mode\n", centerChn); |
| 9221 | //eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9222 | } |
| 9223 | } |
| 9224 | } |
| 9225 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9226 | return eRet; |
| 9227 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9228 | tANI_BOOLEAN csrIsEncryptionInList( tpAniSirGlobal pMac, tCsrEncryptionList *pCipherList, eCsrEncryptionType encryptionType ) |
| 9229 | { |
| 9230 | tANI_BOOLEAN fFound = FALSE; |
| 9231 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9232 | for( idx = 0; idx < pCipherList->numEntries; idx++ ) |
| 9233 | { |
| 9234 | if( pCipherList->encryptionType[idx] == encryptionType ) |
| 9235 | { |
| 9236 | fFound = TRUE; |
| 9237 | break; |
| 9238 | } |
| 9239 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9240 | return fFound; |
| 9241 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9242 | tANI_BOOLEAN csrIsAuthInList( tpAniSirGlobal pMac, tCsrAuthList *pAuthList, eCsrAuthType authType ) |
| 9243 | { |
| 9244 | tANI_BOOLEAN fFound = FALSE; |
| 9245 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9246 | for( idx = 0; idx < pAuthList->numEntries; idx++ ) |
| 9247 | { |
| 9248 | if( pAuthList->authType[idx] == authType ) |
| 9249 | { |
| 9250 | fFound = TRUE; |
| 9251 | break; |
| 9252 | } |
| 9253 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9254 | return fFound; |
| 9255 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9256 | tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2) |
| 9257 | { |
| 9258 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 9259 | tCsrScanResultFilter *pScanFilter = NULL; |
| 9260 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9261 | |
| 9262 | if(pProfile1 && pProfile2) |
| 9263 | { |
| 9264 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 9265 | if(HAL_STATUS_SUCCESS(status)) |
| 9266 | { |
| 9267 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 9268 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile2, pScanFilter); |
| 9269 | if(HAL_STATUS_SUCCESS(status)) |
| 9270 | { |
| 9271 | fCheck = eANI_BOOLEAN_FALSE; |
| 9272 | do |
| 9273 | { |
| 9274 | tANI_U32 i; |
| 9275 | for(i = 0; i < pScanFilter->SSIDs.numOfSSIDs; i++) |
| 9276 | { |
| 9277 | fCheck = csrIsSsidMatch( pMac, pScanFilter->SSIDs.SSIDList[i].SSID.ssId, |
| 9278 | pScanFilter->SSIDs.SSIDList[i].SSID.length, |
| 9279 | pProfile1->SSID.ssId, pProfile1->SSID.length, eANI_BOOLEAN_FALSE ); |
| 9280 | if ( fCheck ) break; |
| 9281 | } |
| 9282 | if(!fCheck) |
| 9283 | { |
| 9284 | break; |
| 9285 | } |
| 9286 | if( !csrIsAuthInList( pMac, &pProfile2->AuthType, pProfile1->AuthType) |
| 9287 | || pProfile2->BSSType != pProfile1->BSSType |
| 9288 | || !csrIsEncryptionInList( pMac, &pProfile2->EncryptionType, pProfile1->EncryptionType ) |
| 9289 | ) |
| 9290 | { |
| 9291 | fCheck = eANI_BOOLEAN_FALSE; |
| 9292 | break; |
| 9293 | } |
| 9294 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9295 | if (pProfile1->MDID.mdiePresent || pProfile2->MDID.mdiePresent) |
| 9296 | { |
| 9297 | if (pProfile1->MDID.mobilityDomain != pProfile2->MDID.mobilityDomain) |
| 9298 | { |
| 9299 | fCheck = eANI_BOOLEAN_FALSE; |
| 9300 | break; |
| 9301 | } |
| 9302 | } |
| 9303 | #endif |
| 9304 | //Match found |
| 9305 | fCheck = eANI_BOOLEAN_TRUE; |
| 9306 | }while(0); |
| 9307 | csrFreeScanFilter(pMac, pScanFilter); |
| 9308 | } |
| 9309 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 9310 | } |
| 9311 | } |
| 9312 | |
| 9313 | return (fCheck); |
| 9314 | } |
| 9315 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9316 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2) |
| 9317 | { |
| 9318 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 9319 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9320 | do |
| 9321 | { |
| 9322 | //Only check for static WEP |
| 9323 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) && |
| 9324 | !csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) |
| 9325 | { |
| 9326 | fCheck = eANI_BOOLEAN_TRUE; |
| 9327 | break; |
| 9328 | } |
| 9329 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, pConnProfile->EncryptionType)) break; |
| 9330 | if(pConnProfile->Keys.defaultIndex != pProfile2->Keys.defaultIndex) break; |
| 9331 | for(i = 0; i < CSR_MAX_NUM_KEY; i++) |
| 9332 | { |
| 9333 | if(pConnProfile->Keys.KeyLength[i] != pProfile2->Keys.KeyLength[i]) break; |
| 9334 | if(!palEqualMemory(pMac->hHdd, &pConnProfile->Keys.KeyMaterial[i], |
| 9335 | &pProfile2->Keys.KeyMaterial[i], pProfile2->Keys.KeyLength[i])) |
| 9336 | { |
| 9337 | break; |
| 9338 | } |
| 9339 | } |
| 9340 | if( i == CSR_MAX_NUM_KEY) |
| 9341 | { |
| 9342 | fCheck = eANI_BOOLEAN_TRUE; |
| 9343 | } |
| 9344 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9345 | return (fCheck); |
| 9346 | } |
| 9347 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9348 | //IBSS |
| 9349 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9350 | tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac ) |
| 9351 | { |
| 9352 | tANI_U8 channel = 0; |
| 9353 | tANI_U32 idx; |
| 9354 | tANI_U32 idxValidChannels; |
| 9355 | tANI_BOOLEAN fFound = FALSE; |
| 9356 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 9357 | |
| 9358 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel5G) |
| 9359 | { |
| 9360 | channel = pMac->roam.configParam.AdHocChannel5G; |
| 9361 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 9362 | { |
| 9363 | channel = 0; |
| 9364 | } |
| 9365 | } |
| 9366 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 9367 | { |
| 9368 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_50 ) && !fFound; idx++ ) |
| 9369 | { |
| 9370 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 9371 | { |
| 9372 | if ( csrStartIbssChannels50[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 9373 | { |
| 9374 | fFound = TRUE; |
| 9375 | channel = csrStartIbssChannels50[ idx ]; |
| 9376 | } |
| 9377 | } |
| 9378 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9379 | // this is rare, but if it does happen, we find anyone in 11a bandwidth and return the first 11a channel found! |
| 9380 | if (!fFound) |
| 9381 | { |
| 9382 | for ( idxValidChannels = 0; idxValidChannels < len ; idxValidChannels++ ) |
| 9383 | { |
| 9384 | if ( CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ idx ]) ) // the max channel# in 11g is 14 |
| 9385 | { |
| 9386 | channel = csrStartIbssChannels50[ idx ]; |
| 9387 | break; |
| 9388 | } |
| 9389 | } |
| 9390 | } |
| 9391 | }//if |
| 9392 | |
| 9393 | return( channel ); |
| 9394 | } |
| 9395 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9396 | tANI_U8 csrRoamGetIbssStartChannelNumber24( tpAniSirGlobal pMac ) |
| 9397 | { |
| 9398 | tANI_U8 channel = 1; |
| 9399 | tANI_U32 idx; |
| 9400 | tANI_U32 idxValidChannels; |
| 9401 | tANI_BOOLEAN fFound = FALSE; |
| 9402 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 9403 | |
| 9404 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel24) |
| 9405 | { |
| 9406 | channel = pMac->roam.configParam.AdHocChannel24; |
| 9407 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 9408 | { |
| 9409 | channel = 0; |
| 9410 | } |
| 9411 | } |
| 9412 | |
| 9413 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 9414 | { |
| 9415 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_24 ) && !fFound; idx++ ) |
| 9416 | { |
| 9417 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 9418 | { |
| 9419 | if ( csrStartIbssChannels24[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 9420 | { |
| 9421 | fFound = TRUE; |
| 9422 | channel = csrStartIbssChannels24[ idx ]; |
| 9423 | } |
| 9424 | } |
| 9425 | } |
| 9426 | } |
| 9427 | |
| 9428 | return( channel ); |
| 9429 | } |
| 9430 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9431 | static void csrRoamGetBssStartParms( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 9432 | tCsrRoamStartBssParams *pParam ) |
| 9433 | { |
| 9434 | eCsrCfgDot11Mode cfgDot11Mode; |
| 9435 | eCsrBand eBand; |
| 9436 | tANI_U8 channel = 0; |
| 9437 | tSirNwType nwType; |
| 9438 | tANI_U8 operationChannel = 0; |
| 9439 | |
| 9440 | if(pProfile->ChannelInfo.numOfChannels && pProfile->ChannelInfo.ChannelList) |
| 9441 | { |
| 9442 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 9443 | } |
| 9444 | |
| 9445 | #ifdef WLAN_SOFTAP_FEATURE |
| 9446 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
| 9447 | #else |
| 9448 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, (eCsrPhyMode)pProfile->phyMode, operationChannel, &eBand ); |
| 9449 | #endif |
| 9450 | |
| 9451 | #ifdef WLAN_FEATURE_P2P |
| 9452 | if( ( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 9453 | (pProfile->csrPersona == VOS_P2P_GO_MODE) ) |
| 9454 | && ( cfgDot11Mode == eCSR_CFG_DOT11_MODE_11B) |
| 9455 | ) |
| 9456 | { |
| 9457 | /* This should never happen */ |
| 9458 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
| 9459 | FL("For P2PClient/P2P-GO (persona %d) cfgDot11Mode is 11B\n"), |
| 9460 | pProfile->csrPersona); |
| 9461 | VOS_ASSERT(0); |
| 9462 | } |
| 9463 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9464 | switch( cfgDot11Mode ) |
| 9465 | { |
| 9466 | case eCSR_CFG_DOT11_MODE_11G: |
| 9467 | nwType = eSIR_11G_NW_TYPE; |
| 9468 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9469 | case eCSR_CFG_DOT11_MODE_11B: |
| 9470 | nwType = eSIR_11B_NW_TYPE; |
| 9471 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9472 | case eCSR_CFG_DOT11_MODE_11A: |
| 9473 | nwType = eSIR_11A_NW_TYPE; |
| 9474 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9475 | default: |
| 9476 | case eCSR_CFG_DOT11_MODE_11N: |
| 9477 | case eCSR_CFG_DOT11_MODE_TAURUS: |
| 9478 | //Because LIM only verifies it against 11a, 11b or 11g, set only 11g or 11a here |
| 9479 | if(eCSR_BAND_24 == eBand) |
| 9480 | { |
| 9481 | nwType = eSIR_11G_NW_TYPE; |
| 9482 | } |
| 9483 | else |
| 9484 | { |
| 9485 | nwType = eSIR_11A_NW_TYPE; |
| 9486 | } |
| 9487 | break; |
| 9488 | } |
| 9489 | |
| 9490 | pParam->extendedRateSet.numRates = 0; |
| 9491 | |
| 9492 | switch ( nwType ) |
| 9493 | { |
| 9494 | default: |
| 9495 | smsLog(pMac, LOGE, FL("sees an unknown pSirNwType (%d)\n"), nwType); |
| 9496 | case eSIR_11A_NW_TYPE: |
| 9497 | |
| 9498 | pParam->operationalRateSet.numRates = 8; |
| 9499 | |
| 9500 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 9501 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 9502 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 9503 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 9504 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 9505 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 9506 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 9507 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 9508 | |
| 9509 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 9510 | { |
| 9511 | channel = csrRoamGetIbssStartChannelNumber50( pMac ); |
| 9512 | if( 0 == channel && |
| 9513 | CSR_IS_PHY_MODE_DUAL_BAND(pProfile->phyMode) && |
| 9514 | CSR_IS_PHY_MODE_DUAL_BAND(pMac->roam.configParam.phyMode) |
| 9515 | ) |
| 9516 | { |
| 9517 | //We could not find a 5G channel by auto pick, let's try 2.4G channels |
| 9518 | //We only do this here because csrRoamGetPhyModeBandForBss always picks 11a for AUTO |
| 9519 | nwType = eSIR_11B_NW_TYPE; |
| 9520 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 9521 | pParam->operationalRateSet.numRates = 4; |
| 9522 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 9523 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 9524 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 9525 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 9526 | } |
| 9527 | } |
| 9528 | else |
| 9529 | { |
| 9530 | channel = operationChannel; |
| 9531 | } |
| 9532 | break; |
| 9533 | |
| 9534 | case eSIR_11B_NW_TYPE: |
| 9535 | pParam->operationalRateSet.numRates = 4; |
| 9536 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 9537 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 9538 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 9539 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9540 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 9541 | { |
| 9542 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 9543 | } |
| 9544 | else |
| 9545 | { |
| 9546 | channel = operationChannel; |
| 9547 | } |
| 9548 | |
| 9549 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9550 | case eSIR_11G_NW_TYPE: |
| 9551 | #ifdef WLAN_FEATURE_P2P |
| 9552 | /* For P2P Client and P2P GO, disable 11b rates */ |
| 9553 | if( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 9554 | (pProfile->csrPersona == VOS_P2P_GO_MODE) |
| 9555 | ) |
| 9556 | { |
| 9557 | pParam->operationalRateSet.numRates = 8; |
| 9558 | |
| 9559 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 9560 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 9561 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 9562 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 9563 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 9564 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 9565 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 9566 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 9567 | } |
| 9568 | else |
| 9569 | #endif |
| 9570 | { |
| 9571 | pParam->operationalRateSet.numRates = 4; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9572 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 9573 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 9574 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 9575 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 9576 | |
| 9577 | pParam->extendedRateSet.numRates = 8; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9578 | pParam->extendedRateSet.rate[0] = SIR_MAC_RATE_6; |
| 9579 | pParam->extendedRateSet.rate[1] = SIR_MAC_RATE_9; |
| 9580 | pParam->extendedRateSet.rate[2] = SIR_MAC_RATE_12; |
| 9581 | pParam->extendedRateSet.rate[3] = SIR_MAC_RATE_18; |
| 9582 | pParam->extendedRateSet.rate[4] = SIR_MAC_RATE_24; |
| 9583 | pParam->extendedRateSet.rate[5] = SIR_MAC_RATE_36; |
| 9584 | pParam->extendedRateSet.rate[6] = SIR_MAC_RATE_48; |
| 9585 | pParam->extendedRateSet.rate[7] = SIR_MAC_RATE_54; |
| 9586 | } |
| 9587 | |
| 9588 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 9589 | { |
| 9590 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 9591 | } |
| 9592 | else |
| 9593 | { |
| 9594 | channel = operationChannel; |
| 9595 | } |
| 9596 | |
| 9597 | break; |
| 9598 | } |
| 9599 | pParam->operationChn = channel; |
| 9600 | pParam->sirNwType = nwType; |
| 9601 | } |
| 9602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9603 | static void csrRoamGetBssStartParmsFromBssDesc( tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, |
| 9604 | tDot11fBeaconIEs *pIes, tCsrRoamStartBssParams *pParam ) |
| 9605 | { |
| 9606 | |
| 9607 | if( pParam ) |
| 9608 | { |
| 9609 | pParam->sirNwType = pBssDesc->nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9610 | pParam->cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9611 | pParam->operationChn = pBssDesc->channelId; |
| 9612 | palCopyMemory( pMac->hHdd, &pParam->bssid, pBssDesc->bssId, sizeof(tCsrBssid) ); |
| 9613 | |
| 9614 | if( pIes ) |
| 9615 | { |
| 9616 | if(pIes->SuppRates.present) |
| 9617 | { |
| 9618 | pParam->operationalRateSet.numRates = pIes->SuppRates.num_rates; |
| 9619 | if(pIes->SuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) |
| 9620 | { |
| 9621 | smsLog(pMac, LOGE, FL("num_rates :%d is more than SIR_MAC_RATESET_EID_MAX, resetting to SIR_MAC_RATESET_EID_MAX\n"), |
| 9622 | pIes->SuppRates.num_rates); |
| 9623 | pIes->SuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
| 9624 | } |
| 9625 | palCopyMemory(pMac->hHdd, pParam->operationalRateSet.rate, pIes->SuppRates.rates, |
| 9626 | sizeof(*pIes->SuppRates.rates) * pIes->SuppRates.num_rates); |
| 9627 | } |
| 9628 | if( pIes->SSID.present ) |
| 9629 | { |
| 9630 | pParam->ssId.length = pIes->SSID.num_ssid; |
| 9631 | palCopyMemory(pMac->hHdd, pParam->ssId.ssId, pIes->SSID.ssid, pParam->ssId.length); |
| 9632 | } |
| 9633 | pParam->cbMode = csrGetCBModeFromIes(pMac, pParam->operationChn, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9634 | } |
| 9635 | else |
| 9636 | { |
| 9637 | pParam->ssId.length = 0; |
| 9638 | pParam->operationalRateSet.numRates = 0; |
| 9639 | } |
| 9640 | } |
| 9641 | } |
| 9642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9643 | static void csrRoamDetermineMaxRateForAdHoc( tpAniSirGlobal pMac, tSirMacRateSet *pSirRateSet ) |
| 9644 | { |
| 9645 | tANI_U8 MaxRate = 0; |
| 9646 | tANI_U32 i; |
| 9647 | tANI_U8 *pRate; |
| 9648 | |
| 9649 | pRate = pSirRateSet->rate; |
| 9650 | for ( i = 0; i < pSirRateSet->numRates; i++ ) |
| 9651 | { |
| 9652 | MaxRate = CSR_MAX( MaxRate, ( pRate[ i ] & (~CSR_DOT11_BASIC_RATE_MASK) ) ); |
| 9653 | } |
| 9654 | |
| 9655 | // Save the max rate in the connected state information... |
| 9656 | |
| 9657 | // modify LastRates variable as well |
| 9658 | |
| 9659 | return; |
| 9660 | } |
| 9661 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9662 | //this function finds a valid secondary channel for channel bonding with "channel". |
| 9663 | //Param: channel -- primary channel, caller must validate it |
| 9664 | // cbChoice -- CB directory |
| 9665 | //Return: if 0, no secondary channel is found. Otherwise a valid secondary channel. |
| 9666 | static tANI_U8 csrRoamGetSecondaryChannel(tpAniSirGlobal pMac, tANI_U8 channel, eCsrCBChoice cbChoice) |
| 9667 | { |
| 9668 | tANI_U8 chnUp = 0, chnDown = 0, chnRet = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9669 | switch (cbChoice) |
| 9670 | { |
| 9671 | case eCSR_CB_OFF: |
| 9672 | chnUp = 0; |
| 9673 | chnDown = 0; |
| 9674 | break; |
| 9675 | case eCSR_CB_DOWN: |
| 9676 | chnUp = 0; |
| 9677 | chnDown = channel - CSR_CB_CHANNEL_GAP; |
| 9678 | break; |
| 9679 | case eCSR_CB_UP: |
| 9680 | chnUp = channel + CSR_CB_CHANNEL_GAP; |
| 9681 | chnDown = 0; |
| 9682 | break; |
| 9683 | case eCSR_CB_AUTO: |
| 9684 | //consider every other value means auto |
| 9685 | default: |
| 9686 | chnUp = channel + CSR_CB_CHANNEL_GAP; |
| 9687 | chnDown = channel - CSR_CB_CHANNEL_GAP; |
| 9688 | break; |
| 9689 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9690 | //if CB_UP or auto, try channel up first |
| 9691 | if(chnUp && CSR_IS_SAME_BAND_CHANNELS(chnUp, channel) && csrRoamIsChannelValid(pMac, chnUp)) |
| 9692 | { |
| 9693 | //found a valid up channel for channel bonding |
| 9694 | //check whether the center channel is valid |
| 9695 | if(csrRoamIsValid40MhzChannel(pMac, channel + CSR_CB_CENTER_CHANNEL_OFFSET)) |
| 9696 | { |
| 9697 | chnRet = chnUp; |
| 9698 | } |
| 9699 | } |
| 9700 | if(chnRet == 0 && chnDown && CSR_IS_SAME_BAND_CHANNELS(chnDown, channel) && csrRoamIsChannelValid(pMac, chnDown)) |
| 9701 | { |
| 9702 | //found a valid down channel for channel bonding |
| 9703 | if(csrRoamIsValid40MhzChannel(pMac, channel - CSR_CB_CENTER_CHANNEL_OFFSET)) |
| 9704 | { |
| 9705 | chnRet = chnDown; |
| 9706 | } |
| 9707 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9708 | return chnRet; |
| 9709 | } |
| 9710 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9711 | eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, |
| 9712 | tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId ) |
| 9713 | { |
| 9714 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9715 | eCsrBand eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9716 | // Set the roaming substate to 'Start BSS attempt'... |
| 9717 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9718 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9719 | //Need to figure out whether we need to log WDS??? |
| 9720 | if( CSR_IS_IBSS( pProfile ) ) |
| 9721 | { |
| 9722 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9723 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9724 | if(pIbssLog) |
| 9725 | { |
| 9726 | if(pBssDesc) |
| 9727 | { |
| 9728 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_REQ; |
| 9729 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pBssDesc->bssId, 6); |
| 9730 | } |
| 9731 | else |
| 9732 | { |
| 9733 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_REQ; |
| 9734 | } |
| 9735 | palCopyMemory(pMac->hHdd, pIbssLog->ssid, pParam->ssId.ssId, |
| 9736 | pParam->ssId.length); |
| 9737 | if(pProfile->ChannelInfo.numOfChannels == 0) |
| 9738 | { |
| 9739 | pIbssLog->channelSetting = AUTO_PICK; |
| 9740 | } |
| 9741 | else |
| 9742 | { |
| 9743 | pIbssLog->channelSetting = SPECIFIED; |
| 9744 | } |
| 9745 | pIbssLog->operatingChannel = pParam->operationChn; |
| 9746 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9747 | } |
| 9748 | } |
| 9749 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9750 | //Put RSN information in for Starting BSS |
| 9751 | pParam->nRSNIELength = (tANI_U16)pProfile->nRSNReqIELength; |
| 9752 | pParam->pRSNIE = pProfile->pRSNReqIE; |
| 9753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9754 | #ifdef WLAN_SOFTAP_FEATURE |
| 9755 | pParam->privacy = pProfile->privacy; |
| 9756 | pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq; |
| 9757 | pParam->authType = pProfile->csr80211AuthType; |
| 9758 | pParam->beaconInterval = pProfile->beaconInterval; |
| 9759 | pParam->dtimPeriod = pProfile->dtimPeriod; |
| 9760 | pParam->ApUapsdEnable = pProfile->ApUapsdEnable; |
| 9761 | pParam->ssidHidden = pProfile->SSIDs.SSIDList[0].ssidHidden; |
| 9762 | if (CSR_IS_INFRA_AP(pProfile)&& (pParam->operationChn != 0)) |
| 9763 | { |
| 9764 | if (csrIsValidChannel(pMac, pParam->operationChn) != eHAL_STATUS_SUCCESS) |
| 9765 | { |
| 9766 | pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL; |
| 9767 | } |
| 9768 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9769 | pParam->protEnabled = pProfile->protEnabled; |
| 9770 | pParam->obssProtEnabled = pProfile->obssProtEnabled; |
| 9771 | pParam->ht_protection = pProfile->cfg_protection; |
| 9772 | pParam->wps_state = pProfile->wps_state; |
| 9773 | #endif |
| 9774 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9775 | #ifdef WLAN_SOFTAP_FEATURE |
| 9776 | pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, pParam->operationChn /* pProfile->operationChannel*/, |
| 9777 | &eBand); |
| 9778 | #else |
| 9779 | pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile->operationChannel, |
| 9780 | &eBand); |
| 9781 | #endif |
| 9782 | pParam->bssPersona = pProfile->csrPersona; |
| 9783 | // When starting an IBSS, start on the channel from the Profile. |
| 9784 | status = csrSendMBStartBssReqMsg( pMac, sessionId, pProfile->BSSType, pParam, pBssDesc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9785 | return (status); |
| 9786 | } |
| 9787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9788 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9789 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9790 | { |
| 9791 | tANI_U8 Channel, SecondChn; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9792 | ePhyChanBondState cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9793 | eCsrCBChoice cbChoice; |
| 9794 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9795 | if( pBssDesc ) |
| 9796 | { |
| 9797 | csrRoamGetBssStartParmsFromBssDesc( pMac, pBssDesc, pIes, &pSession->bssParams ); |
| 9798 | //Since csrRoamGetBssStartParmsFromBssDesc fills in the bssid for pSession->bssParams |
| 9799 | //The following code has to be do after that. |
| 9800 | //For WDS station, use selfMac as the self BSSID |
| 9801 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 9802 | { |
| 9803 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid)); |
| 9804 | } |
| 9805 | } |
| 9806 | else |
| 9807 | { |
| 9808 | csrRoamGetBssStartParms(pMac, pProfile, &pSession->bssParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9809 | //Use the first SSID |
| 9810 | if(pProfile->SSIDs.numOfSSIDs) |
| 9811 | { |
| 9812 | palCopyMemory(pMac->hHdd, &pSession->bssParams.ssId, pProfile->SSIDs.SSIDList, sizeof(tSirMacSSid)); |
| 9813 | } |
| 9814 | //For WDS station, use selfMac as the self BSSID |
| 9815 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 9816 | { |
| 9817 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid)); |
| 9818 | } |
| 9819 | //Use the first BSSID |
| 9820 | else if( pProfile->BSSIDs.numOfBSSIDs ) |
| 9821 | { |
| 9822 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 9823 | } |
| 9824 | else |
| 9825 | { |
| 9826 | palZeroMemory( pMac->hHdd, &pSession->bssParams.bssid, sizeof(tCsrBssid) ); |
| 9827 | } |
| 9828 | } |
| 9829 | Channel = pSession->bssParams.operationChn; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9830 | //Set operating channel in pProfile which will be used |
| 9831 | //in csrRoamSetBssConfigCfg() to determine channel bonding |
| 9832 | //mode and will be configured in CFG later |
| 9833 | pProfile->operationChannel = Channel; |
| 9834 | |
| 9835 | if(Channel == 0) |
| 9836 | { |
| 9837 | smsLog(pMac, LOGW, " CSR cannot find a channel to start IBSS\n"); |
| 9838 | } |
| 9839 | else |
| 9840 | { |
| 9841 | |
| 9842 | csrRoamDetermineMaxRateForAdHoc( pMac, &pSession->bssParams.operationalRateSet ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9843 | if (CSR_IS_INFRA_AP(pProfile)) |
| 9844 | { |
| 9845 | if(CSR_IS_CHANNEL_24GHZ(Channel)) |
| 9846 | { |
| 9847 | cbMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 9848 | } |
| 9849 | else |
| 9850 | { |
| 9851 | cbMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 9852 | } |
| 9853 | smsLog(pMac, LOG1, "##softap cbMode %d\n", cbMode); |
| 9854 | pBssConfig->cbMode = cbMode; |
| 9855 | pSession->bssParams.cbMode = cbMode; |
| 9856 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9857 | |
| 9858 | if( CSR_IS_START_IBSS( pProfile ) ) |
| 9859 | { |
| 9860 | //TBH: channel bonding is not supported for Libra |
| 9861 | if( pProfile->ChannelInfo.ChannelList && eCSR_OPERATING_CHANNEL_AUTO != pProfile->ChannelInfo.ChannelList[0] ) |
| 9862 | { |
| 9863 | Channel = pProfile->ChannelInfo.ChannelList[0]; |
| 9864 | cbChoice = pProfile->CBMode; |
| 9865 | } |
| 9866 | else { |
| 9867 | cbChoice = pMac->roam.configParam.cbChoice; |
| 9868 | } |
| 9869 | pSession->bssParams.operationChn = Channel; |
| 9870 | //make sure channel is valid |
| 9871 | if(!csrRoamIsChannelValid(pMac, Channel)) |
| 9872 | { |
| 9873 | //set Channel to 0 to let lim know this is invalid |
| 9874 | //We still send this request down to lim even though we know the channel is wrong because |
| 9875 | //lim will response with error and hdd's eWNI_SME_START_BSS_RSP handler will roam other profile (if any) |
| 9876 | Channel = 0; |
| 9877 | pSession->bssParams.operationChn = 0; |
| 9878 | } |
| 9879 | else { |
| 9880 | tANI_U32 ChannelBondingMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9881 | if(CSR_IS_CHANNEL_24GHZ(Channel)) |
| 9882 | { |
| 9883 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 9884 | } |
| 9885 | else |
| 9886 | { |
| 9887 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 9888 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9889 | //now we have a valid channel |
| 9890 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 9891 | { |
| 9892 | //let's pick a secondard channel |
| 9893 | SecondChn = csrRoamGetSecondaryChannel(pMac, Channel, cbChoice); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9894 | if(SecondChn > Channel) |
| 9895 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9896 | cbMode = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9897 | } |
| 9898 | else if(SecondChn && SecondChn < Channel) |
| 9899 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9900 | cbMode = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9901 | } |
| 9902 | else |
| 9903 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9904 | cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9905 | } |
| 9906 | pSession->bssParams.cbMode = cbMode; |
| 9907 | } |
| 9908 | else |
| 9909 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9910 | pSession->bssParams.cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9911 | } |
| 9912 | } |
| 9913 | } |
| 9914 | } |
| 9915 | } |
| 9916 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9917 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 9918 | tANI_BOOLEAN *pfSameIbss ) |
| 9919 | { |
| 9920 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9921 | tANI_BOOLEAN fSameIbss = FALSE; |
| 9922 | |
| 9923 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 9924 | { |
| 9925 | // Check if any profile parameter has changed ? If any profile parameter |
| 9926 | // has changed then stop old BSS and start a new one with new parameters |
| 9927 | if ( csrIsSameProfile( pMac, &pMac->roam.roamSession[sessionId].connectedProfile, pProfile ) ) |
| 9928 | { |
| 9929 | fSameIbss = TRUE; |
| 9930 | } |
| 9931 | else |
| 9932 | { |
| 9933 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 9934 | } |
| 9935 | } |
| 9936 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 9937 | { |
| 9938 | // Disassociate from the connected Infrastructure network... |
| 9939 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 9940 | } |
| 9941 | else |
| 9942 | { |
| 9943 | tBssConfigParam *pBssConfig; |
| 9944 | |
| 9945 | status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); |
| 9946 | if(HAL_STATUS_SUCCESS(status)) |
| 9947 | { |
| 9948 | palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam)); |
| 9949 | // there is no Bss description before we start an IBSS so we need to adopt |
| 9950 | // all Bss configuration parameters from the Profile. |
| 9951 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, pBssConfig, NULL); |
| 9952 | if(HAL_STATUS_SUCCESS(status)) |
| 9953 | { |
| 9954 | //save dotMode |
| 9955 | pMac->roam.roamSession[sessionId].bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
| 9956 | //Prepare some more parameters for this IBSS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 9957 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9958 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
| 9959 | } |
| 9960 | |
| 9961 | palFreeMemory(pMac->hHdd, pBssConfig); |
| 9962 | }//Allocate memory |
| 9963 | } |
| 9964 | |
| 9965 | if(pfSameIbss) |
| 9966 | { |
| 9967 | *pfSameIbss = fSameIbss; |
| 9968 | } |
| 9969 | return( status ); |
| 9970 | } |
| 9971 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9972 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 9973 | tSirSmeNewBssInfo *pNewBss ) |
| 9974 | { |
| 9975 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9976 | if( pNewBss ) |
| 9977 | { |
| 9978 | // Set the operating channel. |
| 9979 | pSession->connectedProfile.operationChannel = pNewBss->channelNumber; |
| 9980 | // move the BSSId from the BSS description into the connected state information. |
| 9981 | palCopyMemory( pMac->hHdd, &pSession->connectedProfile.bssid, |
| 9982 | &(pNewBss->bssId), sizeof( tCsrBssid ) ); |
| 9983 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9984 | return; |
| 9985 | } |
| 9986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9987 | #ifdef FEATURE_WLAN_WAPI |
| 9988 | eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, |
| 9989 | tANI_U32 numItems ) |
| 9990 | { |
| 9991 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 9992 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9993 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 9994 | { |
| 9995 | smsLog(pMac, LOGE, FL(" Invalid session ID\n")); |
| 9996 | return status; |
| 9997 | } |
| 9998 | smsLog(pMac, LOGW, "csrRoamSetBKIDCache called, numItems = %d\n", numItems); |
| 9999 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10000 | if(numItems <= CSR_MAX_BKID_ALLOWED) |
| 10001 | { |
| 10002 | status = eHAL_STATUS_SUCCESS; |
| 10003 | //numItems may be 0 to clear the cache |
| 10004 | pSession->NumBkidCache = (tANI_U16)numItems; |
| 10005 | if(numItems && pBKIDCache) |
| 10006 | { |
| 10007 | status = palCopyMemory( pMac->hHdd, pSession->BkidCacheInfo, pBKIDCache, |
| 10008 | sizeof(tBkidCacheInfo) * numItems ); |
| 10009 | } |
| 10010 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10011 | return (status); |
| 10012 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10013 | eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, |
| 10014 | tBkidCacheInfo *pBkidCache) |
| 10015 | { |
| 10016 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10017 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10018 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 10019 | { |
| 10020 | smsLog(pMac, LOGE, FL(" Invalid session ID\n")); |
| 10021 | return status; |
| 10022 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10023 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10024 | if(pNum && pBkidCache) |
| 10025 | { |
| 10026 | if(pSession->NumBkidCache == 0) |
| 10027 | { |
| 10028 | *pNum = 0; |
| 10029 | status = eHAL_STATUS_SUCCESS; |
| 10030 | } |
| 10031 | else if(*pNum >= pSession->NumBkidCache) |
| 10032 | { |
| 10033 | if(pSession->NumBkidCache > CSR_MAX_PMKID_ALLOWED) |
| 10034 | { |
| 10035 | smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED\n"), |
| 10036 | pSession->NumBkidCache); |
| 10037 | pSession->NumBkidCache = CSR_MAX_PMKID_ALLOWED; |
| 10038 | } |
| 10039 | palCopyMemory( pMac->hHdd, pBkidCache, pSession->BkidCacheInfo, |
| 10040 | sizeof(tBkidCacheInfo) * pSession->NumBkidCache ); |
| 10041 | *pNum = pSession->NumBkidCache; |
| 10042 | status = eHAL_STATUS_SUCCESS; |
| 10043 | } |
| 10044 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10045 | return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10046 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10047 | tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10048 | { |
| 10049 | return (pMac->roam.roamSession[sessionId].NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10050 | } |
| 10051 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10052 | eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 10053 | tPmkidCacheInfo *pPMKIDCache, tANI_U32 numItems ) |
| 10054 | { |
| 10055 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10056 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10057 | smsLog(pMac, LOGW, "csrRoamSetPMKIDCache called, numItems = %d\n", numItems); |
| 10058 | if(numItems <= CSR_MAX_PMKID_ALLOWED) |
| 10059 | { |
| 10060 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10061 | { |
| 10062 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
| 10063 | palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 10064 | secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_UPDATE; |
| 10065 | secEvent.encryptionModeMulticast = |
| 10066 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 10067 | secEvent.encryptionModeUnicast = |
| 10068 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 10069 | palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 10070 | secEvent.authMode = |
| 10071 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 10072 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 10073 | } |
| 10074 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10075 | status = eHAL_STATUS_SUCCESS; |
| 10076 | //numItems may be 0 to clear the cache |
| 10077 | pSession->NumPmkidCache = (tANI_U16)numItems; |
| 10078 | if(numItems && pPMKIDCache) |
| 10079 | { |
| 10080 | status = palCopyMemory( pMac->hHdd, pSession->PmkidCacheInfo, pPMKIDCache, |
| 10081 | sizeof(tPmkidCacheInfo) * numItems ); |
| 10082 | } |
| 10083 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10084 | return (status); |
| 10085 | } |
| 10086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10087 | tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10088 | { |
| 10089 | return (pMac->roam.roamSession[sessionId].NumPmkidCache); |
| 10090 | } |
| 10091 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10092 | eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache) |
| 10093 | { |
| 10094 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10095 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10096 | if(pNum && pPmkidCache) |
| 10097 | { |
| 10098 | if(pSession->NumPmkidCache == 0) |
| 10099 | { |
| 10100 | *pNum = 0; |
| 10101 | status = eHAL_STATUS_SUCCESS; |
| 10102 | } |
| 10103 | else if(*pNum >= pSession->NumPmkidCache) |
| 10104 | { |
| 10105 | if(pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED) |
| 10106 | { |
| 10107 | smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED\n"), |
| 10108 | pSession->NumPmkidCache); |
| 10109 | pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED; |
| 10110 | } |
| 10111 | palCopyMemory( pMac->hHdd, pPmkidCache, pSession->PmkidCacheInfo, |
| 10112 | sizeof(tPmkidCacheInfo) * pSession->NumPmkidCache ); |
| 10113 | *pNum = pSession->NumPmkidCache; |
| 10114 | status = eHAL_STATUS_SUCCESS; |
| 10115 | } |
| 10116 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10117 | return (status); |
| 10118 | } |
| 10119 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10120 | eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 10121 | { |
| 10122 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10123 | tANI_U32 len; |
| 10124 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10125 | if(pLen) |
| 10126 | { |
| 10127 | len = *pLen; |
| 10128 | *pLen = pSession->nWpaRsnReqIeLength; |
| 10129 | if(pBuf) |
| 10130 | { |
| 10131 | if(len >= pSession->nWpaRsnReqIeLength) |
| 10132 | { |
| 10133 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnReqIE, pSession->nWpaRsnReqIeLength); |
| 10134 | } |
| 10135 | } |
| 10136 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10137 | return (status); |
| 10138 | } |
| 10139 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10140 | eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 10141 | { |
| 10142 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10143 | tANI_U32 len; |
| 10144 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10145 | if(pLen) |
| 10146 | { |
| 10147 | len = *pLen; |
| 10148 | *pLen = pSession->nWpaRsnRspIeLength; |
| 10149 | if(pBuf) |
| 10150 | { |
| 10151 | if(len >= pSession->nWpaRsnRspIeLength) |
| 10152 | { |
| 10153 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnRspIE, pSession->nWpaRsnRspIeLength); |
| 10154 | } |
| 10155 | } |
| 10156 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10157 | return (status); |
| 10158 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10159 | #ifdef FEATURE_WLAN_WAPI |
| 10160 | eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 10161 | { |
| 10162 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10163 | tANI_U32 len; |
| 10164 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10165 | if(pLen) |
| 10166 | { |
| 10167 | len = *pLen; |
| 10168 | *pLen = pSession->nWapiReqIeLength; |
| 10169 | if(pBuf) |
| 10170 | { |
| 10171 | if(len >= pSession->nWapiReqIeLength) |
| 10172 | { |
| 10173 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiReqIE, pSession->nWapiReqIeLength); |
| 10174 | } |
| 10175 | } |
| 10176 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10177 | return (status); |
| 10178 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10179 | eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 10180 | { |
| 10181 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10182 | tANI_U32 len; |
| 10183 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10184 | if(pLen) |
| 10185 | { |
| 10186 | len = *pLen; |
| 10187 | *pLen = pSession->nWapiRspIeLength; |
| 10188 | if(pBuf) |
| 10189 | { |
| 10190 | if(len >= pSession->nWapiRspIeLength) |
| 10191 | { |
| 10192 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiRspIE, pSession->nWapiRspIeLength); |
| 10193 | } |
| 10194 | } |
| 10195 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10196 | return (status); |
| 10197 | } |
| 10198 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10199 | eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10200 | { |
| 10201 | eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION; |
| 10202 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10203 | if(CSR_IS_ROAMING(pSession)) |
| 10204 | { |
| 10205 | retStatus = eCSR_ROAM_ROAMING_COMPLETION; |
| 10206 | pSession->fRoaming = eANI_BOOLEAN_FALSE; |
| 10207 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10208 | return (retStatus); |
| 10209 | } |
| 10210 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10211 | //This function remove the connected BSS from te cached scan result |
| 10212 | eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac, |
| 10213 | tCsrRoamConnectedProfile *pConnProfile) |
| 10214 | { |
| 10215 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 10216 | tCsrScanResultFilter *pScanFilter = NULL; |
| 10217 | tListElem *pEntry; |
| 10218 | tCsrScanResult *pResult; |
| 10219 | tDot11fBeaconIEs *pIes; |
| 10220 | tANI_BOOLEAN fMatch; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10221 | if(!(csrIsMacAddressZero(pMac, &pConnProfile->bssid) || |
| 10222 | csrIsMacAddressBroadcast(pMac, &pConnProfile->bssid))) |
| 10223 | { |
| 10224 | do |
| 10225 | { |
| 10226 | //Prepare the filter. Only fill in the necessary fields. Not all fields are needed |
| 10227 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 10228 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 10229 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 10230 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 10231 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 10232 | palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, &pConnProfile->bssid, sizeof(tCsrBssid)); |
| 10233 | pScanFilter->BSSIDs.numOfBSSIDs = 1; |
| 10234 | if(!csrIsNULLSSID(pConnProfile->SSID.ssId, pConnProfile->SSID.length)) |
| 10235 | { |
| 10236 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, sizeof(tCsrSSIDInfo)); |
| 10237 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 10238 | palCopyMemory(pMac->hHdd, &pScanFilter->SSIDs.SSIDList[0].SSID, &pConnProfile->SSID, sizeof(tSirMacSSid)); |
| 10239 | } |
| 10240 | pScanFilter->authType.numEntries = 1; |
| 10241 | pScanFilter->authType.authType[0] = pConnProfile->AuthType; |
| 10242 | pScanFilter->BSSType = pConnProfile->BSSType; |
| 10243 | pScanFilter->EncryptionType.numEntries = 1; |
| 10244 | pScanFilter->EncryptionType.encryptionType[0] = pConnProfile->EncryptionType; |
| 10245 | pScanFilter->mcEncryptionType.numEntries = 1; |
| 10246 | pScanFilter->mcEncryptionType.encryptionType[0] = pConnProfile->mcEncryptionType; |
| 10247 | //We ignore the channel for now, BSSID should be enough |
| 10248 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 10249 | //Also ignore the following fields |
| 10250 | pScanFilter->uapsd_mask = 0; |
| 10251 | pScanFilter->bWPSAssociation = eANI_BOOLEAN_FALSE; |
| 10252 | pScanFilter->countryCode[0] = 0; |
| 10253 | pScanFilter->phyMode = eCSR_DOT11_MODE_TAURUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10254 | csrLLLock(&pMac->scan.scanResultList); |
| 10255 | pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK ); |
| 10256 | while( pEntry ) |
| 10257 | { |
| 10258 | pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link ); |
| 10259 | pIes = (tDot11fBeaconIEs *)( pResult->Result.pvIes ); |
| 10260 | fMatch = csrMatchBSS(pMac, &pResult->Result.BssDescriptor, |
| 10261 | pScanFilter, NULL, NULL, NULL, &pIes); |
| 10262 | //Release the IEs allocated by csrMatchBSS is needed |
| 10263 | if( !pResult->Result.pvIes ) |
| 10264 | { |
| 10265 | //need to free the IEs since it is allocated by csrMatchBSS |
| 10266 | palFreeMemory(pMac->hHdd, pIes); |
| 10267 | } |
| 10268 | if(fMatch) |
| 10269 | { |
| 10270 | //We found the one |
| 10271 | if( csrLLRemoveEntry(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK) ) |
| 10272 | { |
| 10273 | //Free the memory |
| 10274 | csrFreeScanResultEntry( pMac, pResult ); |
| 10275 | } |
| 10276 | break; |
| 10277 | } |
| 10278 | pEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK); |
| 10279 | }//while |
| 10280 | csrLLUnlock(&pMac->scan.scanResultList); |
| 10281 | }while(0); |
| 10282 | if(pScanFilter) |
| 10283 | { |
| 10284 | csrFreeScanFilter(pMac, pScanFilter); |
| 10285 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 10286 | } |
| 10287 | } |
| 10288 | return (status); |
| 10289 | } |
| 10290 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10291 | //BT-AMP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10292 | eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId ) |
| 10293 | { |
| 10294 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10295 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10296 | for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 10297 | { |
| 10298 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 10299 | { |
| 10300 | if( csrIsConnStateIbss( pMac, sessionId ) || csrIsBTAMP( pMac, sessionId ) ) |
| 10301 | { |
| 10302 | //co-exist with IBSS or BT-AMP is not supported |
| 10303 | smsLog( pMac, LOGW, " BTAMP is not allowed due to IBSS/BT-AMP exist in session %d\n", sessionId ); |
| 10304 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 10305 | break; |
| 10306 | } |
| 10307 | if( csrIsConnStateInfra( pMac, sessionId ) ) |
| 10308 | { |
| 10309 | if( chnId && |
| 10310 | ( (tANI_U8)chnId != pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ) ) |
| 10311 | { |
| 10312 | smsLog( pMac, LOGW, " BTAMP is not allowed due to channel (%d) diff than infr channel (%d)\n", |
| 10313 | chnId, pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ); |
| 10314 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 10315 | break; |
| 10316 | } |
| 10317 | } |
| 10318 | } |
| 10319 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10320 | return ( status ); |
| 10321 | } |
| 10322 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10323 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ) |
| 10324 | { |
| 10325 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10326 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10327 | tBssConfigParam bssConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10328 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 10329 | { |
| 10330 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 10331 | } |
| 10332 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 10333 | { |
| 10334 | // Disassociate from the connected Infrastructure network... |
| 10335 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 10336 | } |
| 10337 | else |
| 10338 | { |
| 10339 | #if defined(VOSS_ENABLED) |
| 10340 | //We don't expect Bt-AMP HDD not to disconnect the last connection first at this time. |
| 10341 | //Otherwise we need to add code to handle the |
| 10342 | //situation just like IBSS. Though for WDS station, we need to send disassoc to PE first then |
| 10343 | //send stop_bss to PE, before we can continue. |
| 10344 | VOS_ASSERT( !csrIsConnStateWds( pMac, sessionId ) ); |
| 10345 | #endif |
| 10346 | palZeroMemory(pMac->hHdd, &bssConfig, sizeof(tBssConfigParam)); |
| 10347 | /* Assume HDD provide bssid in profile */ |
| 10348 | palCopyMemory( pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid[0], sizeof(tCsrBssid) ); |
| 10349 | // there is no Bss description before we start an WDS so we need |
| 10350 | // to adopt all Bss configuration parameters from the Profile. |
| 10351 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, &bssConfig, pBssDesc); |
| 10352 | if(HAL_STATUS_SUCCESS(status)) |
| 10353 | { |
| 10354 | //Save profile for late use |
| 10355 | csrFreeRoamProfile( pMac, sessionId ); |
| 10356 | if (HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 10357 | (void **)&pSession->pCurRoamProfile, |
| 10358 | sizeof(tCsrRoamProfile)))) |
| 10359 | { |
| 10360 | palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 10361 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile); |
| 10362 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10363 | //Prepare some more parameters for this WDS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 10364 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10365 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
| 10366 | } |
| 10367 | } |
| 10368 | |
| 10369 | return( status ); |
| 10370 | } |
| 10371 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10372 | ////////////////////Mail box |
| 10373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10374 | //pBuf is caller allocated memory point to &(tSirSmeJoinReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 10375 | //or &(tSirSmeReassocReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 10376 | static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, |
| 10377 | tSirBssDescription *pBssDescription, |
| 10378 | tANI_U8 *pBuf, tANI_U8 uapsdMask) |
| 10379 | { |
| 10380 | tCsrChannelSet channelGroup; |
| 10381 | tSirMacCapabilityInfo *pAP_capabilityInfo; |
| 10382 | tAniBool fTmp; |
| 10383 | tANI_BOOLEAN found = FALSE; |
| 10384 | tANI_U32 size = 0; |
| 10385 | tANI_U16 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10386 | // plug in neighborhood occupancy info (i.e. BSSes on primary or secondary channels) |
| 10387 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundPri |
| 10388 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecDown |
| 10389 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecUp |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10390 | // 802.11h |
| 10391 | //We can do this because it is in HOST CPU order for now. |
| 10392 | pAP_capabilityInfo = (tSirMacCapabilityInfo *)&pBssDescription->capabilityInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10393 | //tell the target AP my 11H capability only if both AP and STA support 11H and the channel being used is 11a |
| 10394 | if ( csrIs11hSupported( pMac ) && pAP_capabilityInfo->spectrumMgt && eSIR_11A_NW_TYPE == pBssDescription->nwType ) |
| 10395 | { |
| 10396 | fTmp = (tAniBool)pal_cpu_to_be32(1); |
| 10397 | } |
| 10398 | else |
| 10399 | fTmp = (tAniBool)0; |
| 10400 | |
| 10401 | // corresponds to --- pMsg->spectrumMgtIndicator = ON; |
| 10402 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&fTmp, sizeof(tAniBool) ); |
| 10403 | pBuf += sizeof(tAniBool); |
| 10404 | *pBuf++ = MIN_STA_PWR_CAP_DBM; // it is for pMsg->powerCap.minTxPower = 0; |
| 10405 | found = csrSearchChannelListForTxPower(pMac, pBssDescription, &channelGroup); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10406 | // This is required for 11k test VoWiFi Ent: Test 2. |
| 10407 | // We need the power capabilities for Assoc Req. |
| 10408 | // This macro is provided by the halPhyCfg.h. We pick our |
| 10409 | // max and min capability by the halPhy provided macros |
| 10410 | *pBuf++ = MAX_STA_PWR_CAP_DBM; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10411 | size = sizeof(pMac->roam.validChannelList); |
| 10412 | if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size))) |
| 10413 | { |
| 10414 | *pBuf++ = (tANI_U8)size; //tSirSupChnl->numChnl |
| 10415 | for ( i = 0; i < size; i++) |
| 10416 | { |
| 10417 | *pBuf++ = pMac->roam.validChannelList[ i ]; //tSirSupChnl->channelList[ i ] |
| 10418 | |
| 10419 | } |
| 10420 | } |
| 10421 | else |
| 10422 | { |
| 10423 | smsLog(pMac, LOGE, FL("can not find any valid channel\n")); |
| 10424 | *pBuf++ = 0; //tSirSupChnl->numChnl |
| 10425 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10426 | //Check whether it is ok to enter UAPSD |
| 10427 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 10428 | if( btcIsReadyForUapsd(pMac) ) |
| 10429 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 10430 | { |
| 10431 | *pBuf++ = uapsdMask; |
| 10432 | } |
| 10433 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 10434 | else |
| 10435 | { |
| 10436 | smsLog(pMac, LOGE, FL(" BTC doesn't allow UAPSD for uapsd_mask(0x%X)\n"), uapsdMask); |
| 10437 | *pBuf++ = 0; |
| 10438 | } |
| 10439 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 10440 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10441 | // move the entire BssDescription into the join request. |
| 10442 | palCopyMemory( pMac->hHdd, pBuf, pBssDescription, |
| 10443 | pBssDescription->length + sizeof( pBssDescription->length ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10444 | pBuf += pBssDescription->length + sizeof( pBssDescription->length ); // update to new location |
| 10445 | } |
| 10446 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10447 | /* |
| 10448 | * The communication between HDD and LIM is thru mailbox (MB). |
| 10449 | * Both sides will access the data structure "tSirSmeJoinReq". |
| 10450 | * The rule is, while the components of "tSirSmeJoinReq" can be accessed in the regular way like tSirSmeJoinReq.assocType, this guideline |
| 10451 | * stops at component tSirRSNie; any acces to the components after tSirRSNie is forbidden because the space from tSirRSNie is quueezed |
| 10452 | * with the component "tSirBssDescription". And since the size of actual 'tSirBssDescription' varies, the receiving side (which is the routine |
| 10453 | * limJoinReqSerDes() of limSerDesUtils.cc) should keep in mind not to access the components DIRECTLY after tSirRSNie. |
| 10454 | */ |
| 10455 | eHalStatus csrSendJoinReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, |
| 10456 | tCsrRoamProfile *pProfile, tDot11fBeaconIEs *pIes ) |
| 10457 | { |
| 10458 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10459 | tSirSmeJoinReq *pMsg; |
| 10460 | tANI_U8 *pBuf; |
| 10461 | tANI_U16 msgLen, wTmp, ieLen; |
| 10462 | tSirMacRateSet OpRateSet; |
| 10463 | tSirMacRateSet ExRateSet; |
| 10464 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10465 | tANI_U32 dwTmp; |
| 10466 | tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN]; //RSN MAX is bigger than WPA MAX |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10467 | do { |
| 10468 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 10469 | pSession->joinFailStatusCode.reasonCode = 0; |
| 10470 | // There are a number of variable length fields to consider. First, the tSirSmeJoinReq |
| 10471 | // includes a single bssDescription. bssDescription includes a single tANI_U32 for the |
| 10472 | // IE fields, but the length field in the bssDescription needs to be interpreted to |
| 10473 | // determine length of the IE fields. |
| 10474 | // |
| 10475 | // So, take the size of the JoinReq, subtract the size of the bssDescription and |
| 10476 | // add in the length from the bssDescription (then add the size of the 'length' field |
| 10477 | // itself because that is NOT included in the length field). |
| 10478 | msgLen = sizeof( tSirSmeJoinReq ) - sizeof( *pBssDescription ) + |
| 10479 | pBssDescription->length + sizeof( pBssDescription->length ) + |
| 10480 | sizeof( tCsrWpaIe ) + sizeof( tCsrWpaAuthIe ) + sizeof( tANI_U16 ); // add in the size of the WPA IE that we may build. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10481 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 10482 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 10483 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 10484 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_JOIN_REQ); |
| 10485 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 10486 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10487 | // sessionId |
| 10488 | *pBuf = (tANI_U8)sessionId; |
| 10489 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10490 | // transactionId |
| 10491 | *pBuf = 0; |
| 10492 | *( pBuf + 1 ) = 0; |
| 10493 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10494 | // ssId |
| 10495 | if( pIes->SSID.present && pIes->SSID.num_ssid ) |
| 10496 | { |
| 10497 | // ssId len |
| 10498 | *pBuf = pIes->SSID.num_ssid; |
| 10499 | pBuf++; |
| 10500 | palCopyMemory( pMac->hHdd, pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid ); |
| 10501 | pBuf += pIes->SSID.num_ssid; |
| 10502 | } |
| 10503 | else |
| 10504 | { |
| 10505 | *pBuf = 0; |
| 10506 | pBuf++; |
| 10507 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10508 | // selfMacAddr |
| 10509 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 10510 | pBuf += sizeof(tSirMacAddr); |
| 10511 | // bsstype |
| 10512 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) ); |
| 10513 | if (dwTmp == eSIR_BTAMP_STA_MODE) dwTmp = eSIR_BTAMP_AP_MODE; // Override BssType for BTAMP |
| 10514 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 10515 | pBuf += sizeof(tSirBssType); |
| 10516 | // dot11mode |
| 10517 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode ); |
| 10518 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10519 | //Persona |
| 10520 | *pBuf = (tANI_U8)pProfile->csrPersona; |
| 10521 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 10522 | //CBMode |
| 10523 | *pBuf = (tANI_U8)pSession->bssParams.cbMode; |
| 10524 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10525 | |
| 10526 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 10527 | FL("CSR PERSONA=%d CSR CbMode %d"), pProfile->csrPersona, pSession->bssParams.cbMode); |
| 10528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10529 | // uapsdPerAcBitmask |
| 10530 | *pBuf = pProfile->uapsd_mask; |
| 10531 | pBuf++; |
| 10532 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 10533 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10534 | |
| 10535 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 10536 | #endif /*(WNI_POLARIS_FW_PACKAGE == ADVANCED)*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10537 | status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet); |
| 10538 | if (HAL_STATUS_SUCCESS(status) ) |
| 10539 | { |
| 10540 | // OperationalRateSet |
| 10541 | if (OpRateSet.numRates) { |
| 10542 | *pBuf++ = OpRateSet.numRates; |
| 10543 | palCopyMemory(pMac->hHdd, pBuf, OpRateSet.rate, OpRateSet.numRates); |
| 10544 | pBuf += OpRateSet.numRates; |
| 10545 | } else *pBuf++ = 0; |
| 10546 | // ExtendedRateSet |
| 10547 | if (ExRateSet.numRates) { |
| 10548 | *pBuf++ = ExRateSet.numRates; |
| 10549 | palCopyMemory(pMac->hHdd, pBuf, ExRateSet.rate, ExRateSet.numRates); |
| 10550 | pBuf += ExRateSet.numRates; |
| 10551 | } else *pBuf++ = 0; |
| 10552 | } |
| 10553 | else |
| 10554 | { |
| 10555 | *pBuf++ = 0; |
| 10556 | *pBuf++ = 0; |
| 10557 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10558 | // rsnIE |
| 10559 | if ( csrIsProfileWpa( pProfile ) ) |
| 10560 | { |
| 10561 | // Insert the Wpa IE into the join request |
| 10562 | ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes, |
| 10563 | (tCsrWpaIe *)( wpaRsnIE ) ); |
| 10564 | } |
| 10565 | else if( csrIsProfileRSN( pProfile ) ) |
| 10566 | { |
| 10567 | // Insert the RSN IE into the join request |
| 10568 | ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 10569 | (tCsrRSNIe *)( wpaRsnIE ) ); |
| 10570 | } |
| 10571 | #ifdef FEATURE_WLAN_WAPI |
| 10572 | else if( csrIsProfileWapi( pProfile ) ) |
| 10573 | { |
| 10574 | // Insert the WAPI IE into the join request |
| 10575 | ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 10576 | (tCsrWapiIe *)( wpaRsnIE ) ); |
| 10577 | } |
| 10578 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10579 | else |
| 10580 | { |
| 10581 | ieLen = 0; |
| 10582 | } |
| 10583 | //remember the IE for future use |
| 10584 | if( ieLen ) |
| 10585 | { |
| 10586 | if(ieLen > DOT11F_IE_RSN_MAX_LEN) |
| 10587 | { |
| 10588 | smsLog(pMac, LOGE, FL(" WPA RSN IE length :%d is more than DOT11F_IE_RSN_MAX_LEN, resetting to %d\n"), ieLen, DOT11F_IE_RSN_MAX_LEN); |
| 10589 | ieLen = DOT11F_IE_RSN_MAX_LEN; |
| 10590 | } |
| 10591 | #ifdef FEATURE_WLAN_WAPI |
| 10592 | if( csrIsProfileWapi( pProfile ) ) |
| 10593 | { |
| 10594 | //Check whether we need to allocate more memory |
| 10595 | if(ieLen > pSession->nWapiReqIeLength) |
| 10596 | { |
| 10597 | if(pSession->pWapiReqIE && pSession->nWapiReqIeLength) |
| 10598 | { |
| 10599 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 10600 | } |
| 10601 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiReqIE, ieLen); |
| 10602 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 10603 | } |
| 10604 | pSession->nWapiReqIeLength = ieLen; |
| 10605 | palCopyMemory(pMac->hHdd, pSession->pWapiReqIE, wpaRsnIE, ieLen); |
| 10606 | wTmp = pal_cpu_to_be16( ieLen ); |
| 10607 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 10608 | pBuf += sizeof(tANI_U16); |
| 10609 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 10610 | pBuf += ieLen; |
| 10611 | } |
| 10612 | else//should be WPA/WPA2 otherwise |
| 10613 | #endif /* FEATURE_WLAN_WAPI */ |
| 10614 | { |
| 10615 | //Check whether we need to allocate more memory |
| 10616 | if(ieLen > pSession->nWpaRsnReqIeLength) |
| 10617 | { |
| 10618 | if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength) |
| 10619 | { |
| 10620 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 10621 | } |
| 10622 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnReqIE, ieLen); |
| 10623 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 10624 | } |
| 10625 | pSession->nWpaRsnReqIeLength = ieLen; |
| 10626 | palCopyMemory(pMac->hHdd, pSession->pWpaRsnReqIE, wpaRsnIE, ieLen); |
| 10627 | wTmp = pal_cpu_to_be16( ieLen ); |
| 10628 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 10629 | pBuf += sizeof(tANI_U16); |
| 10630 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 10631 | pBuf += ieLen; |
| 10632 | } |
| 10633 | } |
| 10634 | else |
| 10635 | { |
| 10636 | //free whatever old info |
| 10637 | pSession->nWpaRsnReqIeLength = 0; |
| 10638 | if(pSession->pWpaRsnReqIE) |
| 10639 | { |
| 10640 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 10641 | pSession->pWpaRsnReqIE = NULL; |
| 10642 | } |
| 10643 | #ifdef FEATURE_WLAN_WAPI |
| 10644 | pSession->nWapiReqIeLength = 0; |
| 10645 | if(pSession->pWapiReqIE) |
| 10646 | { |
| 10647 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 10648 | pSession->pWapiReqIE = NULL; |
| 10649 | } |
| 10650 | #endif /* FEATURE_WLAN_WAPI */ |
| 10651 | //length is two bytes |
| 10652 | *pBuf = 0; |
| 10653 | *(pBuf + 1) = 0; |
| 10654 | pBuf += 2; |
| 10655 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10656 | #ifdef FEATURE_WLAN_CCX |
| 10657 | // Never include the cckmIE in an Join Request |
| 10658 | //length is two bytes |
| 10659 | *pBuf = 0; |
| 10660 | *(pBuf + 1) = 0; |
| 10661 | pBuf += 2; |
| 10662 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10663 | // addIEScan |
| 10664 | if(pProfile->nAddIEScanLength && pProfile->pAddIEScan) |
| 10665 | { |
| 10666 | ieLen = pProfile->nAddIEScanLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10667 | if(ieLen > pSession->nAddIEScanLength) |
| 10668 | { |
| 10669 | if(pSession->pAddIEScan && pSession->nAddIEScanLength) |
| 10670 | { |
| 10671 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 10672 | } |
| 10673 | status = palAllocateMemory(pMac->hHdd, |
| 10674 | (void **)&pSession->pAddIEScan, ieLen); |
| 10675 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 10676 | } |
| 10677 | pSession->nAddIEScanLength = ieLen; |
| 10678 | palCopyMemory(pMac->hHdd, pSession->pAddIEScan, |
| 10679 | pProfile->pAddIEScan, ieLen); |
| 10680 | wTmp = pal_cpu_to_be16( ieLen ); |
| 10681 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 10682 | pBuf += sizeof(tANI_U16); |
| 10683 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEScan, ieLen ); |
| 10684 | pBuf += ieLen; |
| 10685 | } |
| 10686 | else |
| 10687 | { |
| 10688 | pSession->nAddIEScanLength = 0; |
| 10689 | if(pSession->pAddIEScan) |
| 10690 | { |
| 10691 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 10692 | pSession->pAddIEScan = NULL; |
| 10693 | } |
| 10694 | *pBuf = 0; |
| 10695 | *(pBuf + 1) = 0; |
| 10696 | pBuf += 2; |
| 10697 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10698 | // addIEAssoc |
| 10699 | if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc) |
| 10700 | { |
| 10701 | ieLen = pProfile->nAddIEAssocLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10702 | if(ieLen > pSession->nAddIEAssocLength) |
| 10703 | { |
| 10704 | if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength) |
| 10705 | { |
| 10706 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 10707 | } |
| 10708 | status = palAllocateMemory(pMac->hHdd, |
| 10709 | (void **)&pSession->pAddIEAssoc, ieLen); |
| 10710 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 10711 | } |
| 10712 | pSession->nAddIEAssocLength = ieLen; |
| 10713 | palCopyMemory(pMac->hHdd, pSession->pAddIEAssoc, |
| 10714 | pProfile->pAddIEAssoc, ieLen); |
| 10715 | wTmp = pal_cpu_to_be16( ieLen ); |
| 10716 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 10717 | pBuf += sizeof(tANI_U16); |
| 10718 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEAssoc, ieLen ); |
| 10719 | pBuf += ieLen; |
| 10720 | } |
| 10721 | else |
| 10722 | { |
| 10723 | pSession->nAddIEAssocLength = 0; |
| 10724 | if(pSession->pAddIEAssoc) |
| 10725 | { |
| 10726 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 10727 | pSession->pAddIEAssoc = NULL; |
| 10728 | } |
| 10729 | *pBuf = 0; |
| 10730 | *(pBuf + 1) = 0; |
| 10731 | pBuf += 2; |
| 10732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10733 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) ); |
| 10734 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
| 10735 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10736 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) ); |
| 10737 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
| 10738 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10739 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10740 | if (csrIsProfile11r( pProfile ) ) |
| 10741 | { |
| 10742 | // is11Rconnection; |
| 10743 | dwTmp = pal_cpu_to_be32(TRUE); |
| 10744 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 10745 | pBuf += sizeof(tAniBool); |
| 10746 | } |
| 10747 | else |
| 10748 | { |
| 10749 | // is11Rconnection; |
| 10750 | dwTmp = pal_cpu_to_be32(FALSE); |
| 10751 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 10752 | pBuf += sizeof(tAniBool); |
| 10753 | } |
| 10754 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10755 | #ifdef FEATURE_WLAN_CCX |
| 10756 | /* A profile can not be both CCX and 11R. But an 802.11R AP |
| 10757 | * may be advertising support for CCX as well. So if we are |
| 10758 | * associating Open or explicitly CCX then we will get CCX. |
| 10759 | * If we are associating explictly 11R only then we will get |
| 10760 | * 11R. |
| 10761 | */ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10762 | if ((csrIsProfileCCX(pProfile) || |
| 10763 | ((pIes->CCXVersion.present) |
| 10764 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 10765 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 10766 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 10767 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
| 10768 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
| 10769 | && (!(csrIsProfile11r( pProfile ))) |
| 10770 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10771 | { |
| 10772 | // isCCXconnection; |
| 10773 | dwTmp = pal_cpu_to_be32(TRUE); |
| 10774 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 10775 | pBuf += sizeof(tAniBool); |
| 10776 | } |
| 10777 | else |
| 10778 | { |
| 10779 | //isCCXconnection; |
| 10780 | dwTmp = pal_cpu_to_be32(FALSE); |
| 10781 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 10782 | pBuf += sizeof(tAniBool); |
| 10783 | } |
| 10784 | { |
| 10785 | tCCXTspecInfo ccxTspec; |
| 10786 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 10787 | // so nullify the TSPEC parameters |
| 10788 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 10789 | palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 10790 | pBuf += sizeof(tCCXTspecInfo); |
| 10791 | } |
| 10792 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10793 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10794 | // Fill in isFastTransitionEnabled |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10795 | if (pMac->roam.configParam.isFastTransitionEnabled |
| 10796 | #ifdef FEATURE_WLAN_LFR |
| 10797 | || csrRoamIsFastRoamEnabled(pMac) |
| 10798 | #endif |
| 10799 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10800 | { |
| 10801 | dwTmp = pal_cpu_to_be32(TRUE); |
| 10802 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 10803 | pBuf += sizeof(tAniBool); |
| 10804 | } |
| 10805 | else |
| 10806 | { |
| 10807 | dwTmp = pal_cpu_to_be32(FALSE); |
| 10808 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 10809 | pBuf += sizeof(tAniBool); |
| 10810 | } |
| 10811 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 10812 | #ifdef FEATURE_WLAN_LFR |
| 10813 | if(csrRoamIsFastRoamEnabled(pMac)) |
| 10814 | { |
| 10815 | //legacy fast roaming enabled |
| 10816 | dwTmp = pal_cpu_to_be32(TRUE); |
| 10817 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 10818 | pBuf += sizeof(tAniBool); |
| 10819 | } |
| 10820 | else |
| 10821 | { |
| 10822 | dwTmp = pal_cpu_to_be32(FALSE); |
| 10823 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 10824 | pBuf += sizeof(tAniBool); |
| 10825 | } |
| 10826 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10827 | //BssDesc |
| 10828 | csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, |
| 10829 | (tANI_U8)pProfile->uapsd_mask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10830 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 10831 | if(!HAL_STATUS_SUCCESS(status)) |
| 10832 | { |
| 10833 | break; |
| 10834 | } |
| 10835 | //Tush-QoS: notify QoS module that join happening |
| 10836 | else |
| 10837 | { |
| 10838 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 10839 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_JOIN_REQ, NULL); |
| 10840 | #endif |
| 10841 | } |
| 10842 | } while( 0 ); |
| 10843 | return( status ); |
| 10844 | } |
| 10845 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10846 | eHalStatus csrSendSmeReassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, |
| 10847 | tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile ) |
| 10848 | { |
| 10849 | eHalStatus status; |
| 10850 | tSirSmeReassocReq *pMsg; |
| 10851 | tANI_U8 *pBuf; |
| 10852 | v_U8_t acm_mask = 0, uapsd_mask; |
| 10853 | tANI_U16 msgLen, ieLen, wTmp; |
| 10854 | tANI_U32 dwTmp; |
| 10855 | tSirMacRateSet OpRateSet; |
| 10856 | tSirMacRateSet ExRateSet; |
| 10857 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10858 | tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN]; //RSN MAX is bigger than WPA MAX |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10859 | /* To satisfy klockworks */ |
| 10860 | if (pBssDescription == NULL) |
| 10861 | { |
| 10862 | smsLog(pMac, LOGE, FL(" pBssDescription is NULL\n")); |
| 10863 | return eHAL_STATUS_FAILURE; |
| 10864 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10865 | do { |
| 10866 | // There are a number of variable length fields to consider. First, the tSirSmeJoinReq |
| 10867 | // includes a single bssDescription. bssDescription includes a single tANI_U32 for the |
| 10868 | // IE fields, but the length field in the bssDescription needs to be interpreted to |
| 10869 | // determine length of the IE fields. |
| 10870 | // |
| 10871 | // So, take the size of the JoinReq, subtract the size of the bssDescription and |
| 10872 | // add in the length from the bssDescription (then add the size of the 'length' field |
| 10873 | // itself because that is NOT included in the length field). |
| 10874 | msgLen = sizeof( tSirSmeReassocReq ) - sizeof( *pBssDescription ) + |
| 10875 | pBssDescription->length + sizeof( pBssDescription->length ) + |
| 10876 | sizeof( tCsrWpaIe ) + sizeof( tCsrWpaAuthIe ) + sizeof( tANI_U16 ); // add in the size of the WPA IE that we may build. |
| 10877 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 10878 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 10879 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 10880 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REASSOC_REQ); |
| 10881 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 10882 | pBuf = &pMsg->sessionId; |
| 10883 | // sessionId |
| 10884 | *pBuf++ = (tANI_U8)sessionId; |
| 10885 | // transactionId |
| 10886 | *pBuf = 0; |
| 10887 | *(pBuf + 1) = 0; |
| 10888 | pBuf += sizeof (tANI_U16); |
| 10889 | // ssId |
| 10890 | if( pIes->SSID.present && pIes->SSID.num_ssid ) |
| 10891 | { |
| 10892 | // ssId len |
| 10893 | *pBuf++ = pIes->SSID.num_ssid; |
| 10894 | palCopyMemory( pMac->hHdd, pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid ); |
| 10895 | pBuf += pIes->SSID.num_ssid; |
| 10896 | } |
| 10897 | else |
| 10898 | { |
| 10899 | *pBuf++ = 0; |
| 10900 | } |
| 10901 | // selfMacAddr |
| 10902 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 10903 | pBuf += sizeof(tSirMacAddr); |
| 10904 | // bsstype |
| 10905 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) ); |
| 10906 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 10907 | pBuf += sizeof(tSirBssType); |
| 10908 | // dot11mode |
| 10909 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode ); |
| 10910 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10911 | //Persona |
| 10912 | *pBuf = (tANI_U8)pProfile->csrPersona; |
| 10913 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 10914 | //CBMode |
| 10915 | *pBuf = (tANI_U8)pSession->bssParams.cbMode; |
| 10916 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10917 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 10918 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 10919 | FL("CSR PERSONA=%d CSR CBMode=%u\n"), pProfile->csrPersona, pSession->bssParams.cbMode); |
| 10920 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10921 | // uapsdPerAcBitmask |
| 10922 | *pBuf = pProfile->uapsd_mask; |
| 10923 | pBuf++; |
| 10924 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10925 | status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, |
| 10926 | pBssDescription, pIes, &OpRateSet, &ExRateSet); |
| 10927 | if (HAL_STATUS_SUCCESS(status) ) |
| 10928 | { |
| 10929 | // OperationalRateSet |
| 10930 | if (OpRateSet.numRates) |
| 10931 | { |
| 10932 | *pBuf++ = OpRateSet.numRates; |
| 10933 | palCopyMemory(pMac->hHdd, pBuf, OpRateSet.rate, OpRateSet.numRates); |
| 10934 | pBuf += OpRateSet.numRates; |
| 10935 | } |
| 10936 | else *pBuf++ = 0; |
| 10937 | // ExtendedRateSet |
| 10938 | if (ExRateSet.numRates) |
| 10939 | { |
| 10940 | *pBuf++ = ExRateSet.numRates; |
| 10941 | palCopyMemory(pMac->hHdd, pBuf, ExRateSet.rate, ExRateSet.numRates); |
| 10942 | pBuf += ExRateSet.numRates; |
| 10943 | } |
| 10944 | else *pBuf++ = 0; |
| 10945 | } |
| 10946 | else |
| 10947 | { |
| 10948 | *pBuf++ = 0; |
| 10949 | *pBuf++ = 0; |
| 10950 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10951 | // rsnIE |
| 10952 | if ( csrIsProfileWpa( pProfile ) ) |
| 10953 | { |
| 10954 | // Insert the Wpa IE into the join request |
| 10955 | ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes, |
| 10956 | (tCsrWpaIe *)( wpaRsnIE ) ); |
| 10957 | } |
| 10958 | else if( csrIsProfileRSN( pProfile ) ) |
| 10959 | { |
| 10960 | // Insert the RSN IE into the join request |
| 10961 | ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 10962 | (tCsrRSNIe *)( wpaRsnIE ) ); |
| 10963 | } |
| 10964 | #ifdef FEATURE_WLAN_WAPI |
| 10965 | else if( csrIsProfileWapi( pProfile ) ) |
| 10966 | { |
| 10967 | // Insert the WAPI IE into the join request |
| 10968 | ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 10969 | (tCsrWapiIe *)( wpaRsnIE) ); |
| 10970 | } |
| 10971 | #endif /* FEATURE_WLAN_WAPI */ |
| 10972 | else |
| 10973 | { |
| 10974 | ieLen = 0; |
| 10975 | } |
| 10976 | //remember the IE for future use |
| 10977 | if( ieLen ) |
| 10978 | { |
| 10979 | if(ieLen > DOT11F_IE_RSN_MAX_LEN) |
| 10980 | { |
| 10981 | smsLog(pMac, LOGE, FL(" WPA RSN IE length :%d is more than DOT11F_IE_RSN_MAX_LEN, resetting to %d\n"), ieLen, DOT11F_IE_RSN_MAX_LEN); |
| 10982 | ieLen = DOT11F_IE_RSN_MAX_LEN; |
| 10983 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10984 | //Check whether we need to allocate more memory |
| 10985 | if(ieLen > pSession->nWpaRsnReqIeLength) |
| 10986 | { |
| 10987 | if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength) |
| 10988 | { |
| 10989 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 10990 | } |
| 10991 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnReqIE, ieLen); |
| 10992 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 10993 | } |
| 10994 | pSession->nWpaRsnReqIeLength = ieLen; |
| 10995 | palCopyMemory(pMac->hHdd, pSession->pWpaRsnReqIE, wpaRsnIE, ieLen); |
| 10996 | wTmp = pal_cpu_to_be16( ieLen ); |
| 10997 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 10998 | pBuf += sizeof(tANI_U16); |
| 10999 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11000 | pBuf += ieLen; |
| 11001 | } |
| 11002 | else |
| 11003 | { |
| 11004 | //free whatever old info |
| 11005 | pSession->nWpaRsnReqIeLength = 0; |
| 11006 | if(pSession->pWpaRsnReqIE) |
| 11007 | { |
| 11008 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 11009 | pSession->pWpaRsnReqIE = NULL; |
| 11010 | } |
| 11011 | //length is two bytes |
| 11012 | *pBuf = 0; |
| 11013 | *(pBuf + 1) = 0; |
| 11014 | pBuf += 2; |
| 11015 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11016 | #ifdef FEATURE_WLAN_CCX |
| 11017 | // cckmIE |
| 11018 | if( csrIsProfileCCX( pProfile ) ) |
| 11019 | { |
| 11020 | // Insert the CCKM IE into the join request |
| 11021 | ieLen = csrConstructCcxCckmIe( pMac, |
| 11022 | pSession, |
| 11023 | pProfile, |
| 11024 | pBssDescription, |
| 11025 | pSession->pWpaRsnReqIE, |
| 11026 | pSession->nWpaRsnReqIeLength, |
| 11027 | (void *)( wpaRsnIE ) ); |
| 11028 | } |
| 11029 | else |
| 11030 | { |
| 11031 | ieLen = 0; |
| 11032 | } |
| 11033 | //If present, copy the IE into the eWNI_SME_REASSOC_REQ message buffer |
| 11034 | if( ieLen ) |
| 11035 | { |
| 11036 | //Copy the CCKM IE over from the temp buffer (wpaRsnIE) |
| 11037 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11038 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11039 | pBuf += sizeof(tANI_U16); |
| 11040 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11041 | pBuf += ieLen; |
| 11042 | } |
| 11043 | else |
| 11044 | { |
| 11045 | //Indicate you have no CCKM IE |
| 11046 | //length is two bytes |
| 11047 | *pBuf = 0; |
| 11048 | *(pBuf + 1) = 0; |
| 11049 | pBuf += 2; |
| 11050 | } |
| 11051 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11052 | // addIEScan |
| 11053 | if(pProfile->nAddIEScanLength && pProfile->pAddIEScan) |
| 11054 | { |
| 11055 | ieLen = pProfile->nAddIEScanLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11056 | if(ieLen > pSession->nAddIEScanLength) |
| 11057 | { |
| 11058 | if(pSession->pAddIEScan && pSession->nAddIEScanLength) |
| 11059 | { |
| 11060 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 11061 | } |
| 11062 | status = palAllocateMemory(pMac->hHdd, |
| 11063 | (void **)&pSession->pAddIEScan, ieLen); |
| 11064 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11065 | } |
| 11066 | pSession->nAddIEScanLength = ieLen; |
| 11067 | palCopyMemory(pMac->hHdd, pSession->pAddIEScan, |
| 11068 | pProfile->pAddIEScan, ieLen); |
| 11069 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11070 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11071 | pBuf += sizeof(tANI_U16); |
| 11072 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEScan, ieLen ); |
| 11073 | pBuf += ieLen; |
| 11074 | } |
| 11075 | else |
| 11076 | { |
| 11077 | pSession->nAddIEScanLength = 0; |
| 11078 | if(pSession->pAddIEScan) |
| 11079 | { |
| 11080 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 11081 | pSession->pAddIEScan = NULL; |
| 11082 | } |
| 11083 | *pBuf = 0; |
| 11084 | *(pBuf + 1) = 0; |
| 11085 | pBuf += 2; |
| 11086 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11087 | // addIEAssoc |
| 11088 | if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc) |
| 11089 | { |
| 11090 | ieLen = pProfile->nAddIEAssocLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11091 | if(ieLen > pSession->nAddIEAssocLength) |
| 11092 | { |
| 11093 | if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength) |
| 11094 | { |
| 11095 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 11096 | } |
| 11097 | status = palAllocateMemory(pMac->hHdd, |
| 11098 | (void **)&pSession->pAddIEAssoc, ieLen); |
| 11099 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11100 | } |
| 11101 | pSession->nAddIEAssocLength = ieLen; |
| 11102 | palCopyMemory(pMac->hHdd, pSession->pAddIEAssoc, |
| 11103 | pProfile->pAddIEAssoc, ieLen); |
| 11104 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11105 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11106 | pBuf += sizeof(tANI_U16); |
| 11107 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEAssoc, ieLen ); |
| 11108 | pBuf += ieLen; |
| 11109 | } |
| 11110 | else |
| 11111 | { |
| 11112 | pSession->nAddIEAssocLength = 0; |
| 11113 | if(pSession->pAddIEAssoc) |
| 11114 | { |
| 11115 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 11116 | pSession->pAddIEAssoc = NULL; |
| 11117 | } |
| 11118 | *pBuf = 0; |
| 11119 | *(pBuf + 1) = 0; |
| 11120 | pBuf += 2; |
| 11121 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11122 | //Unmask any AC in reassoc that is ACM-set |
| 11123 | uapsd_mask = (v_U8_t)pProfile->uapsd_mask; |
| 11124 | if( uapsd_mask && ( NULL != pBssDescription ) ) |
| 11125 | { |
| 11126 | if( CSR_IS_QOS_BSS(pIes) && CSR_IS_UAPSD_BSS(pIes) ) |
| 11127 | { |
| 11128 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 11129 | acm_mask = sme_QosGetACMMask(pMac, pBssDescription, pIes); |
| 11130 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 11131 | uapsd_mask &= ~(acm_mask); |
| 11132 | } |
| 11133 | else |
| 11134 | { |
| 11135 | uapsd_mask = 0; |
| 11136 | } |
| 11137 | } |
| 11138 | |
| 11139 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) ); |
| 11140 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
| 11141 | pBuf += sizeof(tANI_U32); |
| 11142 | |
| 11143 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) ); |
| 11144 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
| 11145 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11146 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11147 | // is11Rconnection; |
| 11148 | dwTmp = csrIsProfile11r( pProfile )? pal_cpu_to_be32(TRUE) : 0; |
| 11149 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11150 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11151 | #ifdef FEATURE_WLAN_CCX |
| 11152 | //isCCXconnection; |
| 11153 | //CCKM profile, ccxversion ie present, not 11r and ini file has CCX enabled |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11154 | dwTmp = ( ((csrIsProfileCCX(pProfile) || |
| 11155 | ((pIes->CCXVersion.present) |
| 11156 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 11157 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 11158 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 11159 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
| 11160 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
| 11161 | && (!(csrIsProfile11r( pProfile ))) |
| 11162 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
| 11163 | ? pal_cpu_to_be32(TRUE) : 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11164 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11165 | pBuf += sizeof(tAniBool); |
| 11166 | #endif // FEATURE_WLAN_CCX |
| 11167 | #endif // WLAN_FEATURE_VOWIFI_11R |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11168 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11169 | if ((csrIsProfileCCX(pProfile) || |
| 11170 | ((pIes->CCXVersion.present) |
| 11171 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 11172 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 11173 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 11174 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
| 11175 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
| 11176 | && (!(csrIsProfile11r( pProfile ))) |
| 11177 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11178 | { |
| 11179 | tCCXTspecInfo ccxTspec; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11180 | // CCX Tspec information |
| 11181 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11182 | ccxTspec.numTspecs = sme_QosCCxRetrieveTspecInfo(pMac, sessionId, (tTspecInfo *) &ccxTspec.tspec[0]); |
| 11183 | *pBuf = ccxTspec.numTspecs; |
| 11184 | pBuf += sizeof(tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11185 | // Copy the TSPEC information only if present |
| 11186 | if (ccxTspec.numTspecs) { |
| 11187 | palCopyMemory(pMac->hHdd, pBuf, (void*)&ccxTspec.tspec[0], (ccxTspec.numTspecs*sizeof(tTspecInfo))); |
| 11188 | } |
| 11189 | pBuf += sizeof(ccxTspec.tspec); |
| 11190 | } |
| 11191 | else |
| 11192 | { |
| 11193 | { |
| 11194 | tCCXTspecInfo ccxTspec; |
| 11195 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 11196 | // so nullify the TSPEC parameters |
| 11197 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11198 | palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11199 | pBuf += sizeof(tCCXTspecInfo); |
| 11200 | } |
| 11201 | } |
| 11202 | #endif // FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11203 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11204 | // Fill in isFastTransitionEnabled |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11205 | if (pMac->roam.configParam.isFastTransitionEnabled |
| 11206 | #ifdef FEATURE_WLAN_LFR |
| 11207 | || csrRoamIsFastRoamEnabled(pMac) |
| 11208 | #endif |
| 11209 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11210 | { |
| 11211 | dwTmp = pal_cpu_to_be32(TRUE); |
| 11212 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11213 | pBuf += sizeof(tAniBool); |
| 11214 | } |
| 11215 | else |
| 11216 | { |
| 11217 | dwTmp = pal_cpu_to_be32(FALSE); |
| 11218 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11219 | pBuf += sizeof(tAniBool); |
| 11220 | } |
| 11221 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 11222 | #ifdef FEATURE_WLAN_LFR |
| 11223 | if(csrRoamIsFastRoamEnabled(pMac)) |
| 11224 | { |
| 11225 | //legacy fast roaming enabled |
| 11226 | dwTmp = pal_cpu_to_be32(TRUE); |
| 11227 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11228 | pBuf += sizeof(tAniBool); |
| 11229 | } |
| 11230 | else |
| 11231 | { |
| 11232 | dwTmp = pal_cpu_to_be32(FALSE); |
| 11233 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11234 | pBuf += sizeof(tAniBool); |
| 11235 | } |
| 11236 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11237 | csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, uapsd_mask); |
| 11238 | |
| 11239 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 11240 | //Tush-QoS: notify QoS module that reassoc happening |
| 11241 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_REASSOC_REQ, NULL); |
| 11242 | #endif |
| 11243 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 11244 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11245 | return( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11246 | } |
| 11247 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11248 | // |
| 11249 | eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 11250 | { |
| 11251 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11252 | tSirSmeDisassocReq *pMsg; |
| 11253 | tANI_U8 *pBuf; |
| 11254 | tANI_U16 wTmp; |
| 11255 | #ifdef WLAN_SOFTAP_FEATURE |
| 11256 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11257 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11258 | return eHAL_STATUS_FAILURE; |
| 11259 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11260 | do { |
| 11261 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocReq )); |
| 11262 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11263 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocReq )); |
| 11264 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_REQ); |
| 11265 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11266 | pBuf = &pMsg->sessionId; |
| 11267 | // sessionId |
| 11268 | *pBuf++ = (tANI_U8)sessionId; |
| 11269 | // transactionId |
| 11270 | *pBuf = 0; |
| 11271 | *( pBuf + 1 ) = 0; |
| 11272 | pBuf += sizeof(tANI_U16); |
| 11273 | |
| 11274 | #ifdef WLAN_SOFTAP_FEATURE |
| 11275 | if ( (pSession->pCurRoamProfile != NULL ) && |
| 11276 | ( reasonCode == eSIR_MAC_UNSPEC_FAILURE_REASON ) && |
| 11277 | ((CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))) |
| 11278 | { |
| 11279 | // Set the bssid address before sending the message to LIM |
| 11280 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( tSirMacAddr ) ); |
| 11281 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11282 | // Set the peer MAC address before sending the message to LIM |
| 11283 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); //perMacAddr is passed as bssId for softAP |
| 11284 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 11285 | } |
| 11286 | else |
| 11287 | { |
| 11288 | #endif |
| 11289 | // Set the peer MAC address before sending the message to LIM |
| 11290 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); |
| 11291 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11292 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->bssId ) ); |
| 11293 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 11294 | #ifdef WLAN_SOFTAP_FEATURE |
| 11295 | } |
| 11296 | #endif |
| 11297 | if(!HAL_STATUS_SUCCESS(status)) |
| 11298 | { |
| 11299 | palFreeMemory(pMac->hHdd, pMsg); |
| 11300 | break; |
| 11301 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11302 | // reasonCode |
| 11303 | wTmp = pal_cpu_to_be16(reasonCode); |
| 11304 | status = palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11305 | if(!HAL_STATUS_SUCCESS(status)) |
| 11306 | { |
| 11307 | palFreeMemory(pMac->hHdd, pMsg); |
| 11308 | break; |
| 11309 | } |
| 11310 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11311 | /* The state will be DISASSOC_HANDOFF only when we are doing handoff. |
| 11312 | Here we should not send the disassoc over the air to the AP */ |
| 11313 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId) |
| 11314 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11315 | && csrRoamIs11rAssoc(pMac) |
| 11316 | #endif |
| 11317 | ) |
| 11318 | { |
| 11319 | *pBuf = CSR_DONT_SEND_DISASSOC_OVER_THE_AIR; /* Set DoNotSendOverTheAir flag to 1 only for handoff case */ |
| 11320 | } |
| 11321 | pBuf += sizeof(tANI_U8); |
| 11322 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11323 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11324 | return( status ); |
| 11325 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11326 | #ifdef WLAN_SOFTAP_FEATURE |
| 11327 | eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable, tSirMacAddr bssId ) |
| 11328 | { |
| 11329 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11330 | tSirSmeTkipCntrMeasReq *pMsg; |
| 11331 | tANI_U8 *pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11332 | do |
| 11333 | { |
| 11334 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeTkipCntrMeasReq )); |
| 11335 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11336 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeTkipCntrMeasReq )); |
| 11337 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_TKIP_CNTR_MEAS_REQ); |
| 11338 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeTkipCntrMeasReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11339 | pBuf = &pMsg->sessionId; |
| 11340 | // sessionId |
| 11341 | *pBuf++ = (tANI_U8)sessionId; |
| 11342 | // transactionId |
| 11343 | *pBuf = 0; |
| 11344 | *( pBuf + 1 ) = 0; |
| 11345 | pBuf += sizeof(tANI_U16); |
| 11346 | // bssid |
| 11347 | status = palCopyMemory( pMac->hHdd, pMsg->bssId, bssId, sizeof( tSirMacAddr ) ); |
| 11348 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 11349 | // bEnable |
| 11350 | *pBuf = (tANI_BOOLEAN)bEnable; |
| 11351 | if(!HAL_STATUS_SUCCESS(status)) |
| 11352 | { |
| 11353 | palFreeMemory(pMac->hHdd, pMsg); |
| 11354 | break; |
| 11355 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11356 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11357 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11358 | return( status ); |
| 11359 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11360 | eHalStatus |
| 11361 | csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11362 | VOS_MODULE_ID modId, tSirMacAddr bssId, |
| 11363 | void *pUsrContext, void *pfnSapEventCallback, |
| 11364 | tANI_U8 *pAssocStasBuf ) |
| 11365 | { |
| 11366 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11367 | tSirSmeGetAssocSTAsReq *pMsg; |
| 11368 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 11369 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11370 | do |
| 11371 | { |
| 11372 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeGetAssocSTAsReq ) ); |
| 11373 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 11374 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetAssocSTAsReq ) ); |
| 11375 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_ASSOC_STAS_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11376 | pBuf = (tANI_U8 *)&pMsg->bssId; |
| 11377 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11378 | // bssId |
| 11379 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) ); |
| 11380 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11381 | // modId |
| 11382 | dwTmp = pal_cpu_to_be16((tANI_U16)modId); |
| 11383 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U16)); |
| 11384 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11385 | // pUsrContext |
| 11386 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
| 11387 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 11388 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11389 | // pfnSapEventCallback |
| 11390 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
| 11391 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 11392 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11393 | // pAssocStasBuf |
| 11394 | dwTmp = pal_cpu_to_be32((tANI_U32)pAssocStasBuf); |
| 11395 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 11396 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11397 | pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)));//msg_header + msg |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11398 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 11399 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11400 | return( status ); |
| 11401 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11402 | eHalStatus |
| 11403 | csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11404 | tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac) |
| 11405 | { |
| 11406 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11407 | tSirSmeGetWPSPBCSessionsReq *pMsg; |
| 11408 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 11409 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11410 | do |
| 11411 | { |
| 11412 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirSmeGetWPSPBCSessionsReq) ); |
| 11413 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 11414 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetWPSPBCSessionsReq ) ); |
| 11415 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_WPSPBC_SESSION_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11416 | pBuf = (tANI_U8 *)&pMsg->pUsrContext; |
| 11417 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11418 | // pUsrContext |
| 11419 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
| 11420 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 11421 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11422 | // pSapEventCallback |
| 11423 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
| 11424 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 11425 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11426 | // bssId |
| 11427 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) ); |
| 11428 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11429 | // MAC Address of STA in WPS session |
| 11430 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pRemoveMac.bytes, sizeof(v_MACADDR_t)); |
| 11431 | pBuf += sizeof(v_MACADDR_t); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11432 | pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)));//msg_header + msg |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11433 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11434 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11435 | return( status ); |
| 11436 | } |
| 11437 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11438 | eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 11439 | { |
| 11440 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11441 | tSirSmeDeauthReq *pMsg; |
| 11442 | tANI_U8 *pBuf; |
| 11443 | tANI_U16 wTmp; |
| 11444 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11445 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11446 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11447 | do { |
| 11448 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthReq )); |
| 11449 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11450 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthReq )); |
| 11451 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_REQ); |
| 11452 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthReq )); |
| 11453 | //sessionId |
| 11454 | pBuf = &pMsg->sessionId; |
| 11455 | *pBuf++ = (tANI_U8)sessionId; |
| 11456 | |
| 11457 | //tansactionId |
| 11458 | *pBuf = 0; |
| 11459 | *(pBuf + 1 ) = 0; |
| 11460 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11461 | if ((pSession->pCurRoamProfile != NULL) && ( |
| 11462 | #ifdef WLAN_SOFTAP_FEATURE |
| 11463 | (CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
| 11464 | #endif |
| 11465 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))){ |
| 11466 | // Set the BSSID before sending the message to LIM |
| 11467 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( pMsg->peerMacAddr ) ); |
| 11468 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 11469 | } |
| 11470 | else |
| 11471 | { |
| 11472 | // Set the BSSID before sending the message to LIM |
| 11473 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 11474 | pBuf = pBuf + sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11475 | } |
| 11476 | if(!HAL_STATUS_SUCCESS(status)) |
| 11477 | { |
| 11478 | palFreeMemory(pMac->hHdd, pMsg); |
| 11479 | break; |
| 11480 | } |
| 11481 | // Set the peer MAC address before sending the message to LIM |
| 11482 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *) pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 11483 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 11484 | if(!HAL_STATUS_SUCCESS(status)) |
| 11485 | { |
| 11486 | palFreeMemory(pMac->hHdd, pMsg); |
| 11487 | break; |
| 11488 | } |
| 11489 | wTmp = pal_cpu_to_be16(reasonCode); |
| 11490 | status = palCopyMemory( pMac->hHdd, pBuf, &wTmp,sizeof( tANI_U16 ) ); |
| 11491 | if(!HAL_STATUS_SUCCESS(status)) |
| 11492 | { |
| 11493 | palFreeMemory(pMac->hHdd, pMsg); |
| 11494 | break; |
| 11495 | } |
| 11496 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11497 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11498 | return( status ); |
| 11499 | } |
| 11500 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11501 | eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd ) |
| 11502 | { |
| 11503 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11504 | tSirSmeDisassocCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11505 | do { |
| 11506 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocCnf )); |
| 11507 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11508 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocCnf )); |
| 11509 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_CNF); |
| 11510 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 11511 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocCnf )); |
| 11512 | status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDisassocInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); |
| 11513 | if(!HAL_STATUS_SUCCESS(status)) |
| 11514 | { |
| 11515 | palFreeMemory(pMac->hHdd, pMsg); |
| 11516 | break; |
| 11517 | } |
| 11518 | //To test reconn |
| 11519 | status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDisassocInd->bssId, sizeof(pMsg->peerMacAddr)); |
| 11520 | if(!HAL_STATUS_SUCCESS(status)) |
| 11521 | { |
| 11522 | palFreeMemory(pMac->hHdd, pMsg); |
| 11523 | break; |
| 11524 | } |
| 11525 | //To test reconn ends |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11526 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11527 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11528 | return( status ); |
| 11529 | } |
| 11530 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11531 | eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd ) |
| 11532 | { |
| 11533 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11534 | tSirSmeDeauthCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11535 | do { |
| 11536 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthCnf )); |
| 11537 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11538 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthCnf )); |
| 11539 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_CNF); |
| 11540 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 11541 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthCnf )); |
| 11542 | status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDeauthInd->bssId, sizeof(pMsg->bssId)); |
| 11543 | if(!HAL_STATUS_SUCCESS(status)) |
| 11544 | { |
| 11545 | palFreeMemory(pMac->hHdd, pMsg); |
| 11546 | break; |
| 11547 | } |
| 11548 | status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDeauthInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); |
| 11549 | if(!HAL_STATUS_SUCCESS(status)) |
| 11550 | { |
| 11551 | palFreeMemory(pMac->hHdd, pMsg); |
| 11552 | break; |
| 11553 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11554 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11555 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11556 | return( status ); |
| 11557 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11558 | eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus ) |
| 11559 | { |
| 11560 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11561 | tSirSmeAssocCnf *pMsg; |
| 11562 | tANI_U8 *pBuf; |
| 11563 | tSirResultCodes statusCode; |
| 11564 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11565 | do { |
| 11566 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocCnf )); |
| 11567 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11568 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocCnf )); |
| 11569 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ASSOC_CNF); |
| 11570 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocCnf )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11571 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 11572 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 11573 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 11574 | else |
| 11575 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
| 11576 | palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) ); |
| 11577 | pBuf += sizeof(tSirResultCodes); |
| 11578 | // bssId |
| 11579 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 11580 | pBuf += sizeof (tSirMacAddr); |
| 11581 | // peerMacAddr |
| 11582 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 11583 | pBuf += sizeof (tSirMacAddr); |
| 11584 | // aid |
| 11585 | wTmp = pal_cpu_to_be16(pAssocInd->aid); |
| 11586 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11587 | pBuf += sizeof (tANI_U16); |
| 11588 | // alternateBssId |
| 11589 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 11590 | pBuf += sizeof (tSirMacAddr); |
| 11591 | // alternateChannelId |
| 11592 | *pBuf = 11; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11593 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 11594 | if(!HAL_STATUS_SUCCESS(status)) |
| 11595 | { |
| 11596 | //pMsg is freed by palSendMBMessage |
| 11597 | break; |
| 11598 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11599 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11600 | return( status ); |
| 11601 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11602 | #ifdef WLAN_SOFTAP_FEATURE |
| 11603 | eHalStatus csrSendAssocIndToUpperLayerCnfMsg( tpAniSirGlobal pMac, |
| 11604 | tpSirSmeAssocInd pAssocInd, |
| 11605 | eHalStatus Halstatus, |
| 11606 | tANI_U8 sessionId) |
| 11607 | { |
| 11608 | tSirMsgQ msgQ; |
| 11609 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11610 | tSirSmeAssocIndToUpperLayerCnf *pMsg; |
| 11611 | tANI_U8 *pBuf; |
| 11612 | tSirResultCodes statusCode; |
| 11613 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11614 | do { |
| 11615 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 11616 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11617 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 11618 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11619 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPPER_LAYER_ASSOC_CNF); |
| 11620 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 11621 | |
| 11622 | pMsg->sessionId = sessionId; |
| 11623 | |
| 11624 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 11625 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 11626 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 11627 | else |
| 11628 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
| 11629 | palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) ); |
| 11630 | pBuf += sizeof(tSirResultCodes); |
| 11631 | // bssId |
| 11632 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 11633 | pBuf += sizeof (tSirMacAddr); |
| 11634 | // peerMacAddr |
| 11635 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 11636 | pBuf += sizeof (tSirMacAddr); |
| 11637 | // StaId |
| 11638 | wTmp = pal_cpu_to_be16(pAssocInd->staId); |
| 11639 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11640 | pBuf += sizeof (tANI_U16); |
| 11641 | // alternateBssId |
| 11642 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 11643 | pBuf += sizeof (tSirMacAddr); |
| 11644 | // alternateChannelId |
| 11645 | *pBuf = 11; |
| 11646 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11647 | // Instead of copying roam Info, we just copy only WmmEnabled , RsnIE information |
| 11648 | //Wmm |
| 11649 | *pBuf = pAssocInd->wmmEnabledSta; |
| 11650 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11651 | //RSN IE |
| 11652 | status = palCopyMemory(pMac->hHdd, (tSirRSNie *)pBuf, &pAssocInd->rsnIE, sizeof(tSirRSNie)); |
| 11653 | pBuf += sizeof (tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11654 | //Additional IE |
| 11655 | status = palCopyMemory(pMac->hHdd, (void *)pBuf, &pAssocInd->addIE, sizeof(tSirAddie)); |
| 11656 | pBuf += sizeof (tSirAddie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11657 | //reassocReq |
| 11658 | *pBuf = pAssocInd->reassocReq; |
| 11659 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11660 | msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF; |
| 11661 | msgQ.bodyptr = pMsg; |
| 11662 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11663 | SysProcessMmhMsg(pMac, &msgQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11664 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11665 | return( status ); |
| 11666 | } |
| 11667 | #endif |
| 11668 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11669 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId , |
| 11670 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 11671 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 11672 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 11673 | tANI_U8 *pKeyRsc ) |
| 11674 | { |
| 11675 | tSirSmeSetContextReq *pMsg; |
| 11676 | tANI_U16 msgLen; |
| 11677 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 11678 | tAniEdType tmpEdType; |
| 11679 | tAniKeyDirection tmpDirection; |
| 11680 | tANI_U8 *pBuf; |
| 11681 | tANI_U8 *p; |
| 11682 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11683 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11684 | if( ( 1 != numKeys ) && ( 0 != numKeys ) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11685 | // all of these fields appear in every SET_CONTEXT message. Below we'll add in the size for each |
| 11686 | // key set. Since we only support upto one key, we always allocate memory for 1 key |
| 11687 | msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) + |
| 11688 | sizeof( tSirMacAddr ) + 1 + sizeof(tANI_U16) + |
| 11689 | sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + |
| 11690 | ( sizeof( pMsg->keyMaterial.key ) ); |
| 11691 | |
| 11692 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 11693 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11694 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 11695 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SETCONTEXT_REQ); |
| 11696 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11697 | //sessionId |
| 11698 | pBuf = &pMsg->sessionId; |
| 11699 | *pBuf = (tANI_U8)sessionId; |
| 11700 | pBuf++; |
| 11701 | // transactionId |
| 11702 | *pBuf = 0; |
| 11703 | *(pBuf + 1) = 0; |
| 11704 | pBuf += sizeof(tANI_U16); |
| 11705 | // peerMacAddr |
| 11706 | palCopyMemory( pMac->hHdd, pBuf, |
| 11707 | (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr) ); |
| 11708 | |
| 11709 | pBuf += sizeof(tSirMacAddr); |
| 11710 | |
| 11711 | // bssId |
| 11712 | palCopyMemory( pMac->hHdd, pBuf, |
| 11713 | (tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 11714 | |
| 11715 | pBuf += sizeof(tSirMacAddr); |
| 11716 | |
| 11717 | p = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11718 | // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field |
| 11719 | // in the tSirKeyMaterial keyMaterial; field). |
| 11720 | // |
| 11721 | // !!NOTE: This keyMaterial.length contains the length of a MAX size key, though the keyLength can be |
| 11722 | // shorter than this max size. Is LIM interpreting this ok ? |
| 11723 | p = pal_set_U16( p, pal_cpu_to_be16((tANI_U16)( sizeof( pMsg->keyMaterial.numKeys ) + ( numKeys * sizeof( pMsg->keyMaterial.key ) ) )) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11724 | // set pMsg->keyMaterial.edType |
| 11725 | tmpEdType = (tAniEdType)pal_cpu_to_be32(edType); |
| 11726 | palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType) ); |
| 11727 | p += sizeof( pMsg->keyMaterial.edType ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11728 | // set the pMsg->keyMaterial.numKeys field |
| 11729 | *p = numKeys; |
| 11730 | p += sizeof( pMsg->keyMaterial.numKeys ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11731 | // set pSirKey->keyId = keyId; |
| 11732 | *p = keyId; |
| 11733 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11734 | // set pSirKey->unicast = (tANI_U8)fUnicast; |
| 11735 | *p = (tANI_U8)fUnicast; |
| 11736 | p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11737 | // set pSirKey->keyDirection = aniKeyDirection; |
| 11738 | tmpDirection = (tAniKeyDirection)pal_cpu_to_be32(aniKeyDirection); |
| 11739 | palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection) ); |
| 11740 | p += sizeof(tAniKeyDirection); |
| 11741 | // pSirKey->keyRsc = ;; |
| 11742 | palCopyMemory( pMac->hHdd, p, pKeyRsc, CSR_MAX_RSC_LEN ); |
| 11743 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11744 | // set pSirKey->paeRole |
| 11745 | *p = paeRole; // 0 is Supplicant |
| 11746 | p++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11747 | // set pSirKey->keyLength = keyLength; |
| 11748 | p = pal_set_U16( p, pal_cpu_to_be16(keyLength) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11749 | if ( keyLength && pKey ) |
| 11750 | { |
| 11751 | palCopyMemory( pMac->hHdd, p, pKey, keyLength ); |
| 11752 | if(keyLength == 16) |
| 11753 | { |
| 11754 | smsLog(pMac, LOGE, " SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n", |
| 11755 | keyId, edType, pKey[0], pKey[1], pKey[2], pKey[3], pKey[4], |
| 11756 | pKey[5], pKey[6], pKey[7], pKey[8], |
| 11757 | pKey[9], pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], pKey[15]); |
| 11758 | } |
| 11759 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11760 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11761 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11762 | return( status ); |
| 11763 | } |
| 11764 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11765 | eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, |
| 11766 | tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc ) |
| 11767 | { |
| 11768 | eHalStatus status; |
| 11769 | tSirSmeStartBssReq *pMsg; |
| 11770 | tANI_U8 *pBuf = NULL; |
| 11771 | tANI_U8 *wTmpBuf = NULL; |
| 11772 | tANI_U16 msgLen, wTmp; |
| 11773 | tANI_U32 dwTmp; |
| 11774 | tSirNwType nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 11775 | ePhyChanBondState cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11776 | #ifdef WLAN_SOFTAP_FEATURE |
| 11777 | tANI_U32 authType; |
| 11778 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11779 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11780 | do { |
| 11781 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 11782 | pSession->joinFailStatusCode.reasonCode = 0; |
| 11783 | msgLen = sizeof(tSirSmeStartBssReq); |
| 11784 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 11785 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11786 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 11787 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_START_BSS_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11788 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11789 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11790 | //sessionId |
| 11791 | *pBuf = (tANI_U8)sessionId; |
| 11792 | pBuf++; |
| 11793 | // transactionId |
| 11794 | *pBuf = 0; |
| 11795 | *(pBuf + 1) = 0; |
| 11796 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11797 | // bssid |
| 11798 | palCopyMemory( pMac->hHdd, pBuf, pParam->bssid, sizeof(tSirMacAddr) ); |
| 11799 | pBuf += sizeof(tSirMacAddr); |
| 11800 | // selfMacAddr |
| 11801 | palCopyMemory( pMac->hHdd, pBuf, pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 11802 | pBuf += sizeof(tSirMacAddr); |
| 11803 | // beaconInterval |
| 11804 | if( pBssDesc && pBssDesc->beaconInterval ) |
| 11805 | { |
| 11806 | wTmp = pal_cpu_to_be16( pBssDesc->beaconInterval ); |
| 11807 | } |
| 11808 | #ifdef WLAN_SOFTAP_FEATURE |
| 11809 | else if(pParam->beaconInterval) |
| 11810 | { |
| 11811 | wTmp = pal_cpu_to_be16( pParam->beaconInterval ); |
| 11812 | } |
| 11813 | #endif |
| 11814 | else |
| 11815 | { |
| 11816 | wTmp = pal_cpu_to_be16( WNI_CFG_BEACON_INTERVAL_STADEF ); |
| 11817 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 11818 | if(csrIsconcurrentsessionValid (pMac, sessionId, |
| 11819 | pParam->bssPersona) |
| 11820 | == eHAL_STATUS_SUCCESS ) |
| 11821 | { |
| 11822 | csrValidateBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId, |
| 11823 | pParam->bssPersona); |
| 11824 | //Update the beacon Interval |
| 11825 | pParam->beaconInterval = wTmp; |
| 11826 | } |
| 11827 | else |
| 11828 | { |
| 11829 | smsLog( pMac,LOGE, FL("****Start BSS failed persona already exists***\n")); |
| 11830 | status = eHAL_STATUS_FAILURE; |
| 11831 | return status; |
| 11832 | } |
| 11833 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11834 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); |
| 11835 | pBuf += sizeof(tANI_U16); |
| 11836 | // dot11mode |
| 11837 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pParam->uCfgDot11Mode ); |
| 11838 | pBuf += 1; |
| 11839 | // bssType |
| 11840 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( bssType ) ); |
| 11841 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 11842 | pBuf += sizeof(tSirBssType); |
| 11843 | // ssId |
| 11844 | if( pParam->ssId.length ) |
| 11845 | { |
| 11846 | // ssId len |
| 11847 | *pBuf = pParam->ssId.length; |
| 11848 | pBuf++; |
| 11849 | palCopyMemory( pMac->hHdd, pBuf, pParam->ssId.ssId, pParam->ssId.length ); |
| 11850 | pBuf += pParam->ssId.length; |
| 11851 | } |
| 11852 | else |
| 11853 | { |
| 11854 | *pBuf = 0; |
| 11855 | pBuf++; |
| 11856 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11857 | // set the channel Id |
| 11858 | *pBuf = pParam->operationChn; |
| 11859 | pBuf++; |
| 11860 | //What should we really do for the cbmode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 11861 | cbMode = (ePhyChanBondState)pal_cpu_to_be32(pParam->cbMode); |
| 11862 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState) ); |
| 11863 | pBuf += sizeof(ePhyChanBondState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11864 | |
| 11865 | #ifdef WLAN_SOFTAP_FEATURE |
| 11866 | // Set privacy |
| 11867 | *pBuf = pParam->privacy; |
| 11868 | pBuf++; |
| 11869 | |
| 11870 | //Set Uapsd |
| 11871 | *pBuf = pParam->ApUapsdEnable; |
| 11872 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11873 | //Set SSID hidden |
| 11874 | *pBuf = pParam->ssidHidden; |
| 11875 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11876 | *pBuf = (tANI_U8)pParam->fwdWPSPBCProbeReq; |
| 11877 | pBuf++; |
| 11878 | |
| 11879 | //Ht protection Enable/Disable |
| 11880 | *pBuf = (tANI_U8)pParam->protEnabled; |
| 11881 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11882 | //Enable Beacons to Receive for OBSS protection Enable/Disable |
| 11883 | *pBuf = (tANI_U8)pParam->obssProtEnabled; |
| 11884 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11885 | //set cfg related to protection |
| 11886 | wTmp = pal_cpu_to_be16( pParam->ht_protection ); |
| 11887 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); |
| 11888 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11889 | // Set Auth type |
| 11890 | authType = pal_cpu_to_be32(pParam->authType); |
| 11891 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&authType, sizeof(tANI_U32)); |
| 11892 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11893 | // Set DTIM |
| 11894 | dwTmp = pal_cpu_to_be32(pParam->dtimPeriod); |
| 11895 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 11896 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11897 | // Set wps_state |
| 11898 | *pBuf = pParam->wps_state; |
| 11899 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11900 | #endif |
| 11901 | //Persona |
| 11902 | *pBuf = (tANI_U8)pParam->bssPersona; |
| 11903 | pBuf++; |
| 11904 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 11905 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11906 | |
| 11907 | // set RSN IE |
| 11908 | if( pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata) ) |
| 11909 | { |
| 11910 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 11911 | palFreeMemory( pMac->hHdd, pMsg ); |
| 11912 | break; |
| 11913 | } |
| 11914 | wTmp = pal_cpu_to_be16( pParam->nRSNIELength ); |
| 11915 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11916 | pBuf += sizeof(tANI_U16); |
| 11917 | if( wTmp ) |
| 11918 | { |
| 11919 | wTmp = pParam->nRSNIELength; |
| 11920 | palCopyMemory( pMac->hHdd, pBuf, pParam->pRSNIE, wTmp ); |
| 11921 | pBuf += wTmp; |
| 11922 | } |
| 11923 | nwType = (tSirNwType)pal_cpu_to_be32(pParam->sirNwType); |
| 11924 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType) ); |
| 11925 | pBuf += sizeof(tSirNwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11926 | *pBuf = pParam->operationalRateSet.numRates; //tSirMacRateSet->numRates |
| 11927 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11928 | palCopyMemory( pMac->hHdd, pBuf, pParam->operationalRateSet.rate, pParam->operationalRateSet.numRates ); |
| 11929 | pBuf += pParam->operationalRateSet.numRates ; |
| 11930 | *pBuf++ = pParam->extendedRateSet.numRates; |
| 11931 | if(0 != pParam->extendedRateSet.numRates) |
| 11932 | { |
| 11933 | palCopyMemory( pMac->hHdd, pBuf, pParam->extendedRateSet.rate, pParam->extendedRateSet.numRates ); |
| 11934 | pBuf += pParam->extendedRateSet.numRates; |
| 11935 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11936 | msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg |
| 11937 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 11938 | |
| 11939 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11940 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11941 | return( status ); |
| 11942 | } |
| 11943 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11944 | eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 11945 | { |
| 11946 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 11947 | tSirSmeStopBssReq *pMsg; |
| 11948 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11949 | tANI_U8 *pBuf; |
| 11950 | tANI_U16 msgLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11951 | do { |
| 11952 | status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq)); |
| 11953 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11954 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq )); |
| 11955 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 11956 | pBuf = &pMsg->sessionId; |
| 11957 | //sessionId |
| 11958 | *pBuf = (tANI_U8)sessionId; |
| 11959 | pBuf++; |
| 11960 | // transactionId |
| 11961 | *pBuf = 0; |
| 11962 | pBuf += sizeof(tANI_U16); |
| 11963 | //reason code |
| 11964 | *pBuf = 0; |
| 11965 | pBuf += sizeof(tSirResultCodes); |
| 11966 | // bssid |
| 11967 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 11968 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 11969 | { |
| 11970 | palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 11971 | } |
| 11972 | else |
| 11973 | { |
| 11974 | palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 11975 | } |
| 11976 | pBuf += sizeof(tSirMacAddr); |
| 11977 | msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr); |
| 11978 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11979 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 11980 | #if 0 |
| 11981 | status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq)); |
| 11982 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11983 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq )); |
| 11984 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 11985 | pMsg->reasonCode = 0; |
| 11986 | // bssid |
| 11987 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 11988 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 11989 | { |
| 11990 | pbBssid = (tANI_U8 *)&pSession->selfMacAddr; |
| 11991 | } |
| 11992 | else |
| 11993 | { |
| 11994 | pbBssid = (tANI_U8 *)&pSession->connectedProfile.bssid; |
| 11995 | } |
| 11996 | palCopyMemory( pMac->hHdd, &pMsg->bssId, pbBssid, sizeof(tSirMacAddr) ); |
| 11997 | pMsg->transactionId = 0; |
| 11998 | pMsg->sessionId = (tANI_U8)sessionId; |
| 11999 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeStopBssReq )); |
| 12000 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12001 | #endif |
| 12002 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12003 | return( status ); |
| 12004 | } |
| 12005 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12006 | eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12007 | tCsrRoamModifyProfileFields *pModProfileFields, |
| 12008 | tANI_U32 *pRoamId, v_BOOL_t fForce) |
| 12009 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12010 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12011 | tANI_U32 roamId = 0; |
| 12012 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12013 | if((csrIsConnStateConnected(pMac, sessionId)) && |
| 12014 | (fForce || (!palEqualMemory(pMac->hHdd, &pModProfileFields, |
| 12015 | &pSession->connectedProfile.modifyProfileFields, |
| 12016 | sizeof(tCsrRoamModifyProfileFields)))) ) |
| 12017 | { |
| 12018 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 12019 | if(pRoamId) |
| 12020 | { |
| 12021 | *pRoamId = roamId; |
| 12022 | } |
| 12023 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12024 | status = csrRoamIssueReassoc(pMac, sessionId, NULL, pModProfileFields, |
| 12025 | eCsrSmeIssuedReassocToSameAP, roamId, |
| 12026 | eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12027 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12028 | return status; |
| 12029 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12030 | static eHalStatus csrRoamSessionOpened(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12031 | { |
| 12032 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12033 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12034 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 12035 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 12036 | eCSR_ROAM_SESSION_OPENED, eCSR_ROAM_RESULT_NONE); |
| 12037 | return (status); |
| 12038 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12039 | eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 12040 | { |
| 12041 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12042 | tListElem *pEntry = NULL; |
| 12043 | tSmeCmd *pCommand = NULL; |
| 12044 | tSirSmeAddStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12045 | do |
| 12046 | { |
| 12047 | if(pMsg == NULL) |
| 12048 | { |
| 12049 | smsLog(pMac, LOGE, "in %s msg ptr is NULL\n", __FUNCTION__); |
| 12050 | status = eHAL_STATUS_FAILURE; |
| 12051 | break; |
| 12052 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12053 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 12054 | if(pEntry) |
| 12055 | { |
| 12056 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 12057 | if(eSmeCommandAddStaSession == pCommand->command) |
| 12058 | { |
| 12059 | pRsp = (tSirSmeAddStaSelfRsp*)pMsg; |
| 12060 | smsLog( pMac, LOG1, "Add Sta rsp status = %d\n", pRsp->status ); |
| 12061 | //Nothing to be done. May be indicate the self sta addition success by calling session callback (TODO). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12062 | csrRoamSessionOpened(pMac, pCommand->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12063 | //Remove this command out of the active list |
| 12064 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 12065 | { |
| 12066 | //Now put this command back on the avilable command list |
| 12067 | csrReleaseCommand(pMac, pCommand); |
| 12068 | } |
| 12069 | smeProcessPendingQueue( pMac ); |
| 12070 | } |
| 12071 | else |
| 12072 | { |
| 12073 | smsLog(pMac, LOGE, "in %s eWNI_SME_ADD_STA_SELF_RSP Received but NO Add sta session command are ACTIVE ...\n", |
| 12074 | __FUNCTION__); |
| 12075 | status = eHAL_STATUS_FAILURE; |
| 12076 | break; |
| 12077 | } |
| 12078 | } |
| 12079 | else |
| 12080 | { |
| 12081 | smsLog(pMac, LOGE, "in %s eWNI_SME_ADD_STA_SELF_RSP Received but NO commands are ACTIVE ...\n", |
| 12082 | __FUNCTION__); |
| 12083 | status = eHAL_STATUS_FAILURE; |
| 12084 | break; |
| 12085 | } |
| 12086 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12087 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12088 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12089 | eHalStatus csrSendMBAddSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 12090 | { |
| 12091 | tSirSmeAddStaSelfReq *pMsg; |
| 12092 | tANI_U16 msgLen; |
| 12093 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12094 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12095 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 12096 | sizeof( tSirBssType )*/; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12097 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12098 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12099 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12100 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ADD_STA_SELF_REQ); |
| 12101 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12102 | // self station address |
| 12103 | palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12104 | smsLog( pMac, LOGE, FL("selfMac=%02x, %02x, %02x, %02x, %02x, %02x\n"), |
| 12105 | pMsg->selfMacAddr[0], |
| 12106 | pMsg->selfMacAddr[1], |
| 12107 | pMsg->selfMacAddr[2], |
| 12108 | pMsg->selfMacAddr[3], |
| 12109 | pMsg->selfMacAddr[4], |
| 12110 | pMsg->selfMacAddr[5]); |
| 12111 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12112 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12113 | return( status ); |
| 12114 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12115 | eHalStatus csrIssueAddStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr sessionMacAddr) |
| 12116 | { |
| 12117 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12118 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12119 | pCommand = csrGetCommandBuffer(pMac); |
| 12120 | if(NULL == pCommand) |
| 12121 | { |
| 12122 | status = eHAL_STATUS_RESOURCES; |
| 12123 | } |
| 12124 | else |
| 12125 | { |
| 12126 | pCommand->command = eSmeCommandAddStaSession; |
| 12127 | pCommand->sessionId = (tANI_U8)sessionId; |
| 12128 | palCopyMemory( pMac->hHdd, pCommand->u.addStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12129 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 12130 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 12131 | { |
| 12132 | //Should be panic?? |
| 12133 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 12134 | } |
| 12135 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12136 | return (status); |
| 12137 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12138 | eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 12139 | { |
| 12140 | return csrSendMBAddSelfStaReqMsg( pMac, |
| 12141 | pCommand->u.addStaSessionCmd.selfMacAddr ); |
| 12142 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12143 | eHalStatus csrRoamOpenSession( tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext, |
| 12144 | tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId ) |
| 12145 | { |
| 12146 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12147 | tANI_U32 i; |
| 12148 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12149 | *pbSessionId = CSR_SESSION_ID_INVALID; |
| 12150 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 12151 | { |
| 12152 | if( !CSR_IS_SESSION_VALID( pMac, i ) ) |
| 12153 | { |
| 12154 | pSession = CSR_GET_SESSION( pMac, i ); |
| 12155 | status = eHAL_STATUS_SUCCESS; |
| 12156 | pSession->sessionActive = eANI_BOOLEAN_TRUE; |
| 12157 | pSession->sessionId = (tANI_U8)i; |
| 12158 | pSession->callback = callback; |
| 12159 | pSession->pContext = pContext; |
| 12160 | palCopyMemory( pMac->hHdd, &pSession->selfMacAddr, pSelfMacAddr, sizeof(tCsrBssid) ); |
| 12161 | *pbSessionId = (tANI_U8)i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12162 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerRoaming, csrRoamRoamingTimerHandler, |
| 12163 | &pSession->roamingTimerInfo); |
| 12164 | if(!HAL_STATUS_SUCCESS(status)) |
| 12165 | { |
| 12166 | smsLog(pMac, LOGE, FL("cannot allocate memory for Roaming timer\n")); |
| 12167 | break; |
| 12168 | } |
| 12169 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 12170 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerJoinRetry, csrRoamJoinRetryTimerHandler, |
| 12171 | &pSession->joinRetryTimerInfo); |
| 12172 | if(!HAL_STATUS_SUCCESS(status)) |
| 12173 | { |
| 12174 | smsLog(pMac, LOGE, FL("cannot allocate memory for joinretry timer\n")); |
| 12175 | break; |
| 12176 | } |
| 12177 | #endif |
| 12178 | pSession->ibssJoinTimerInfo.pMac = pMac; |
| 12179 | pSession->ibssJoinTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12180 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerIbssJoining, csrRoamIbssJoinTimerHandler, |
| 12181 | &pSession->ibssJoinTimerInfo); |
| 12182 | if(!HAL_STATUS_SUCCESS(status)) |
| 12183 | { |
| 12184 | smsLog(pMac, LOGE, FL("cannot allocate memory for IbssJoining timer\n")); |
| 12185 | break; |
| 12186 | } |
| 12187 | status = csrIssueAddStaForSessionReq ( pMac, i, pSelfMacAddr ); |
| 12188 | break; |
| 12189 | } |
| 12190 | } |
| 12191 | if( CSR_ROAM_SESSION_MAX == i ) |
| 12192 | { |
| 12193 | //No session is available |
| 12194 | status = eHAL_STATUS_RESOURCES; |
| 12195 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12196 | return ( status ); |
| 12197 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12198 | eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 12199 | { |
| 12200 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12201 | tListElem *pEntry = NULL; |
| 12202 | tSmeCmd *pCommand = NULL; |
| 12203 | tSirSmeDelStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12204 | do |
| 12205 | { |
| 12206 | if(pMsg == NULL) |
| 12207 | { |
| 12208 | smsLog(pMac, LOGE, "in %s msg ptr is NULL\n", __FUNCTION__); |
| 12209 | status = eHAL_STATUS_FAILURE; |
| 12210 | break; |
| 12211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12212 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 12213 | if(pEntry) |
| 12214 | { |
| 12215 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 12216 | if(eSmeCommandDelStaSession == pCommand->command) |
| 12217 | { |
| 12218 | tANI_U8 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12219 | pRsp = (tSirSmeDelStaSelfRsp*)pMsg; |
| 12220 | smsLog( pMac, LOG1, "Del Sta rsp status = %d\n", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12221 | //This session is done. |
| 12222 | csrCleanupSession(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12223 | if(pCommand->u.delStaSessionCmd.callback) |
| 12224 | { |
| 12225 | |
| 12226 | status = sme_ReleaseGlobalLock( &pMac->sme ); |
| 12227 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 12228 | { |
| 12229 | pCommand->u.delStaSessionCmd.callback( |
| 12230 | pCommand->u.delStaSessionCmd.pContext); |
| 12231 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 12232 | if (! HAL_STATUS_SUCCESS( status ) ) |
| 12233 | { |
| 12234 | smsLog(pMac, LOGP, "%s: Failed to Acquire Lock\n", __FUNCTION__); |
| 12235 | return status; |
| 12236 | } |
| 12237 | } |
| 12238 | else { |
| 12239 | smsLog(pMac, LOGE, "%s: Failed to Release Lock\n", __FUNCTION__); |
| 12240 | } |
| 12241 | } |
| 12242 | |
| 12243 | //Remove this command out of the active list |
| 12244 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 12245 | { |
| 12246 | //Now put this command back on the avilable command list |
| 12247 | csrReleaseCommand(pMac, pCommand); |
| 12248 | } |
| 12249 | smeProcessPendingQueue( pMac ); |
| 12250 | } |
| 12251 | else |
| 12252 | { |
| 12253 | smsLog(pMac, LOGE, "in %s eWNI_SME_DEL_STA_SELF_RSP Received but NO Del sta session command are ACTIVE ...\n", |
| 12254 | __FUNCTION__); |
| 12255 | status = eHAL_STATUS_FAILURE; |
| 12256 | break; |
| 12257 | } |
| 12258 | } |
| 12259 | else |
| 12260 | { |
| 12261 | smsLog(pMac, LOGE, "in %s eWNI_SME_DEL_STA_SELF_RSP Received but NO commands are ACTIVE ...\n", |
| 12262 | __FUNCTION__); |
| 12263 | status = eHAL_STATUS_FAILURE; |
| 12264 | break; |
| 12265 | } |
| 12266 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12267 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12268 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12269 | eHalStatus csrSendMBDelSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 12270 | { |
| 12271 | tSirSmeDelStaSelfReq *pMsg; |
| 12272 | tANI_U16 msgLen; |
| 12273 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12274 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12275 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 12276 | sizeof( tSirBssType )*/; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12277 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12278 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12279 | |
| 12280 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12281 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_STA_SELF_REQ); |
| 12282 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12283 | // self station address |
| 12284 | palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12285 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12286 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12287 | return( status ); |
| 12288 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12289 | eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12290 | tSirMacAddr sessionMacAddr, |
| 12291 | csrRoamSessionCloseCallback callback, |
| 12292 | void *pContext) |
| 12293 | { |
| 12294 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12295 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12296 | pCommand = csrGetCommandBuffer(pMac); |
| 12297 | if(NULL == pCommand) |
| 12298 | { |
| 12299 | status = eHAL_STATUS_RESOURCES; |
| 12300 | } |
| 12301 | else |
| 12302 | { |
| 12303 | pCommand->command = eSmeCommandDelStaSession; |
| 12304 | pCommand->sessionId = (tANI_U8)sessionId; |
| 12305 | pCommand->u.delStaSessionCmd.callback = callback; |
| 12306 | pCommand->u.delStaSessionCmd.pContext = pContext; |
| 12307 | palCopyMemory( pMac->hHdd, pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12308 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 12309 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 12310 | { |
| 12311 | //Should be panic?? |
| 12312 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 12313 | } |
| 12314 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12315 | return (status); |
| 12316 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12317 | eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 12318 | { |
| 12319 | return csrSendMBDelSelfStaReqMsg( pMac, |
| 12320 | pCommand->u.delStaSessionCmd.selfMacAddr ); |
| 12321 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12322 | static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12323 | { |
| 12324 | tDblLinkList *pList = &pMac->roam.roamCmdPendingList; |
| 12325 | tListElem *pEntry, *pNext; |
| 12326 | tSmeCmd *pCommand; |
| 12327 | tDblLinkList localList; |
| 12328 | |
| 12329 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 12330 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 12331 | { |
| 12332 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 12333 | return; |
| 12334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12335 | csrLLLock(pList); |
| 12336 | pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK); |
| 12337 | while(pEntry != NULL) |
| 12338 | { |
| 12339 | pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK); |
| 12340 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 12341 | if(pCommand->sessionId == sessionId) |
| 12342 | { |
| 12343 | if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK)) |
| 12344 | { |
| 12345 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 12346 | } |
| 12347 | } |
| 12348 | pEntry = pNext; |
| 12349 | } |
| 12350 | csrLLUnlock(pList); |
| 12351 | |
| 12352 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 12353 | { |
| 12354 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 12355 | csrAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 12356 | } |
| 12357 | csrLLClose(&localList); |
| 12358 | } |
| 12359 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12360 | void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12361 | { |
| 12362 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 12363 | { |
| 12364 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12365 | csrRoamStop(pMac, sessionId); |
| 12366 | csrFreeConnectBssDesc(pMac, sessionId); |
| 12367 | csrRoamFreeConnectProfile( pMac, &pSession->connectedProfile ); |
| 12368 | csrRoamFreeConnectedInfo ( pMac, &pSession->connectedInfo); |
| 12369 | palTimerFree(pMac->hHdd, pSession->hTimerRoaming); |
| 12370 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 12371 | palTimerFree(pMac->hHdd, pSession->hTimerJoinRetry); |
| 12372 | #endif |
| 12373 | palTimerFree(pMac->hHdd, pSession->hTimerIbssJoining); |
| 12374 | purgeSmeSessionCmdList(pMac, sessionId); |
| 12375 | purgeCsrSessionCmdList(pMac, sessionId); |
| 12376 | csrInitSession(pMac, sessionId); |
| 12377 | } |
| 12378 | } |
| 12379 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12380 | eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12381 | tANI_BOOLEAN fSync, |
| 12382 | csrRoamSessionCloseCallback callback, |
| 12383 | void *pContext ) |
| 12384 | { |
| 12385 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12386 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 12387 | { |
| 12388 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12389 | if(fSync) |
| 12390 | { |
| 12391 | csrCleanupSession(pMac, sessionId); |
| 12392 | } |
| 12393 | else |
| 12394 | { |
| 12395 | purgeSmeSessionCmdList(pMac, sessionId); |
| 12396 | purgeCsrSessionCmdList(pMac, sessionId); |
| 12397 | status = csrIssueDelStaForSessionReq( pMac, sessionId, |
| 12398 | pSession->selfMacAddr, callback, pContext); |
| 12399 | } |
| 12400 | } |
| 12401 | else |
| 12402 | { |
| 12403 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 12404 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12405 | return ( status ); |
| 12406 | } |
| 12407 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12408 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 12409 | { |
| 12410 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12411 | pSession->sessionActive = eANI_BOOLEAN_FALSE; |
| 12412 | pSession->sessionId = CSR_SESSION_ID_INVALID; |
| 12413 | pSession->callback = NULL; |
| 12414 | pSession->pContext = NULL; |
| 12415 | pSession->ibss_join_pending = FALSE; |
| 12416 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 12417 | // TODO : Confirm pMac->roam.fReadyForPowerSave = eANI_BOOLEAN_FALSE; |
| 12418 | csrFreeRoamProfile( pMac, sessionId ); |
| 12419 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 12420 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 12421 | csrFreeConnectBssDesc(pMac, sessionId); |
| 12422 | csrScanEnable(pMac); |
| 12423 | palZeroMemory( pMac->hHdd, &pSession->selfMacAddr, sizeof(tCsrBssid) ); |
| 12424 | if(pSession->pWpaRsnReqIE) |
| 12425 | { |
| 12426 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 12427 | pSession->pWpaRsnReqIE = NULL; |
| 12428 | } |
| 12429 | pSession->nWpaRsnReqIeLength = 0; |
| 12430 | if(pSession->pWpaRsnRspIE) |
| 12431 | { |
| 12432 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE); |
| 12433 | pSession->pWpaRsnRspIE = NULL; |
| 12434 | } |
| 12435 | pSession->nWpaRsnRspIeLength = 0; |
| 12436 | #ifdef FEATURE_WLAN_WAPI |
| 12437 | if(pSession->pWapiReqIE) |
| 12438 | { |
| 12439 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 12440 | pSession->pWapiReqIE = NULL; |
| 12441 | } |
| 12442 | pSession->nWapiReqIeLength = 0; |
| 12443 | if(pSession->pWapiRspIE) |
| 12444 | { |
| 12445 | palFreeMemory(pMac->hHdd, pSession->pWapiRspIE); |
| 12446 | pSession->pWapiRspIE = NULL; |
| 12447 | } |
| 12448 | pSession->nWapiRspIeLength = 0; |
| 12449 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12450 | if(pSession->pAddIEScan) |
| 12451 | { |
| 12452 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 12453 | pSession->pAddIEScan = NULL; |
| 12454 | } |
| 12455 | pSession->nAddIEScanLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12456 | if(pSession->pAddIEAssoc) |
| 12457 | { |
| 12458 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 12459 | pSession->pAddIEAssoc = NULL; |
| 12460 | } |
| 12461 | pSession->nAddIEAssocLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12462 | } |
| 12463 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12464 | eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId ) |
| 12465 | { |
| 12466 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12467 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12468 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 12469 | { |
| 12470 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 12471 | { |
| 12472 | if( csrIsMacAddressEqual( pMac, bssid, &pMac->roam.roamSession[i].connectedProfile.bssid ) ) |
| 12473 | { |
| 12474 | //Found it |
| 12475 | status = eHAL_STATUS_SUCCESS; |
| 12476 | *pSessionId = i; |
| 12477 | break; |
| 12478 | } |
| 12479 | } |
| 12480 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12481 | return( status ); |
| 12482 | } |
| 12483 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12484 | //This function assumes that we only support one IBSS session. We cannot use BSSID to identify |
| 12485 | //session because for IBSS, the bssid changes. |
| 12486 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ) |
| 12487 | { |
| 12488 | tANI_U32 i, nRet = CSR_SESSION_ID_INVALID; |
| 12489 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12490 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 12491 | { |
| 12492 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 12493 | { |
| 12494 | pSession = CSR_GET_SESSION( pMac, i ); |
| 12495 | if( pSession->pCurRoamProfile && ( csrIsBssTypeIBSS( pSession->connectedProfile.BSSType ) ) ) |
| 12496 | { |
| 12497 | //Found it |
| 12498 | nRet = i; |
| 12499 | break; |
| 12500 | } |
| 12501 | } |
| 12502 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12503 | return (nRet); |
| 12504 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12505 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid) |
| 12506 | { |
| 12507 | /* Update the current BSS info in ho control block based on connected |
| 12508 | profile info from pmac global structure */ |
| 12509 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12510 | smsLog(pMac, LOGW, " csrRoamLinkUp: WLAN link UP with AP= %02x-%02x-%02x-%02x-%02x-%02x\n", |
| 12511 | bssid[ 0 ], bssid[ 1 ], bssid[ 2 ], |
| 12512 | bssid[ 3 ], bssid[ 4 ], bssid[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12513 | /* Check for user misconfig of RSSI trigger threshold */ |
| 12514 | pMac->roam.configParam.vccRssiThreshold = |
| 12515 | ( 0 == pMac->roam.configParam.vccRssiThreshold ) ? |
| 12516 | CSR_VCC_RSSI_THRESHOLD : pMac->roam.configParam.vccRssiThreshold; |
| 12517 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12518 | /* Check for user misconfig of UL MAC Loss trigger threshold */ |
| 12519 | pMac->roam.configParam.vccUlMacLossThreshold = |
| 12520 | ( 0 == pMac->roam.configParam.vccUlMacLossThreshold ) ? |
| 12521 | CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12522 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 12523 | { |
| 12524 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12525 | /* Indicate the neighbor roal algorithm about the connect indication */ |
| 12526 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId); |
| 12527 | csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS); |
| 12528 | } |
| 12529 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12530 | } |
| 12531 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12532 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12533 | { |
| 12534 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12535 | //Only to handle the case for Handover on infra link |
| 12536 | if( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 12537 | { |
| 12538 | return; |
| 12539 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12540 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 12541 | csrRoamDeregStatisticsReq(pMac); |
| 12542 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 12543 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 12544 | /* Indicate the neighbor roal algorithm about the disconnect indication */ |
| 12545 | csrNeighborRoamIndicateDisconnect(pMac, sessionId); |
| 12546 | #endif |
| 12547 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 12548 | #ifndef BMPS_WORKAROUND_NOT_NEEDED |
| 12549 | if(csrIsInfraApStarted( pMac ) && pMac->roam.configParam.doBMPSWorkaround) |
| 12550 | { |
| 12551 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 12552 | } |
| 12553 | #endif |
| 12554 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12555 | } |
| 12556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12557 | void csrRoamTlStatsTimerHandler(void *pv) |
| 12558 | { |
| 12559 | tpAniSirGlobal pMac = PMAC_STRUCT( pv ); |
| 12560 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12561 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 12562 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 12563 | smsLog(pMac, LOG1, FL(" TL stat timer is no-op. It needs to support multiple stations")); |
| 12564 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12565 | #if 0 |
| 12566 | // TODO Persession .??? |
| 12567 | //req TL for stats |
| 12568 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId)) |
| 12569 | { |
| 12570 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:couldn't get the stats from TL\n")); |
| 12571 | } |
| 12572 | else |
| 12573 | { |
| 12574 | //save in SME |
| 12575 | csrRoamSaveStatsFromTl(pMac, tlStats); |
| 12576 | } |
| 12577 | #endif |
| 12578 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 12579 | { |
| 12580 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 12581 | { |
| 12582 | //start timer |
| 12583 | status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 12584 | pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE); |
| 12585 | if(!HAL_STATUS_SUCCESS(status)) |
| 12586 | { |
| 12587 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:cannot start TlStatsTimer timer\n")); |
| 12588 | return; |
| 12589 | } |
| 12590 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 12591 | } |
| 12592 | } |
| 12593 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12594 | void csrRoamPeStatsTimerHandler(void *pv) |
| 12595 | { |
| 12596 | tCsrPeStatsReqInfo *pPeStatsReqListEntry = (tCsrPeStatsReqInfo *)pv; |
| 12597 | eHalStatus status; |
| 12598 | tpAniSirGlobal pMac = pPeStatsReqListEntry->pMac; |
| 12599 | VOS_STATUS vosStatus; |
| 12600 | tPmcPowerState powerState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12601 | pPeStatsReqListEntry->timerRunning = FALSE; |
| 12602 | if( pPeStatsReqListEntry->timerStopFailed == TRUE ) |
| 12603 | { |
| 12604 | // If we entered here, meaning the timer could not be successfully |
| 12605 | // stopped in csrRoamRemoveEntryFromPeStatsReqList(). So do it here. |
| 12606 | |
| 12607 | /* Destroy the timer */ |
| 12608 | vosStatus = vos_timer_destroy( &pPeStatsReqListEntry->hPeStatsTimer ); |
| 12609 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 12610 | { |
| 12611 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to destroy hPeStatsTimer timer\n")); |
| 12612 | } |
| 12613 | |
| 12614 | // Free the entry |
| 12615 | palFreeMemory(pMac->hHdd, pPeStatsReqListEntry); |
| 12616 | pPeStatsReqListEntry = NULL; |
| 12617 | } |
| 12618 | else |
| 12619 | { |
| 12620 | if(!pPeStatsReqListEntry->rspPending) |
| 12621 | { |
| 12622 | status = csrSendMBStatsReqMsg(pMac, pPeStatsReqListEntry->statsMask & ~(1 << eCsrGlobalClassDStats), |
| 12623 | pPeStatsReqListEntry->staId); |
| 12624 | if(!HAL_STATUS_SUCCESS(status)) |
| 12625 | { |
| 12626 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to send down stats req to PE\n")); |
| 12627 | } |
| 12628 | else |
| 12629 | { |
| 12630 | pPeStatsReqListEntry->rspPending = TRUE; |
| 12631 | } |
| 12632 | } |
| 12633 | |
| 12634 | //send down a req |
| 12635 | if(pPeStatsReqListEntry->periodicity && |
| 12636 | (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pPeStatsReqListEntry->hPeStatsTimer))) |
| 12637 | { |
| 12638 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 12639 | if(ePMC_FULL_POWER == powerState) |
| 12640 | { |
| 12641 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 12642 | { |
| 12643 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 12644 | } |
| 12645 | } |
| 12646 | else |
| 12647 | { |
| 12648 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 12649 | { |
| 12650 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 12651 | } |
| 12652 | } |
| 12653 | //start timer |
| 12654 | vosStatus = vos_timer_start( &pPeStatsReqListEntry->hPeStatsTimer, pPeStatsReqListEntry->periodicity ); |
| 12655 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 12656 | { |
| 12657 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:cannot start hPeStatsTimer timer\n")); |
| 12658 | return; |
| 12659 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12660 | pPeStatsReqListEntry->timerRunning = TRUE; |
| 12661 | |
| 12662 | } |
| 12663 | |
| 12664 | } |
| 12665 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12666 | void csrRoamStatsClientTimerHandler(void *pv) |
| 12667 | { |
| 12668 | tCsrStatsClientReqInfo *pStaEntry = (tCsrStatsClientReqInfo *)pv; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12669 | if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pStaEntry->timer)) |
| 12670 | { |
| 12671 | #if 0 |
| 12672 | // TODO Stats fix for multisession |
| 12673 | //start the timer |
| 12674 | vosStatus = vos_timer_start( &pStaEntry->timer, pStaEntry->periodicity ); |
| 12675 | |
| 12676 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 12677 | { |
| 12678 | smsLog(pStaEntry->pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12679 | } |
| 12680 | #endif |
| 12681 | } |
| 12682 | #if 0 |
| 12683 | //send up the stats report |
| 12684 | csrRoamReportStatistics(pStaEntry->pMac, pStaEntry->statsMask, pStaEntry->callback, |
| 12685 | pStaEntry->staId, pStaEntry->pContext); |
| 12686 | #endif |
| 12687 | } |
| 12688 | |
| 12689 | |
| 12690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12691 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId) |
| 12692 | { |
| 12693 | tAniGetPEStatsReq *pMsg; |
| 12694 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12695 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetPEStatsReq)); |
| 12696 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 12697 | { |
| 12698 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to allocate mem for stats req \n"); |
| 12699 | return status; |
| 12700 | } |
| 12701 | // need to initiate a stats request to PE |
| 12702 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_STATISTICS_REQ); |
| 12703 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq); |
| 12704 | pMsg->staId = staId; |
| 12705 | pMsg->statsMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12706 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12707 | if(!HAL_STATUS_SUCCESS(status)) |
| 12708 | { |
| 12709 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to send down the stats req \n"); |
| 12710 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12711 | return status; |
| 12712 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12713 | void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg) |
| 12714 | { |
| 12715 | tAniGetPEStatsRsp *pSmeStatsRsp; |
| 12716 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12717 | tListElem *pEntry = NULL; |
| 12718 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 12719 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 12720 | tANI_U32 tempMask = 0; |
| 12721 | tANI_U8 counter = 0; |
| 12722 | tANI_U8 *pStats = NULL; |
| 12723 | tANI_U32 length = 0; |
| 12724 | v_PVOID_t pvosGCtx; |
| 12725 | v_S7_t rssi = 0; |
| 12726 | tANI_U32 *pRssi = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12727 | pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg; |
| 12728 | if(pSmeStatsRsp->rc) |
| 12729 | { |
| 12730 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:stats rsp from PE shows failure\n")); |
| 12731 | goto post_update; |
| 12732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12733 | tempMask = pSmeStatsRsp->statsMask; |
| 12734 | pStats = ((tANI_U8 *)&pSmeStatsRsp->statsMask) + sizeof(pSmeStatsRsp->statsMask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12735 | /* subtract all statistics from this length, and after processing the entire |
| 12736 | * 'stat' part of the message, if the length is not zero, then rssi is piggy packed |
| 12737 | * in this 'stats' message. |
| 12738 | */ |
| 12739 | length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12740 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 12741 | while(tempMask) |
| 12742 | { |
| 12743 | if(tempMask & 1) |
| 12744 | { |
| 12745 | switch(counter) |
| 12746 | { |
| 12747 | case eCsrSummaryStats: |
| 12748 | smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:summary stats\n")); |
| 12749 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 12750 | pStats, sizeof(tCsrSummaryStatsInfo)); |
| 12751 | if(!HAL_STATUS_SUCCESS(status)) |
| 12752 | { |
| 12753 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy summary stats\n")); |
| 12754 | } |
| 12755 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 12756 | length -= sizeof(tCsrSummaryStatsInfo); |
| 12757 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12758 | case eCsrGlobalClassAStats: |
| 12759 | smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:ClassA stats\n")); |
| 12760 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 12761 | pStats, sizeof(tCsrGlobalClassAStatsInfo)); |
| 12762 | if(!HAL_STATUS_SUCCESS(status)) |
| 12763 | { |
| 12764 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassA stats\n")); |
| 12765 | } |
| 12766 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
| 12767 | length -= sizeof(tCsrGlobalClassAStatsInfo); |
| 12768 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12769 | case eCsrGlobalClassBStats: |
| 12770 | smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:ClassB stats\n")); |
| 12771 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 12772 | pStats, sizeof(tCsrGlobalClassBStatsInfo)); |
| 12773 | if(!HAL_STATUS_SUCCESS(status)) |
| 12774 | { |
| 12775 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassB stats\n")); |
| 12776 | } |
| 12777 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
| 12778 | length -= sizeof(tCsrGlobalClassBStatsInfo); |
| 12779 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12780 | case eCsrGlobalClassCStats: |
| 12781 | smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:ClassC stats\n")); |
| 12782 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 12783 | pStats, sizeof(tCsrGlobalClassCStatsInfo)); |
| 12784 | if(!HAL_STATUS_SUCCESS(status)) |
| 12785 | { |
| 12786 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassC stats\n")); |
| 12787 | } |
| 12788 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
| 12789 | length -= sizeof(tCsrGlobalClassCStatsInfo); |
| 12790 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12791 | case eCsrPerStaStats: |
| 12792 | smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:PerSta stats\n")); |
| 12793 | if( CSR_MAX_STA > pSmeStatsRsp->staId ) |
| 12794 | { |
| 12795 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId], |
| 12796 | pStats, sizeof(tCsrPerStaStatsInfo)); |
| 12797 | } |
| 12798 | else |
| 12799 | { |
| 12800 | status = eHAL_STATUS_FAILURE; |
| 12801 | smsLog( pMac, LOGE, FL("csrRoamStatsRspProcessor:out bound staId:%d\n"), pSmeStatsRsp->staId); |
| 12802 | VOS_ASSERT( 0 ); |
| 12803 | } |
| 12804 | if(!HAL_STATUS_SUCCESS(status)) |
| 12805 | { |
| 12806 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy PerSta stats\n")); |
| 12807 | } |
| 12808 | pStats += sizeof(tCsrPerStaStatsInfo); |
| 12809 | length -= sizeof(tCsrPerStaStatsInfo); |
| 12810 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12811 | default: |
| 12812 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type\n")); |
| 12813 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12814 | } |
| 12815 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12816 | tempMask >>=1; |
| 12817 | counter++; |
| 12818 | } |
| 12819 | pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 12820 | if (length != 0) |
| 12821 | { |
| 12822 | pRssi = (tANI_U32*)pStats; |
| 12823 | rssi = (v_S7_t)*pRssi; |
| 12824 | } |
| 12825 | else |
| 12826 | { |
| 12827 | /* If riva is not sending rssi, continue to use the hack */ |
| 12828 | rssi = RSSI_HACK_BMPS; |
| 12829 | } |
| 12830 | WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12831 | post_update: |
| 12832 | //make sure to update the pe stats req list |
| 12833 | pEntry = csrRoamFindInPeStatsReqList(pMac, pSmeStatsRsp->statsMask); |
| 12834 | if(pEntry) |
| 12835 | { |
| 12836 | pPeStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
| 12837 | pPeStaEntry->rspPending = FALSE; |
| 12838 | |
| 12839 | } |
| 12840 | //check the one timer cases |
| 12841 | pEntry = csrRoamCheckClientReqList(pMac, pSmeStatsRsp->statsMask); |
| 12842 | if(pEntry) |
| 12843 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12844 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12845 | if(pTempStaEntry->timerExpired) |
| 12846 | { |
| 12847 | //send up the stats report |
| 12848 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 12849 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 12850 | //also remove from the client list |
| 12851 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 12852 | pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12853 | } |
| 12854 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12855 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12856 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 12857 | { |
| 12858 | tListElem *pEntry = NULL; |
| 12859 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12860 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12861 | if(!pEntry) |
| 12862 | { |
| 12863 | //list empty |
| 12864 | smsLog(pMac, LOGW, "csrRoamFindInPeStatsReqList: List empty, no request to PE\n"); |
| 12865 | return NULL; |
| 12866 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12867 | while( pEntry ) |
| 12868 | { |
| 12869 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12870 | if(pTempStaEntry->statsMask == statsMask) |
| 12871 | { |
| 12872 | smsLog(pMac, LOGW, "csrRoamFindInPeStatsReqList: match found\n"); |
| 12873 | break; |
| 12874 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12875 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 12876 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12877 | return pEntry; |
| 12878 | } |
| 12879 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12880 | tListElem * csrRoamChecknUpdateClientReqList(tpAniSirGlobal pMac, tCsrStatsClientReqInfo *pStaEntry, |
| 12881 | tANI_BOOLEAN update) |
| 12882 | { |
| 12883 | tListElem *pEntry; |
| 12884 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12885 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12886 | if(!pEntry) |
| 12887 | { |
| 12888 | //list empty |
| 12889 | smsLog(pMac, LOGW, "csrRoamChecknUpdateClientReqList: List empty, no request from " |
| 12890 | "upper layer client(s)\n"); |
| 12891 | return NULL; |
| 12892 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12893 | while( pEntry ) |
| 12894 | { |
| 12895 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12896 | if((pTempStaEntry->requesterId == pStaEntry->requesterId) && |
| 12897 | (pTempStaEntry->statsMask == pStaEntry->statsMask)) |
| 12898 | { |
| 12899 | smsLog(pMac, LOGW, "csrRoamChecknUpdateClientReqList: match found\n"); |
| 12900 | if(update) |
| 12901 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 12902 | pTempStaEntry->periodicity = pStaEntry->periodicity; |
| 12903 | pTempStaEntry->callback = pStaEntry->callback; |
| 12904 | pTempStaEntry->pContext = pStaEntry->pContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12905 | } |
| 12906 | break; |
| 12907 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12908 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 12909 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12910 | return pEntry; |
| 12911 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12912 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 12913 | { |
| 12914 | tListElem *pEntry; |
| 12915 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12916 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12917 | if(!pEntry) |
| 12918 | { |
| 12919 | //list empty |
| 12920 | smsLog(pMac, LOGW, "csrRoamCheckClientReqList: List empty, no request from " |
| 12921 | "upper layer client(s)\n"); |
| 12922 | return NULL; |
| 12923 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12924 | while( pEntry ) |
| 12925 | { |
| 12926 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12927 | if((pTempStaEntry->statsMask & ~(1 << eCsrGlobalClassDStats)) == statsMask) |
| 12928 | { |
| 12929 | smsLog(pMac, LOGW, "csrRoamCheckClientReqList: match found\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12930 | break; |
| 12931 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12932 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 12933 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12934 | return pEntry; |
| 12935 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12936 | eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac, |
| 12937 | csrRoamLinkQualityIndCallback callback, |
| 12938 | void *pContext) |
| 12939 | { |
| 12940 | pMac->roam.linkQualityIndInfo.callback = callback; |
| 12941 | pMac->roam.linkQualityIndInfo.context = pContext; |
| 12942 | if( NULL == callback ) |
| 12943 | { |
| 12944 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being deregistered"); |
| 12945 | } |
| 12946 | else |
| 12947 | { |
| 12948 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being registered"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12949 | /* do we need to invoke the callback to notify client of initial value ?? */ |
| 12950 | } |
| 12951 | return eHAL_STATUS_SUCCESS; |
| 12952 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12953 | void csrRoamVccTrigger(tpAniSirGlobal pMac) |
| 12954 | { |
| 12955 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 12956 | tANI_U32 ul_mac_loss = 0; |
| 12957 | tANI_U32 ul_mac_loss_trigger_threshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12958 | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 12959 | /*------------------------------------------------------------------------- |
| 12960 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12961 | Check for a change in link quality and notify client if necessary |
| 12962 | -------------------------------------------------------------------------*/ |
| 12963 | ul_mac_loss_trigger_threshold = |
| 12964 | pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12965 | VOS_ASSERT( ul_mac_loss_trigger_threshold != 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12966 | smsLog(pMac, LOGW, "csrRoamVccTrigger: UL_MAC_LOSS_THRESHOLD is %d\n", |
| 12967 | ul_mac_loss_trigger_threshold ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12968 | if(ul_mac_loss_trigger_threshold < ul_mac_loss) |
| 12969 | { |
| 12970 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is POOR \n"); |
| 12971 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 12972 | } |
| 12973 | else |
| 12974 | { |
| 12975 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is GOOD\n"); |
| 12976 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 12977 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12978 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link qual : *** UL_MAC_LOSS %d *** ", |
| 12979 | ul_mac_loss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12980 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 12981 | { |
| 12982 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality changed: trigger necessary\n"); |
| 12983 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 12984 | { |
| 12985 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality indication %d\n", |
| 12986 | newVccLinkQuality ); |
| 12987 | |
| 12988 | /* we now invoke the callback once to notify client of initial value */ |
| 12989 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 12990 | pMac->roam.linkQualityIndInfo.context ); |
| 12991 | //event: EVENT_WLAN_VCC |
| 12992 | } |
| 12993 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12994 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
| 12995 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12996 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12997 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 12998 | v_U8_t rssiNotification, |
| 12999 | void * context) |
| 13000 | { |
| 13001 | tpAniSirGlobal pMac = PMAC_STRUCT( context ); |
| 13002 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 13003 | // TODO : Session info unavailable |
| 13004 | tANI_U32 sessionId = 0; |
| 13005 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 13006 | /*------------------------------------------------------------------------- |
| 13007 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13008 | Check for a change in link quality and notify client if necessary |
| 13009 | -------------------------------------------------------------------------*/ |
| 13010 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: RSSI trigger threshold is %d\n", |
| 13011 | pMac->roam.configParam.vccRssiThreshold); |
| 13012 | if(!csrIsConnStateConnectedInfra(pMac, sessionId)) |
| 13013 | { |
| 13014 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: ignoring the indication as we are not connected\n"); |
| 13015 | return VOS_STATUS_SUCCESS; |
| 13016 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13017 | if(WLANTL_HO_THRESHOLD_DOWN == rssiNotification) |
| 13018 | { |
| 13019 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is POOR\n"); |
| 13020 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 13021 | } |
| 13022 | else if(WLANTL_HO_THRESHOLD_UP == rssiNotification) |
| 13023 | { |
| 13024 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is GOOD \n"); |
| 13025 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 13026 | } |
| 13027 | else |
| 13028 | { |
| 13029 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: unknown rssi notification %d\n", rssiNotification); |
| 13030 | //Set to this so the code below won't do anything |
| 13031 | newVccLinkQuality = pMac->roam.vccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13032 | VOS_ASSERT(0); |
| 13033 | } |
| 13034 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13035 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 13036 | { |
| 13037 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality changed: trigger necessary\n"); |
| 13038 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 13039 | { |
| 13040 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality indication %d\n", |
| 13041 | newVccLinkQuality); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13042 | /* we now invoke the callback once to notify client of initial value */ |
| 13043 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 13044 | pMac->roam.linkQualityIndInfo.context ); |
| 13045 | //event: EVENT_WLAN_VCC |
| 13046 | } |
| 13047 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13048 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13049 | return status; |
| 13050 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13051 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 13052 | tDblLinkList *pStaList, |
| 13053 | tCsrStatsClientReqInfo *pStaEntry) |
| 13054 | { |
| 13055 | tCsrStatsClientReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13056 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13057 | //if same entity requested for same set of stats with different periodicity & |
| 13058 | // callback update it |
| 13059 | if(NULL == csrRoamChecknUpdateClientReqList(pMac, pStaEntry, TRUE)) |
| 13060 | { |
| 13061 | |
| 13062 | status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrStatsClientReqInfo)); |
| 13063 | if (!HAL_STATUS_SUCCESS(status)) |
| 13064 | { |
| 13065 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoList: couldn't allocate memory for the " |
| 13066 | "entry\n"); |
| 13067 | return NULL; |
| 13068 | } |
| 13069 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13070 | pNewStaEntry->callback = pStaEntry->callback; |
| 13071 | pNewStaEntry->pContext = pStaEntry->pContext; |
| 13072 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 13073 | pNewStaEntry->requesterId = pStaEntry->requesterId; |
| 13074 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 13075 | pNewStaEntry->pPeStaEntry = pStaEntry->pPeStaEntry; |
| 13076 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 13077 | pNewStaEntry->staId = pStaEntry->staId; |
| 13078 | pNewStaEntry->timerExpired = pStaEntry->timerExpired; |
| 13079 | |
| 13080 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
| 13081 | } |
| 13082 | return pNewStaEntry; |
| 13083 | } |
| 13084 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13085 | tCsrPeStatsReqInfo * csrRoamInsertEntryIntoPeStatsReqList( tpAniSirGlobal pMac, |
| 13086 | tDblLinkList *pStaList, |
| 13087 | tCsrPeStatsReqInfo *pStaEntry) |
| 13088 | { |
| 13089 | tCsrPeStatsReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13090 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13091 | status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrPeStatsReqInfo)); |
| 13092 | if (!HAL_STATUS_SUCCESS(status)) |
| 13093 | { |
| 13094 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoPeStatsReqList: couldn't allocate memory for the " |
| 13095 | "entry\n"); |
| 13096 | return NULL; |
| 13097 | } |
| 13098 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13099 | pNewStaEntry->hPeStatsTimer = pStaEntry->hPeStatsTimer; |
| 13100 | pNewStaEntry->numClient = pStaEntry->numClient; |
| 13101 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 13102 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 13103 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 13104 | pNewStaEntry->staId = pStaEntry->staId; |
| 13105 | pNewStaEntry->timerRunning = pStaEntry->timerRunning; |
| 13106 | pNewStaEntry->rspPending = pStaEntry->rspPending; |
| 13107 | |
| 13108 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13109 | return pNewStaEntry; |
| 13110 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13111 | eHalStatus csrGetRssi(tpAniSirGlobal pMac, |
| 13112 | tCsrRssiCallback callback, |
| 13113 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 13114 | { |
| 13115 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13116 | vos_msg_t msg; |
| 13117 | tANI_U32 sessionId; |
| 13118 | |
| 13119 | tAniGetRssiReq *pMsg; |
| 13120 | smsLog(pMac, LOG2, FL("called")); |
| 13121 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetRssiReq)); |
| 13122 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 13123 | { |
| 13124 | smsLog(pMac, LOGE, " csrGetRssi: failed to allocate mem for req \n"); |
| 13125 | return status; |
| 13126 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13127 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 13128 | |
| 13129 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_RSSI_REQ); |
| 13130 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 13131 | pMsg->sessionId = sessionId; |
| 13132 | pMsg->staId = staId; |
| 13133 | pMsg->rssiCallback = callback; |
| 13134 | pMsg->pDevContext = pContext; |
| 13135 | pMsg->pVosContext = pVosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13136 | msg.type = eWNI_SME_GET_RSSI_REQ; |
| 13137 | msg.bodyptr = pMsg; |
| 13138 | msg.reserved = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13139 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 13140 | { |
| 13141 | smsLog(pMac, LOGE, " csrGetRssi failed to post msg to self \n"); |
| 13142 | palFreeMemory(pMac->hHdd, (void *)pMsg); |
| 13143 | status = eHAL_STATUS_FAILURE; |
| 13144 | } |
| 13145 | smsLog(pMac, LOG2, FL("returned")); |
| 13146 | return status; |
| 13147 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13148 | eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, |
| 13149 | tANI_U32 statsMask, |
| 13150 | tCsrStatsCallback callback, |
| 13151 | tANI_U32 periodicity, tANI_BOOLEAN cache, |
| 13152 | tANI_U8 staId, void *pContext) |
| 13153 | { |
| 13154 | tCsrStatsClientReqInfo staEntry; |
| 13155 | tCsrStatsClientReqInfo *pStaEntry = NULL; |
| 13156 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 13157 | tListElem *pEntry = NULL; |
| 13158 | tANI_BOOLEAN found = FALSE; |
| 13159 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13160 | tANI_BOOLEAN insertInClientList = FALSE; |
| 13161 | VOS_STATUS vosStatus; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13162 | WLANTL_TRANSFER_STA_TYPE *pTlStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13163 | |
| 13164 | if( csrIsAllSessionDisconnected(pMac) ) |
| 13165 | { |
| 13166 | //smsLog(pMac, LOGW, "csrGetStatistics: wrong state curState(%d) not connected\n", pMac->roam.curState); |
| 13167 | return eHAL_STATUS_FAILURE; |
| 13168 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13169 | if((!statsMask) && (!callback)) |
| 13170 | { |
| 13171 | //msg |
| 13172 | smsLog(pMac, LOGW, "csrGetStatistics: statsMask & callback empty in the request\n"); |
| 13173 | return eHAL_STATUS_FAILURE; |
| 13174 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13175 | //for the search list method for deregister |
| 13176 | staEntry.requesterId = requesterId; |
| 13177 | staEntry.statsMask = statsMask; |
| 13178 | //requester wants to deregister or just an error |
| 13179 | if((statsMask) && (!callback)) |
| 13180 | { |
| 13181 | pEntry = csrRoamChecknUpdateClientReqList(pMac, &staEntry, FALSE); |
| 13182 | if(!pEntry) |
| 13183 | { |
| 13184 | //msg |
| 13185 | smsLog(pMac, LOGW, "csrGetStatistics: callback is empty in the request & couldn't " |
| 13186 | "find any existing request in statsClientReqList\n"); |
| 13187 | return eHAL_STATUS_FAILURE; |
| 13188 | } |
| 13189 | else |
| 13190 | { |
| 13191 | //clean up & return |
| 13192 | pStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 13193 | if(NULL != pStaEntry->pPeStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13194 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13195 | pStaEntry->pPeStaEntry->numClient--; |
| 13196 | //check if we need to delete the entry from peStatsReqList too |
| 13197 | if(!pStaEntry->pPeStaEntry->numClient) |
| 13198 | { |
| 13199 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pStaEntry->pPeStaEntry); |
| 13200 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13201 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 13202 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13203 | //check if we need to stop the tl stats timer too |
| 13204 | pMac->roam.tlStatsReqInfo.numClient--; |
| 13205 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 13206 | { |
| 13207 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 13208 | { |
| 13209 | status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 13210 | if(!HAL_STATUS_SUCCESS(status)) |
| 13211 | { |
| 13212 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot stop TlStatsTimer timer\n")); |
| 13213 | return eHAL_STATUS_FAILURE; |
| 13214 | } |
| 13215 | } |
| 13216 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 13217 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 13218 | } |
| 13219 | vos_timer_stop( &pStaEntry->timer ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13220 | // Destroy the vos timer... |
| 13221 | vosStatus = vos_timer_destroy( &pStaEntry->timer ); |
| 13222 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13223 | { |
| 13224 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer\n")); |
| 13225 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13226 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 13227 | pStaEntry = NULL; |
| 13228 | return eHAL_STATUS_SUCCESS; |
| 13229 | } |
| 13230 | } |
| 13231 | |
| 13232 | if(cache && !periodicity) |
| 13233 | { |
| 13234 | //return the cached stats |
| 13235 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 13236 | } |
| 13237 | else |
| 13238 | { |
| 13239 | //add the request in the client req list |
| 13240 | staEntry.callback = callback; |
| 13241 | staEntry.pContext = pContext; |
| 13242 | staEntry.periodicity = periodicity; |
| 13243 | staEntry.pPeStaEntry = NULL; |
| 13244 | staEntry.staId = staId; |
| 13245 | staEntry.pMac = pMac; |
| 13246 | staEntry.timerExpired = FALSE; |
| 13247 | |
| 13248 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13249 | //if periodic report requested with non cached result from PE/TL |
| 13250 | if(periodicity) |
| 13251 | { |
| 13252 | |
| 13253 | //if looking for stats from PE |
| 13254 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 13255 | { |
| 13256 | |
| 13257 | //check if same request made already & waiting for rsp |
| 13258 | pPeStaEntry = csrRoamCheckPeStatsReqList(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), |
| 13259 | periodicity, &found, staId); |
| 13260 | if(!pPeStaEntry) |
| 13261 | { |
| 13262 | //bail out, maxed out on number of req for PE |
| 13263 | return eHAL_STATUS_FAILURE; |
| 13264 | } |
| 13265 | else |
| 13266 | { |
| 13267 | staEntry.pPeStaEntry = pPeStaEntry; |
| 13268 | } |
| 13269 | |
| 13270 | } |
| 13271 | //request stats from TL rightaway if requested by client, update tlStatsReqInfo if needed |
| 13272 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 13273 | { |
| 13274 | if(cache && pMac->roam.tlStatsReqInfo.numClient) |
| 13275 | { |
| 13276 | smsLog(pMac, LOGE, FL("csrGetStatistics:Looking for cached stats from TL\n")); |
| 13277 | } |
| 13278 | else |
| 13279 | { |
| 13280 | |
| 13281 | //update periodicity |
| 13282 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 13283 | { |
| 13284 | pMac->roam.tlStatsReqInfo.periodicity = |
| 13285 | CSR_ROAM_MIN(periodicity, pMac->roam.tlStatsReqInfo.periodicity); |
| 13286 | } |
| 13287 | else |
| 13288 | { |
| 13289 | pMac->roam.tlStatsReqInfo.periodicity = periodicity; |
| 13290 | } |
| 13291 | if(pMac->roam.tlStatsReqInfo.periodicity < CSR_MIN_TL_STAT_QUERY_PERIOD) |
| 13292 | { |
| 13293 | pMac->roam.tlStatsReqInfo.periodicity = CSR_MIN_TL_STAT_QUERY_PERIOD; |
| 13294 | } |
| 13295 | |
| 13296 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 13297 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13298 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 13299 | if(NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13300 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13301 | //req TL for class D stats |
| 13302 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId)) |
| 13303 | { |
| 13304 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL\n")); |
| 13305 | } |
| 13306 | else |
| 13307 | { |
| 13308 | //save in SME |
| 13309 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 13310 | } |
| 13311 | vos_mem_free(pTlStats); |
| 13312 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13313 | } |
| 13314 | else |
| 13315 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13316 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13317 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13318 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13319 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 13320 | { |
| 13321 | //start timer |
| 13322 | status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 13323 | pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE); |
| 13324 | if(!HAL_STATUS_SUCCESS(status)) |
| 13325 | { |
| 13326 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start TlStatsTimer timer\n")); |
| 13327 | return eHAL_STATUS_FAILURE; |
| 13328 | } |
| 13329 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 13330 | } |
| 13331 | } |
| 13332 | } |
| 13333 | pMac->roam.tlStatsReqInfo.numClient++; |
| 13334 | } |
| 13335 | |
| 13336 | insertInClientList = TRUE; |
| 13337 | } |
| 13338 | //if one time report requested with non cached result from PE/TL |
| 13339 | else if(!cache && !periodicity) |
| 13340 | { |
| 13341 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 13342 | { |
| 13343 | //send down a req |
| 13344 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 13345 | if(!HAL_STATUS_SUCCESS(status)) |
| 13346 | { |
| 13347 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to send down stats req to PE\n")); |
| 13348 | } |
| 13349 | //so that when the stats rsp comes back from PE we respond to upper layer |
| 13350 | //right away |
| 13351 | staEntry.timerExpired = TRUE; |
| 13352 | insertInClientList = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13353 | } |
| 13354 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 13355 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13356 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 13357 | if(NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13358 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13359 | //req TL for class D stats |
| 13360 | if(!VOS_IS_STATUS_SUCCESS(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId))) |
| 13361 | { |
| 13362 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL\n")); |
| 13363 | } |
| 13364 | else |
| 13365 | { |
| 13366 | //save in SME |
| 13367 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 13368 | } |
| 13369 | vos_mem_free(pTlStats); |
| 13370 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13371 | } |
| 13372 | else |
| 13373 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13374 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13375 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13376 | |
| 13377 | } |
| 13378 | //if looking for stats from TL only |
| 13379 | if(!insertInClientList) |
| 13380 | { |
| 13381 | //return the stats |
| 13382 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 13383 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13384 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13385 | if(insertInClientList) |
| 13386 | { |
| 13387 | pStaEntry = csrRoamInsertEntryIntoList(pMac, &pMac->roam.statsClientReqList, &staEntry); |
| 13388 | if(!pStaEntry) |
| 13389 | { |
| 13390 | //msg |
| 13391 | smsLog(pMac, LOGW, "csrGetStatistics: Failed to insert req in statsClientReqList\n"); |
| 13392 | return eHAL_STATUS_FAILURE; |
| 13393 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13394 | pStaEntry->periodicity = periodicity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13395 | //Init & start timer if needed |
| 13396 | if(periodicity) |
| 13397 | { |
| 13398 | vosStatus = vos_timer_init( &pStaEntry->timer, VOS_TIMER_TYPE_SW, |
| 13399 | csrRoamStatsClientTimerHandler, pStaEntry ); |
| 13400 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13401 | { |
| 13402 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot init StatsClient timer\n")); |
| 13403 | return eHAL_STATUS_FAILURE; |
| 13404 | } |
| 13405 | vosStatus = vos_timer_start( &pStaEntry->timer, periodicity ); |
| 13406 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13407 | { |
| 13408 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer\n")); |
| 13409 | return eHAL_STATUS_FAILURE; |
| 13410 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13411 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13412 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13413 | } |
| 13414 | return eHAL_STATUS_SUCCESS; |
| 13415 | } |
| 13416 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13417 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 13418 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId) |
| 13419 | { |
| 13420 | tANI_BOOLEAN found = FALSE; |
| 13421 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13422 | tCsrPeStatsReqInfo staEntry; |
| 13423 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
| 13424 | tListElem *pStaEntry = NULL; |
| 13425 | VOS_STATUS vosStatus; |
| 13426 | tPmcPowerState powerState; |
| 13427 | *pFound = FALSE; |
| 13428 | |
| 13429 | pStaEntry = csrRoamFindInPeStatsReqList(pMac, statsMask); |
| 13430 | if(pStaEntry) |
| 13431 | { |
| 13432 | pTempStaEntry = GET_BASE_ADDR( pStaEntry, tCsrPeStatsReqInfo, link ); |
| 13433 | if(pTempStaEntry->periodicity) |
| 13434 | { |
| 13435 | pTempStaEntry->periodicity = |
| 13436 | CSR_ROAM_MIN(periodicity, pTempStaEntry->periodicity); |
| 13437 | } |
| 13438 | else |
| 13439 | { |
| 13440 | pTempStaEntry->periodicity = periodicity; |
| 13441 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13442 | pTempStaEntry->numClient++; |
| 13443 | found = TRUE; |
| 13444 | } |
| 13445 | else |
| 13446 | { |
| 13447 | palZeroMemory(pMac->hHdd, &staEntry, sizeof(tCsrPeStatsReqInfo)); |
| 13448 | staEntry.numClient = 1; |
| 13449 | staEntry.periodicity = periodicity; |
| 13450 | staEntry.pMac = pMac; |
| 13451 | staEntry.rspPending = FALSE; |
| 13452 | staEntry.staId = staId; |
| 13453 | staEntry.statsMask = statsMask; |
| 13454 | staEntry.timerRunning = FALSE; |
| 13455 | pTempStaEntry = csrRoamInsertEntryIntoPeStatsReqList(pMac, &pMac->roam.peStatsReqList, &staEntry); |
| 13456 | if(!pTempStaEntry) |
| 13457 | { |
| 13458 | //msg |
| 13459 | smsLog(pMac, LOGW, "csrRoamCheckPeStatsReqList: Failed to insert req in peStatsReqList\n"); |
| 13460 | return NULL; |
| 13461 | } |
| 13462 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13463 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 13464 | if(ePMC_FULL_POWER == powerState) |
| 13465 | { |
| 13466 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 13467 | { |
| 13468 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 13469 | } |
| 13470 | } |
| 13471 | else |
| 13472 | { |
| 13473 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 13474 | { |
| 13475 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 13476 | } |
| 13477 | } |
| 13478 | if(!pTempStaEntry->timerRunning) |
| 13479 | { |
| 13480 | //send down a req in case of one time req, for periodic ones wait for timer to expire |
| 13481 | if(!pTempStaEntry->rspPending && |
| 13482 | !pTempStaEntry->periodicity) |
| 13483 | { |
| 13484 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 13485 | if(!HAL_STATUS_SUCCESS(status)) |
| 13486 | { |
| 13487 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:failed to send down stats req to PE\n")); |
| 13488 | } |
| 13489 | else |
| 13490 | { |
| 13491 | pTempStaEntry->rspPending = TRUE; |
| 13492 | } |
| 13493 | } |
| 13494 | if(pTempStaEntry->periodicity) |
| 13495 | { |
| 13496 | if(!found) |
| 13497 | { |
| 13498 | |
| 13499 | vosStatus = vos_timer_init( &pTempStaEntry->hPeStatsTimer, VOS_TIMER_TYPE_SW, |
| 13500 | csrRoamPeStatsTimerHandler, pTempStaEntry ); |
| 13501 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13502 | { |
| 13503 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot init hPeStatsTimer timer\n")); |
| 13504 | return NULL; |
| 13505 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13506 | } |
| 13507 | //start timer |
| 13508 | smsLog(pMac, LOG1, "csrRoamCheckPeStatsReqList:peStatsTimer period %d\n", pTempStaEntry->periodicity); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13509 | vosStatus = vos_timer_start( &pTempStaEntry->hPeStatsTimer, pTempStaEntry->periodicity ); |
| 13510 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13511 | { |
| 13512 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot start hPeStatsTimer timer\n")); |
| 13513 | return NULL; |
| 13514 | } |
| 13515 | pTempStaEntry->timerRunning = TRUE; |
| 13516 | } |
| 13517 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13518 | *pFound = found; |
| 13519 | return pTempStaEntry; |
| 13520 | } |
| 13521 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13522 | /* |
| 13523 | pStaEntry is no longer invalid upon the return of this function. |
| 13524 | */ |
| 13525 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry) |
| 13526 | { |
| 13527 | if(pEntry) |
| 13528 | { |
| 13529 | if(csrLLRemoveEntry(&pMac->roam.statsClientReqList, pEntry, LL_ACCESS_LOCK)) |
| 13530 | { |
| 13531 | palFreeMemory(pMac->hHdd, GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13533 | } |
| 13534 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13535 | |
| 13536 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry) |
| 13537 | { |
| 13538 | tListElem *pEntry; |
| 13539 | tCsrPeStatsReqInfo *pTempStaEntry; |
| 13540 | VOS_STATUS vosStatus; |
| 13541 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13542 | if(!pEntry) |
| 13543 | { |
| 13544 | //list empty |
| 13545 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: List empty, no stats req for PE\n"); |
| 13546 | return; |
| 13547 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13548 | while( pEntry ) |
| 13549 | { |
| 13550 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13551 | if( pTempStaEntry && pTempStaEntry->statsMask == pPeStaEntry->statsMask) |
| 13552 | { |
| 13553 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: match found\n"); |
| 13554 | if(pTempStaEntry->timerRunning) |
| 13555 | { |
| 13556 | vosStatus = vos_timer_stop( &pTempStaEntry->hPeStatsTimer ); |
| 13557 | /* If we are not able to stop the timer here, just remove |
| 13558 | * the entry from the linked list. Destroy the timer object |
| 13559 | * and free the memory in the timer CB |
| 13560 | */ |
| 13561 | if( vosStatus == VOS_STATUS_SUCCESS ) |
| 13562 | { |
| 13563 | /* the timer is successfully stopped */ |
| 13564 | pTempStaEntry->timerRunning = FALSE; |
| 13565 | |
| 13566 | /* Destroy the timer */ |
| 13567 | vosStatus = vos_timer_destroy( &pTempStaEntry->hPeStatsTimer ); |
| 13568 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13569 | { |
| 13570 | smsLog(pMac, LOGE, FL("csrRoamRemoveEntryFromPeStatsReqList:failed to destroy hPeStatsTimer timer\n")); |
| 13571 | } |
| 13572 | } |
| 13573 | else |
| 13574 | { |
| 13575 | // the timer could not be stopped. Hence destroy and free the |
| 13576 | // memory for the PE stat entry in the timer CB. |
| 13577 | pTempStaEntry->timerStopFailed = TRUE; |
| 13578 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13579 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13580 | |
| 13581 | if(csrLLRemoveEntry(&pMac->roam.peStatsReqList, pEntry, LL_ACCESS_LOCK)) |
| 13582 | { |
| 13583 | // Only free the memory if we could stop the timer successfully |
| 13584 | if(!pTempStaEntry->timerStopFailed) |
| 13585 | { |
| 13586 | palFreeMemory(pMac->hHdd, pTempStaEntry); |
| 13587 | pTempStaEntry = NULL; |
| 13588 | } |
| 13589 | break; |
| 13590 | } |
| 13591 | |
| 13592 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13593 | } |
| 13594 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13595 | return; |
| 13596 | } |
| 13597 | |
| 13598 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13599 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13600 | { |
| 13601 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13602 | pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = pTlStats->rxBcntCRCok; |
| 13603 | pMac->roam.classDStatsInfo.rx_bc_byte_cnt = pTlStats->rxBCBcnt; |
| 13604 | pMac->roam.classDStatsInfo.rx_bc_frm_cnt = pTlStats->rxBCFcnt; |
| 13605 | pMac->roam.classDStatsInfo.rx_byte_cnt = pTlStats->rxBcnt; |
| 13606 | pMac->roam.classDStatsInfo.rx_mc_byte_cnt = pTlStats->rxMCBcnt; |
| 13607 | pMac->roam.classDStatsInfo.rx_mc_frm_cnt = pTlStats->rxMCFcnt; |
| 13608 | pMac->roam.classDStatsInfo.rx_rate = pTlStats->rxRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13609 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13610 | pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = pTlStats->rxUCBcnt; |
| 13611 | pMac->roam.classDStatsInfo.rx_uc_frm_cnt = pTlStats->rxUCFcnt; |
| 13612 | pMac->roam.classDStatsInfo.tx_bc_byte_cnt = pTlStats->txBCBcnt; |
| 13613 | pMac->roam.classDStatsInfo.tx_bc_frm_cnt = pTlStats->txBCFcnt; |
| 13614 | pMac->roam.classDStatsInfo.tx_mc_byte_cnt = pTlStats->txMCBcnt; |
| 13615 | pMac->roam.classDStatsInfo.tx_mc_frm_cnt = pTlStats->txMCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13616 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13617 | pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = pTlStats->txUCBcnt; |
| 13618 | pMac->roam.classDStatsInfo.tx_uc_frm_cnt = pTlStats->txUCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13619 | |
| 13620 | } |
| 13621 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13622 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 13623 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext) |
| 13624 | { |
| 13625 | tANI_U8 stats[500]; |
| 13626 | tANI_U8 *pStats = NULL; |
| 13627 | tANI_U32 tempMask = 0; |
| 13628 | tANI_U8 counter = 0; |
| 13629 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13630 | if(!callback) |
| 13631 | { |
| 13632 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report callback NULL\n")); |
| 13633 | return; |
| 13634 | } |
| 13635 | if(!statsMask) |
| 13636 | { |
| 13637 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report statsMask is 0\n")); |
| 13638 | return; |
| 13639 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13640 | pStats = stats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13641 | tempMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13642 | while(tempMask) |
| 13643 | { |
| 13644 | if(tempMask & 1) |
| 13645 | { |
| 13646 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 13647 | switch(counter) |
| 13648 | { |
| 13649 | case eCsrSummaryStats: |
| 13650 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:summary stats\n")); |
| 13651 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 13652 | sizeof(tCsrSummaryStatsInfo)); |
| 13653 | if(!HAL_STATUS_SUCCESS(status)) |
| 13654 | { |
| 13655 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy summary stats\n")); |
| 13656 | } |
| 13657 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 13658 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13659 | case eCsrGlobalClassAStats: |
| 13660 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassA stats\n")); |
| 13661 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 13662 | sizeof(tCsrGlobalClassAStatsInfo)); |
| 13663 | if(!HAL_STATUS_SUCCESS(status)) |
| 13664 | { |
| 13665 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassA stats\n")); |
| 13666 | } |
| 13667 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13668 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13669 | case eCsrGlobalClassBStats: |
| 13670 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassB stats\n")); |
| 13671 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 13672 | sizeof(tCsrGlobalClassBStatsInfo)); |
| 13673 | if(!HAL_STATUS_SUCCESS(status)) |
| 13674 | { |
| 13675 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassB stats\n")); |
| 13676 | } |
| 13677 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13678 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13679 | case eCsrGlobalClassCStats: |
| 13680 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassC stats\n")); |
| 13681 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 13682 | sizeof(tCsrGlobalClassCStatsInfo)); |
| 13683 | if(!HAL_STATUS_SUCCESS(status)) |
| 13684 | { |
| 13685 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassC stats\n")); |
| 13686 | } |
| 13687 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13688 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13689 | case eCsrGlobalClassDStats: |
| 13690 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassD stats\n")); |
| 13691 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classDStatsInfo, |
| 13692 | sizeof(tCsrGlobalClassDStatsInfo)); |
| 13693 | if(!HAL_STATUS_SUCCESS(status)) |
| 13694 | { |
| 13695 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassD stats\n")); |
| 13696 | } |
| 13697 | pStats += sizeof(tCsrGlobalClassDStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13698 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13699 | case eCsrPerStaStats: |
| 13700 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:PerSta stats\n")); |
| 13701 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.perStaStatsInfo[staId], |
| 13702 | sizeof(tCsrPerStaStatsInfo)); |
| 13703 | if(!HAL_STATUS_SUCCESS(status)) |
| 13704 | { |
| 13705 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy PerSta stats\n")); |
| 13706 | } |
| 13707 | pStats += sizeof(tCsrPerStaStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13708 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13709 | default: |
| 13710 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:unknown stats type\n")); |
| 13711 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13712 | } |
| 13713 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13714 | tempMask >>=1; |
| 13715 | counter++; |
| 13716 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13717 | callback(stats, pContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13718 | } |
| 13719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13720 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac) |
| 13721 | { |
| 13722 | tListElem *pEntry = NULL; |
| 13723 | tListElem *pPrevEntry = NULL; |
| 13724 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 13725 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13726 | VOS_STATUS vosStatus; |
| 13727 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13728 | if(!pEntry) |
| 13729 | { |
| 13730 | //list empty |
| 13731 | smsLog(pMac, LOGW, "csrRoamDeregStatisticsReq: List empty, no request from " |
| 13732 | "upper layer client(s)\n"); |
| 13733 | return status; |
| 13734 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13735 | while( pEntry ) |
| 13736 | { |
| 13737 | if(pPrevEntry) |
| 13738 | { |
| 13739 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 13740 | //send up the stats report |
| 13741 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 13742 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 13743 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 13744 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13745 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13746 | if (pTempStaEntry->pPeStaEntry) //pPeStaEntry can be NULL |
| 13747 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13748 | pTempStaEntry->pPeStaEntry->numClient--; |
| 13749 | //check if we need to delete the entry from peStatsReqList too |
| 13750 | if(!pTempStaEntry->pPeStaEntry->numClient) |
| 13751 | { |
| 13752 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry); |
| 13753 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13754 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13755 | //check if we need to stop the tl stats timer too |
| 13756 | pMac->roam.tlStatsReqInfo.numClient--; |
| 13757 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 13758 | { |
| 13759 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 13760 | { |
| 13761 | status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 13762 | if(!HAL_STATUS_SUCCESS(status)) |
| 13763 | { |
| 13764 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:cannot stop TlStatsTimer timer\n")); |
| 13765 | //we will continue |
| 13766 | } |
| 13767 | } |
| 13768 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 13769 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 13770 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13771 | if (pTempStaEntry->periodicity) |
| 13772 | { |
| 13773 | //While creating StaEntry in csrGetStatistics, |
| 13774 | //Initializing and starting timer only when periodicity is set. |
| 13775 | //So Stop and Destroy timer only when periodicity is set. |
| 13776 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13777 | vos_timer_stop( &pTempStaEntry->timer ); |
| 13778 | // Destroy the vos timer... |
| 13779 | vosStatus = vos_timer_destroy( &pTempStaEntry->timer ); |
| 13780 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13781 | { |
| 13782 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer\n")); |
| 13783 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13784 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame^] | 13785 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13786 | |
| 13787 | pPrevEntry = pEntry; |
| 13788 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13789 | } |
| 13790 | //the last one |
| 13791 | if(pPrevEntry) |
| 13792 | { |
| 13793 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 13794 | //send up the stats report |
| 13795 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 13796 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 13797 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 13798 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13799 | return status; |
| 13800 | |
| 13801 | } |
| 13802 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13803 | eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 13804 | tRequestFullPowerReason *pReason, |
| 13805 | tANI_BOOLEAN *pfNeedPower ) |
| 13806 | { |
| 13807 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 13808 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
| 13809 | tPmcState pmcState; |
| 13810 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13811 | // TODO : Session info unavailable |
| 13812 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13813 | if( pfNeedPower ) |
| 13814 | { |
| 13815 | *pfNeedPower = eANI_BOOLEAN_FALSE; |
| 13816 | } |
| 13817 | //We only handle CSR commands |
| 13818 | if( !(eSmeCsrCommandMask & pCommand->command) ) |
| 13819 | { |
| 13820 | return eHAL_STATUS_SUCCESS; |
| 13821 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13822 | //Check PMC state first |
| 13823 | pmcState = pmcGetPmcState( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13824 | switch( pmcState ) |
| 13825 | { |
| 13826 | case REQUEST_IMPS: |
| 13827 | case IMPS: |
| 13828 | if( eSmeCommandScan == pCommand->command ) |
| 13829 | { |
| 13830 | switch( pCommand->u.scanCmd.reason ) |
| 13831 | { |
| 13832 | case eCsrScanGetResult: |
| 13833 | case eCsrScanBGScanAbort: |
| 13834 | case eCsrScanBGScanEnable: |
| 13835 | case eCsrScanGetScanChnInfo: |
| 13836 | //Internal process, no need for full power |
| 13837 | fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 13838 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13839 | default: |
| 13840 | //Other scans are real scan, ask for power |
| 13841 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 13842 | break; |
| 13843 | } //switch |
| 13844 | } |
| 13845 | else |
| 13846 | { |
| 13847 | //ask for power for roam and status change |
| 13848 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 13849 | } |
| 13850 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13851 | case REQUEST_BMPS: |
| 13852 | case BMPS: |
| 13853 | case REQUEST_START_UAPSD: |
| 13854 | case UAPSD: |
| 13855 | //We treat WOWL same as BMPS |
| 13856 | case REQUEST_ENTER_WOWL: |
| 13857 | case WOWL: |
| 13858 | if( eSmeCommandRoam == pCommand->command ) |
| 13859 | { |
| 13860 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 13861 | tCsrScanResult *pScanResult; |
| 13862 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13863 | switch ( pCommand->u.roamCmd.roamReason ) |
| 13864 | { |
| 13865 | case eCsrForcedDisassoc: |
| 13866 | case eCsrForcedDisassocMICFailure: |
| 13867 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 13868 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 13869 | break; |
| 13870 | case eCsrSmeIssuedDisassocForHandoff: |
| 13871 | case eCsrForcedDeauth: |
| 13872 | case eCsrHddIssuedReassocToSameAP: |
| 13873 | case eCsrSmeIssuedReassocToSameAP: |
| 13874 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 13875 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13876 | case eCsrCapsChange: |
| 13877 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 13878 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13879 | default: |
| 13880 | //Check whether the profile is already connected. If so, no need for full power |
| 13881 | //Note: IBSS is ignored for now because we don't support powersave in IBSS |
| 13882 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && pBSSList ) |
| 13883 | { |
| 13884 | //Only need to check the first one |
| 13885 | pEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 13886 | if( pEntry ) |
| 13887 | { |
| 13888 | pScanResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link); |
| 13889 | #if 0 |
| 13890 | // TODO : Session Specific info pConnectBssDesc |
| 13891 | if( csrIsBssIdEqual( pMac, &pScanResult->Result.BssDescriptor, pMac->roam.pConnectBssDesc ) && |
| 13892 | csrIsSsidEqual( pMac, pMac->roam.pConnectBssDesc, |
| 13893 | &pScanResult->Result.BssDescriptor, (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ) ) ) |
| 13894 | { |
| 13895 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 13896 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 13897 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 13898 | // a new Association. |
| 13899 | if(csrIsSameProfile(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 13900 | { |
| 13901 | if(csrRoamIsSameProfileKeys(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 13902 | { |
| 13903 | //Done, eventually, the command reaches eCsrReassocToSelfNoCapChange; |
| 13904 | //No need for full power |
| 13905 | //Set the flag so the code later can avoid to do the above |
| 13906 | //check again. |
| 13907 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_TRUE; |
| 13908 | break; |
| 13909 | } |
| 13910 | } |
| 13911 | } |
| 13912 | #endif |
| 13913 | } |
| 13914 | } |
| 13915 | //If we are here, full power is needed |
| 13916 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 13917 | break; |
| 13918 | } |
| 13919 | } |
| 13920 | else if( eSmeCommandWmStatusChange == pCommand->command ) |
| 13921 | { |
| 13922 | //need full power for all |
| 13923 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 13924 | reason = eSME_LINK_DISCONNECTED_BY_OTHER; |
| 13925 | } |
| 13926 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13927 | case REQUEST_STOP_UAPSD: |
| 13928 | case REQUEST_EXIT_WOWL: |
| 13929 | if( eSmeCommandRoam == pCommand->command ) |
| 13930 | { |
| 13931 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 13932 | switch ( pCommand->u.roamCmd.roamReason ) |
| 13933 | { |
| 13934 | case eCsrForcedDisassoc: |
| 13935 | case eCsrForcedDisassocMICFailure: |
| 13936 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 13937 | break; |
| 13938 | default: |
| 13939 | break; |
| 13940 | } |
| 13941 | } |
| 13942 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13943 | case STOPPED: |
| 13944 | case REQUEST_STANDBY: |
| 13945 | case STANDBY: |
| 13946 | case LOW_POWER: |
| 13947 | //We are not supposed to do anything |
| 13948 | smsLog( pMac, LOGE, FL( " cannot process because PMC is in stopped/standby state %d\n" ), pmcState ); |
| 13949 | status = eHAL_STATUS_FAILURE; |
| 13950 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13951 | case FULL_POWER: |
| 13952 | case REQUEST_FULL_POWER: |
| 13953 | default: |
| 13954 | //No need to ask for full power. This has to be FULL_POWER state |
| 13955 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13956 | } //switch |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13957 | if( pReason ) |
| 13958 | { |
| 13959 | *pReason = reason; |
| 13960 | } |
| 13961 | if( pfNeedPower ) |
| 13962 | { |
| 13963 | *pfNeedPower = fNeedFullPower; |
| 13964 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13965 | return ( status ); |
| 13966 | } |
| 13967 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13968 | static eHalStatus csrRequestFullPower( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 13969 | { |
| 13970 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13971 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 13972 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13973 | status = csrIsFullPowerNeeded( pMac, pCommand, &reason, &fNeedFullPower ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13974 | if( fNeedFullPower && HAL_STATUS_SUCCESS( status ) ) |
| 13975 | { |
| 13976 | status = pmcRequestFullPower(pMac, csrFullPowerCallback, pMac, reason); |
| 13977 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13978 | return ( status ); |
| 13979 | } |
| 13980 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13981 | tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac ) |
| 13982 | { |
| 13983 | tSmeCmd *pCmd = smeGetCommandBuffer( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13984 | if( pCmd ) |
| 13985 | { |
| 13986 | pMac->roam.sPendingCommands++; |
| 13987 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13988 | return ( pCmd ); |
| 13989 | } |
| 13990 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13991 | void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 13992 | { |
| 13993 | if (pMac->roam.sPendingCommands > 0) |
| 13994 | { |
| 13995 | //All command allocated through csrGetCommandBuffer need to |
| 13996 | //decrement the pending count when releasing. |
| 13997 | pMac->roam.sPendingCommands--; |
| 13998 | smeReleaseCommand( pMac, pCommand ); |
| 13999 | } |
| 14000 | else |
| 14001 | { |
| 14002 | smsLog(pMac, LOGE, FL( "no pending commands")); |
| 14003 | VOS_ASSERT(0); |
| 14004 | } |
| 14005 | } |
| 14006 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14007 | //Return SUCCESS is the command is queued, failed |
| 14008 | eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority ) |
| 14009 | { |
| 14010 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14011 | if( (eSmeCommandScan == pCommand->command) && pMac->scan.fDropScanCmd ) |
| 14012 | { |
| 14013 | smsLog(pMac, LOGW, FL(" drop scan (scan reason %d) command"), |
| 14014 | pCommand->u.scanCmd.reason); |
| 14015 | return eHAL_STATUS_CSR_WRONG_STATE; |
| 14016 | } |
| 14017 | |
| 14018 | //We can call request full power first before putting the command into pending Q |
| 14019 | //because we are holding SME lock at this point. |
| 14020 | status = csrRequestFullPower( pMac, pCommand ); |
| 14021 | if( HAL_STATUS_SUCCESS( status ) ) |
| 14022 | { |
| 14023 | tANI_BOOLEAN fNoCmdPending; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14024 | //make sure roamCmdPendingList is not empty first |
| 14025 | fNoCmdPending = csrLLIsListEmpty( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_FALSE ); |
| 14026 | if( fNoCmdPending ) |
| 14027 | { |
| 14028 | smePushCommand( pMac, pCommand, fHighPriority ); |
| 14029 | } |
| 14030 | else |
| 14031 | { |
| 14032 | //Other commands are waiting for PMC callback, queue the new command to the pending Q |
| 14033 | //no list lock is needed since SME lock is held |
| 14034 | if( !fHighPriority ) |
| 14035 | { |
| 14036 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14037 | } |
| 14038 | else { |
| 14039 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14040 | } |
| 14041 | } |
| 14042 | } |
| 14043 | else if( eHAL_STATUS_PMC_PENDING == status ) |
| 14044 | { |
| 14045 | //no list lock is needed since SME lock is held |
| 14046 | if( !fHighPriority ) |
| 14047 | { |
| 14048 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14049 | } |
| 14050 | else { |
| 14051 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14052 | } |
| 14053 | //Let caller know the command is queue |
| 14054 | status = eHAL_STATUS_SUCCESS; |
| 14055 | } |
| 14056 | else |
| 14057 | { |
| 14058 | //Not to decrease pMac->roam.sPendingCommands here. Caller will decrease it when it |
| 14059 | //release the command. |
| 14060 | smsLog( pMac, LOGE, FL( " cannot queue command %d\n" ), pCommand->command ); |
| 14061 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14062 | return ( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14064 | #ifdef WLAN_SOFTAP_FEATURE |
| 14065 | eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs* pAPWPSIES ) |
| 14066 | { |
| 14067 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14068 | tSirUpdateAPWPSIEsReq *pMsg; |
| 14069 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 14070 | |
| 14071 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14072 | if (NULL == pSession) |
| 14073 | { |
| 14074 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 14075 | return eHAL_STATUS_FAILURE; |
| 14076 | } |
| 14077 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14078 | do |
| 14079 | { |
| 14080 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPSIEsReq) ); |
| 14081 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 14082 | palZeroMemory( pMac->hHdd, pMsg, sizeof(tSirUpdateAPWPSIEsReq) ); |
| 14083 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPDATE_APWPSIE_REQ); |
| 14084 | |
| 14085 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 14086 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14087 | // transactionId |
| 14088 | *pBuf = 0; |
| 14089 | *( pBuf + 1 ) = 0; |
| 14090 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14091 | // bssId |
| 14092 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 14093 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14094 | //sessionId |
| 14095 | *pBuf++ = (tANI_U8)sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14096 | // APWPSIEs |
| 14097 | palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *)pBuf, pAPWPSIES, sizeof(tSirAPWPSIEs)); |
| 14098 | pBuf += sizeof(tSirAPWPSIEs); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14099 | pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32) + (pBuf - wTmpBuf))); //msg_header + msg |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14100 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14101 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14102 | return ( status ); |
| 14103 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14104 | eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie) |
| 14105 | { |
| 14106 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14107 | tSirUpdateAPWPARSNIEsReq *pMsg; |
| 14108 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14109 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14110 | if (NULL == pSession) |
| 14111 | { |
| 14112 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 14113 | return eHAL_STATUS_FAILURE; |
| 14114 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14115 | do |
| 14116 | { |
| 14117 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPARSNIEsReq) ); |
| 14118 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 14119 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirUpdateAPWPARSNIEsReq ) ); |
| 14120 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_APWPARSNIEs_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14121 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 14122 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14123 | // transactionId |
| 14124 | *pBuf = 0; |
| 14125 | *( pBuf + 1 ) = 0; |
| 14126 | pBuf += sizeof(tANI_U16); |
| 14127 | |
| 14128 | // bssId |
| 14129 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 14130 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14131 | // sessionId |
| 14132 | *pBuf++ = (tANI_U8)sessionId; |
| 14133 | |
| 14134 | // APWPARSNIEs |
| 14135 | palCopyMemory( pMac->hHdd, (tSirRSNie *)pBuf, pAPSirRSNie, sizeof(tSirRSNie)); |
| 14136 | pBuf += sizeof(tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14137 | pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf))); //msg_header + msg |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14138 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14139 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14140 | return ( status ); |
| 14141 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14142 | #endif //#ifdef WLAN_SOFTAP_FEATURE |
| 14143 | |
| 14144 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 14145 | //eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tCsrBssid preAuthBssid, tANI_U8 channelId) |
| 14146 | eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription) |
| 14147 | { |
| 14148 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 14149 | tpSirFTPreAuthReq pftPreAuthReq; |
| 14150 | tANI_U16 auth_req_len = 0; |
| 14151 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14152 | auth_req_len = sizeof(tSirFTPreAuthReq); |
| 14153 | pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len); |
| 14154 | if (pftPreAuthReq == NULL) |
| 14155 | { |
| 14156 | smsLog(pMac, LOGE, FL("Memory allocation for FT Preauth request failed")); |
| 14157 | return eHAL_STATUS_RESOURCES; |
| 14158 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14159 | // Save the SME Session ID here. We need it while processing the preauth response |
| 14160 | pMac->ft.ftSmeContext.smeSessionId = sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14161 | vos_mem_zero(pftPreAuthReq, auth_req_len); |
| 14162 | |
| 14163 | pftPreAuthReq->pbssDescription = (tpSirBssDescription)vos_mem_malloc( |
| 14164 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 14165 | |
| 14166 | pftPreAuthReq->messageType = pal_cpu_to_be16(eWNI_SME_FT_PRE_AUTH_REQ); |
| 14167 | |
| 14168 | pftPreAuthReq->preAuthchannelNum = pBssDescription->channelId; |
| 14169 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14170 | palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->currbssId, (void *)pSession->connectedProfile.bssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14171 | palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->preAuthbssId, (void *)pBssDescription->bssId, sizeof(tSirMacAddr)); |
| 14172 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14173 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 14174 | if (csrRoamIs11rAssoc(pMac)) |
| 14175 | { |
| 14176 | pftPreAuthReq->ft_ies_length = (tANI_U16)pMac->ft.ftSmeContext.auth_ft_ies_length; |
| 14177 | palCopyMemory(pMac->hHdd, pftPreAuthReq->ft_ies, pMac->ft.ftSmeContext.auth_ft_ies, |
| 14178 | pMac->ft.ftSmeContext.auth_ft_ies_length); |
| 14179 | } |
| 14180 | else |
| 14181 | #endif |
| 14182 | { |
| 14183 | pftPreAuthReq->ft_ies_length = 0; |
| 14184 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14185 | vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription, pBssDescription->length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14186 | pftPreAuthReq->length = pal_cpu_to_be16(sizeof(tSirFTPreAuthReq) + sizeof(pBssDescription->length) + |
| 14187 | pBssDescription->length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14188 | return palSendMBMessage(pMac->hHdd, pftPreAuthReq); |
| 14189 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14190 | /*-------------------------------------------------------------------------- |
| 14191 | * This will receive and process the FT Pre Auth Rsp from the current |
| 14192 | * associated ap. |
| 14193 | * |
| 14194 | * This will invoke the hdd call back. This is so that hdd can now |
| 14195 | * send the FTIEs from the Auth Rsp (Auth Seq 2) to the supplicant. |
| 14196 | ------------------------------------------------------------------------*/ |
| 14197 | void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp ) |
| 14198 | { |
| 14199 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 14200 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14201 | #ifdef FEATURE_WLAN_LFR |
| 14202 | tCsrRoamInfo roamInfo; |
| 14203 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14204 | |
| 14205 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 14206 | smsLog( pMac, LOGE, FL("Preauth response status code %d"), pFTPreAuthRsp->status); |
| 14207 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14208 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 14209 | csrNeighborRoamPreauthRspHandler(pMac, (VOS_STATUS)pFTPreAuthRsp->status); |
| 14210 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14211 | /* The below function calls/timers should be invoked only if the pre-auth is successful */ |
| 14212 | if (VOS_STATUS_SUCCESS != (VOS_STATUS)pFTPreAuthRsp->status) |
| 14213 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14214 | // Implies a success |
| 14215 | pMac->ft.ftSmeContext.FTState = eFT_AUTH_COMPLETE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14216 | // Indicate SME QoS module the completion of Preauth success. This will trigger the creation of RIC IEs |
| 14217 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = pFTPreAuthRsp; |
| 14218 | sme_QosCsrEventInd(pMac, pMac->ft.ftSmeContext.smeSessionId, SME_QOS_CSR_PREAUTH_SUCCESS_IND, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14219 | /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, |
| 14220 | * actual transition from the current to handoff AP is triggered */ |
| 14221 | status = palTimerStart(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer, |
| 14222 | 60 * PAL_TIMER_TO_MS_UNIT, |
| 14223 | eANI_BOOLEAN_FALSE); |
| 14224 | if (eHAL_STATUS_SUCCESS != status) |
| 14225 | { |
| 14226 | smsLog(pMac, LOGE, FL("Preauth reassoc interval timer start failed to start with status %d\n"), status); |
| 14227 | return; |
| 14228 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14229 | // Save the received response |
| 14230 | palCopyMemory(pMac->hHdd, (void *)&pMac->ft.ftSmeContext.preAuthbssId, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 14231 | if (csrRoamIs11rAssoc(pMac)) |
| 14232 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, NULL, 0, |
| 14233 | eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE); |
| 14234 | |
| 14235 | // Currently we dont do anything special for CCX connection. |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14236 | #ifdef FEATURE_WLAN_LFR |
| 14237 | // If Legacy Fast Roaming is enabled, signal the supplicant |
| 14238 | // So he can send us a PMK-ID for this candidate AP. |
| 14239 | if (csrRoamIsFastRoamEnabled(pMac)) |
| 14240 | { |
| 14241 | // Save the bssid from the received response |
| 14242 | palCopyMemory(pMac->hHdd, (void *)&roamInfo.bssid, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 14243 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_PMK_NOTIFY, 0); |
| 14244 | } |
| 14245 | |
| 14246 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14247 | |
| 14248 | // Done with it, init it. |
| 14249 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL; |
| 14250 | } |
| 14251 | #endif |
| 14252 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 14253 | void csrRoamJoinRetryTimerHandler(void *pv) |
| 14254 | { |
| 14255 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 14256 | tpAniSirGlobal pMac = pInfo->pMac; |
| 14257 | tANI_U32 sessionId = pInfo->sessionId; |
| 14258 | tCsrRoamSession *pSession; |
| 14259 | |
| 14260 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 14261 | { |
| 14262 | smsLog( pMac, LOGE, FL( " retrying the last roam profile on session %d\n" ), sessionId ); |
| 14263 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14264 | if(pSession->pCurRoamProfile && csrIsConnStateDisconnected(pMac, sessionId)) |
| 14265 | { |
| 14266 | if( !HAL_STATUS_SUCCESS(csrRoamJoinLastProfile(pMac, sessionId)) ) |
| 14267 | { |
| 14268 | smsLog( pMac, LOGE, FL( " fail to retry the last roam profile\n" ) ); |
| 14269 | } |
| 14270 | } |
| 14271 | } |
| 14272 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14273 | eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 14274 | { |
| 14275 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14276 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14277 | |
| 14278 | if(pSession->pCurRoamProfile && pSession->maxRetryCount) |
| 14279 | { |
| 14280 | smsLog(pMac, LOGE, FL(" call sessionId %d retry count %d left\n "), sessionId, pSession->maxRetryCount); |
| 14281 | pSession->maxRetryCount--; |
| 14282 | pSession->joinRetryTimerInfo.pMac = pMac; |
| 14283 | pSession->joinRetryTimerInfo.sessionId = (tANI_U8)sessionId; |
| 14284 | status = palTimerStart(pMac->hHdd, pSession->hTimerJoinRetry, interval, eANI_BOOLEAN_FALSE); |
| 14285 | if(!HAL_STATUS_SUCCESS(status)) |
| 14286 | { |
| 14287 | smsLog(pMac, LOGE, FL(" fail to start timer status %s \n "), status); |
| 14288 | } |
| 14289 | } |
| 14290 | else |
| 14291 | { |
| 14292 | smsLog(pMac, LOGE, FL(" not to start timer due to no profile or reach mac ret (%d)\n "), |
| 14293 | pSession->maxRetryCount); |
| 14294 | } |
| 14295 | |
| 14296 | return (status); |
| 14297 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14298 | eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14299 | { |
| 14300 | smsLog(pMac, LOGE, " csrRoamStopJoinRetryTimer \n "); |
| 14301 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 14302 | { |
| 14303 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerJoinRetry)); |
| 14304 | } |
| 14305 | |
| 14306 | return eHAL_STATUS_SUCCESS; |
| 14307 | } |
| 14308 | #endif |
| 14309 | |
| 14310 | |
| 14311 | /* |
| 14312 | pBuf points to the beginning of the message |
| 14313 | LIM packs disassoc rsp as below, |
| 14314 | messageType - 2 bytes |
| 14315 | messageLength - 2 bytes |
| 14316 | sessionId - 1 byte |
| 14317 | transactionId - 2 bytes (tANI_U16) |
| 14318 | reasonCode - 4 bytes (sizeof(tSirResultCodes)) |
| 14319 | peerMacAddr - 6 bytes |
| 14320 | The rest is conditionally defined of (WNI_POLARIS_FW_PRODUCT == AP) and not used |
| 14321 | */ |
| 14322 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp) |
| 14323 | { |
| 14324 | if(pBuf && pRsp) |
| 14325 | { |
| 14326 | pBuf += 4; //skip type and length |
| 14327 | pRsp->sessionId = *pBuf++; |
| 14328 | pal_get_U16( pBuf, (tANI_U16 *)&pRsp->transactionId ); |
| 14329 | pBuf += 2; |
| 14330 | pal_get_U32( pBuf, (tANI_U32 *)&pRsp->statusCode ); |
| 14331 | pBuf += 4; |
| 14332 | vos_mem_copy(pRsp->peerMacAddr, pBuf, 6); |
| 14333 | } |
| 14334 | } |
| 14335 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 14336 | eHalStatus csrGetDefaultCountryCodeFrmNv(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 14337 | { |
| 14338 | static uNvTables nvTables; |
| 14339 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14340 | VOS_STATUS vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 14341 | |
| 14342 | /* read the country code from NV and use it */ |
| 14343 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 14344 | { |
| 14345 | palCopyMemory( pMac->hHdd, pCountry, |
| 14346 | nvTables.defaultCountryTable.countryCode, |
| 14347 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 14348 | return status; |
| 14349 | } |
| 14350 | else |
| 14351 | { |
| 14352 | palCopyMemory( pMac->hHdd, pCountry, |
| 14353 | "XXX", |
| 14354 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 14355 | status = eHAL_STATUS_FAILURE; |
| 14356 | return status; |
| 14357 | } |
| 14358 | } |
| 14359 | |
| 14360 | eHalStatus csrGetCurrentCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 14361 | { |
| 14362 | palCopyMemory( pMac->hHdd, pCountry, |
| 14363 | pMac->scan.countryCode11d, |
| 14364 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 14365 | return eHAL_STATUS_SUCCESS; |
| 14366 | } |