Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. 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 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /** ------------------------------------------------------------------------- * |
| 43 | ------------------------------------------------------------------------- * |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 44 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 45 | |
| 46 | \file csrApiRoam.c |
| 47 | |
| 48 | Implementation for the Common Roaming interfaces. |
| 49 | |
| 50 | Copyright (C) 2008 Qualcomm, Incorporated |
| 51 | |
| 52 | |
| 53 | ========================================================================== */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 54 | /*=========================================================================== |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | EDIT HISTORY FOR FILE |
| 56 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 57 | This section contains comments describing changes made to the module. |
| 58 | Notice that changes are listed in reverse chronological order. |
| 59 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | when who what, where, why |
| 61 | ---------- --- -------------------------------------------------------- |
| 62 | 06/03/10 js Added support to hostapd driven |
| 63 | * deauth/disassoc/mic failure |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 64 | ===========================================================================*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 65 | #include "aniGlobal.h" //for tpAniSirGlobal |
| 66 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 67 | #include "halMsgApi.h" //for HAL_STA_INVALID_IDX. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 68 | #include "limUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 69 | #include "palApi.h" |
| 70 | #include "csrInsideApi.h" |
| 71 | #include "smsDebug.h" |
| 72 | #include "logDump.h" |
| 73 | #include "smeQosInternal.h" |
| 74 | #include "wlan_qct_tl.h" |
| 75 | #include "smeInside.h" |
| 76 | #include "vos_diag_core_event.h" |
| 77 | #include "vos_diag_core_log.h" |
| 78 | #include "csrApi.h" |
| 79 | #include "pmc.h" |
| 80 | #include "vos_nvitem.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 81 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 82 | #include "csrNeighborRoam.h" |
| 83 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 84 | #ifdef FEATURE_WLAN_CCX |
| 85 | #include "csrCcx.h" |
| 86 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 87 | #define CSR_NUM_IBSS_START_CHANNELS_50 4 |
| 88 | #define CSR_NUM_IBSS_START_CHANNELS_24 3 |
| 89 | #define CSR_DEF_IBSS_START_CHANNEL_50 36 |
| 90 | #define CSR_DEF_IBSS_START_CHANNEL_24 1 |
| 91 | #define CSR_IBSS_JOIN_TIMEOUT_PERIOD ( 1 * PAL_TIMER_TO_SEC_UNIT ) // 1 second |
Srikant Kuppa | 2062aaf | 2012-12-27 17:36:41 -0800 | [diff] [blame] | 92 | #define CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD ( 5 * PAL_TIMER_TO_SEC_UNIT ) // 5 seconds, for WPA, WPA2, CCKM |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 93 | #define CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD ( 120 * PAL_TIMER_TO_SEC_UNIT ) // 120 seconds, for WPS |
| 94 | /*--------------------------------------------------------------------------- |
| 95 | OBIWAN recommends [8 10]% : pick 9% |
| 96 | ---------------------------------------------------------------------------*/ |
| 97 | #define CSR_VCC_UL_MAC_LOSS_THRESHOLD 9 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 98 | /*--------------------------------------------------------------------------- |
| 99 | OBIWAN recommends -85dBm |
| 100 | ---------------------------------------------------------------------------*/ |
| 101 | #define CSR_VCC_RSSI_THRESHOLD 80 |
| 102 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD 500 //ms |
| 103 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS 2000 //ms |
| 104 | #define CSR_MIN_TL_STAT_QUERY_PERIOD 500 //ms |
| 105 | #define CSR_DIAG_LOG_STAT_PERIOD 3000 //ms |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 106 | //We use constatnt 4 here |
| 107 | //This macro returns true when higher AC parameter is bigger than lower AC for a difference |
| 108 | //The bigger the number, the less chance of TX |
| 109 | //It must put lower AC as the first parameter. |
| 110 | #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] | 111 | //Flag to send/do not send disassoc frame over the air |
| 112 | #define CSR_DONT_SEND_DISASSOC_OVER_THE_AIR 1 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 113 | #define RSSI_HACK_BMPS (-40) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 114 | #define MAX_CB_VALUE_IN_INI (2) |
| 115 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 116 | /*-------------------------------------------------------------------------- |
| 117 | Static Type declarations |
| 118 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 119 | static tCsrRoamSession csrRoamRoamSession[CSR_ROAM_SESSION_MAX]; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 120 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 121 | static const char KR_3[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, |
| 122 | 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, |
| 123 | 108, 112, 116, 120, 124, 149, 153, 157, 161}; |
| 124 | static const char KR_24[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, |
| 125 | 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, |
| 126 | 108, 112, 116, 120, 124, 149, 153, 157, 161}; |
| 127 | static const char KR_25[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, |
| 128 | 36, 40, 44, 48, 149, 153, 157, 161}; |
| 129 | #endif |
| 130 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 131 | /*-------------------------------------------------------------------------- |
| 132 | Type declarations |
| 133 | ------------------------------------------------------------------------*/ |
| 134 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 135 | int diagAuthTypeFromCSRType(eCsrAuthType authType) |
| 136 | { |
| 137 | int n = AUTH_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 138 | switch(authType) |
| 139 | { |
| 140 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 141 | n = AUTH_SHARED; |
| 142 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 143 | case eCSR_AUTH_TYPE_WPA: |
| 144 | n = AUTH_WPA_EAP; |
| 145 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 146 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 147 | n = AUTH_WPA_PSK; |
| 148 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 149 | case eCSR_AUTH_TYPE_RSN: |
| 150 | n = AUTH_WPA2_EAP; |
| 151 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 152 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 153 | #ifdef WLAN_FEATURE_11W |
| 154 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 155 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 156 | n = AUTH_WPA2_PSK; |
| 157 | break; |
| 158 | #ifdef FEATURE_WLAN_WAPI |
| 159 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 160 | n = AUTH_WAPI_CERT; |
| 161 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 162 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 163 | n = AUTH_WAPI_PSK; |
| 164 | break; |
| 165 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 166 | default: |
| 167 | break; |
| 168 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 169 | return (n); |
| 170 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 171 | int diagEncTypeFromCSRType(eCsrEncryptionType encType) |
| 172 | { |
| 173 | int n = ENC_MODE_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 174 | switch(encType) |
| 175 | { |
| 176 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 177 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 178 | n = ENC_MODE_WEP40; |
| 179 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 180 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 181 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 182 | n = ENC_MODE_WEP104; |
| 183 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 184 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 185 | n = ENC_MODE_TKIP; |
| 186 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 187 | case eCSR_ENCRYPT_TYPE_AES: |
| 188 | n = ENC_MODE_AES; |
| 189 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 190 | #ifdef FEATURE_WLAN_WAPI |
| 191 | case eCSR_ENCRYPT_TYPE_WPI: |
| 192 | n = ENC_MODE_SMS4; |
| 193 | break; |
| 194 | #endif /* FEATURE_WLAN_WAPI */ |
| 195 | default: |
| 196 | break; |
| 197 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 198 | return (n); |
| 199 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 200 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 201 | static const tANI_U8 csrStartIbssChannels50[ CSR_NUM_IBSS_START_CHANNELS_50 ] = { 36, 40, 44, 48}; |
| 202 | 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] | 203 | static void initConfigParam(tpAniSirGlobal pMac); |
| 204 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 205 | eCsrRoamCompleteResult Result, void *Context ); |
| 206 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 207 | tCsrRoamProfile *pProfile, |
| 208 | tANI_BOOLEAN *pfSameIbss ); |
| 209 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirSmeNewBssInfo *pNewBss ); |
| 210 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 211 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes); |
| 212 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 213 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac); |
| 214 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ); |
| 215 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac); |
| 216 | eHalStatus csrRoamClose(tpAniSirGlobal pMac); |
| 217 | void csrRoamMICErrorTimerHandler(void *pv); |
| 218 | void csrRoamTKIPCounterMeasureTimerHandler(void *pv); |
| 219 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2); |
| 220 | |
| 221 | static eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 222 | static eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 223 | static void csrRoamRoamingTimerHandler(void *pv); |
| 224 | eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 225 | eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 226 | static void csrRoamIbssJoinTimerHandler(void *pv); |
| 227 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval); |
| 228 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac); |
| 229 | static void csrRoamWaitForKeyTimeOutHandler(void *pv); |
| 230 | |
| 231 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 232 | static eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 233 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ); |
| 234 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 235 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 236 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 237 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 238 | tANI_U8 *pKeyRsc ); |
| 239 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 240 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, |
| 241 | tCsrRoamProfile *pProfile ); |
| 242 | void csrRoamStatisticsTimerHandler(void *pv); |
| 243 | void csrRoamStatsGlobalClassDTimerHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 244 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid); |
| 245 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 246 | v_U8_t rssiNotification, |
| 247 | void * context); |
| 248 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 249 | void csrRoamVccTrigger(tpAniSirGlobal pMac); |
| 250 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId); |
| 251 | /* |
| 252 | pStaEntry is no longer invalid upon the return of this function. |
| 253 | */ |
| 254 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 255 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile,tANI_U8 operationChn, eCsrBand *pBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 256 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 257 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 258 | tDblLinkList *pStaList, |
| 259 | tCsrStatsClientReqInfo *pStaEntry); |
| 260 | void csrRoamStatsClientTimerHandler(void *pv); |
| 261 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 262 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId); |
| 263 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 264 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 265 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 266 | void csrRoamTlStatsTimerHandler(void *pv); |
| 267 | void csrRoamPeStatsTimerHandler(void *pv); |
| 268 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 269 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry); |
| 270 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 271 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac); |
| 272 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ); |
| 273 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ); |
| 274 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ); |
| 275 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 276 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ); |
| 277 | //static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ); |
| 278 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
| 279 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac); |
| 280 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 281 | void csrRoamJoinRetryTimerHandler(void *pv); |
| 282 | #endif |
| 283 | extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 284 | extern void btampEstablishLogLinkHdlr(void* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 285 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 286 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 287 | |
| 288 | //Initialize global variables |
| 289 | static void csrRoamInitGlobals(tpAniSirGlobal pMac) |
| 290 | { |
| 291 | if(pMac) |
| 292 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 293 | vos_mem_zero(&csrRoamRoamSession, sizeof(csrRoamRoamSession)); |
| 294 | pMac->roam.roamSession = csrRoamRoamSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 295 | } |
| 296 | return; |
| 297 | } |
| 298 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 299 | static void csrRoamDeInitGlobals(tpAniSirGlobal pMac) |
| 300 | { |
| 301 | if(pMac) |
| 302 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 303 | pMac->roam.roamSession = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 304 | } |
| 305 | return; |
| 306 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 307 | eHalStatus csrOpen(tpAniSirGlobal pMac) |
| 308 | { |
| 309 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 310 | static uNvTables nvTables; |
| 311 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 312 | v_REGDOMAIN_t regId; |
| 313 | tANI_U32 i; |
| 314 | |
| 315 | do |
| 316 | { |
| 317 | /* Initialize CSR Roam Globals */ |
| 318 | csrRoamInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 319 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 320 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i); |
| 321 | |
| 322 | initConfigParam(pMac); |
| 323 | if(!HAL_STATUS_SUCCESS((status = csrScanOpen(pMac)))) |
| 324 | break; |
| 325 | if(!HAL_STATUS_SUCCESS((status = csrRoamOpen(pMac)))) |
| 326 | break; |
| 327 | pMac->roam.nextRoamId = 1; //Must not be 0 |
| 328 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.statsClientReqList))) |
| 329 | break; |
| 330 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.peStatsReqList))) |
| 331 | break; |
| 332 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.roamCmdPendingList))) |
| 333 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 334 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 335 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 336 | { |
| 337 | palCopyMemory( pMac->hHdd, pMac->scan.countryCodeDefault, |
| 338 | nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN ); |
| 339 | status = eHAL_STATUS_SUCCESS; |
| 340 | } |
| 341 | else |
| 342 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 343 | smsLog( pMac, LOGE, FL(" fail to get NV_FIELD_IMAGE") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 344 | //hardcoded for now |
| 345 | pMac->scan.countryCodeDefault[0] = 'U'; |
| 346 | pMac->scan.countryCodeDefault[1] = 'S'; |
| 347 | pMac->scan.countryCodeDefault[2] = 'I'; |
| 348 | //status = eHAL_STATUS_SUCCESS; |
| 349 | } |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 350 | smsLog( pMac, LOG1, FL(" country Code from nvRam %.2s"), pMac->scan.countryCodeDefault ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 351 | csrGetRegulatoryDomainForCountry(pMac, pMac->scan.countryCodeDefault, ®Id); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 352 | WDA_SetRegDomain(pMac, regId); |
| 353 | pMac->scan.domainIdDefault = regId; |
| 354 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 356 | pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN); |
| 357 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 358 | }while(0); |
| 359 | |
| 360 | return (status); |
| 361 | } |
| 362 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 363 | eHalStatus csrSetRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode) |
| 364 | { |
| 365 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 366 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 367 | v_REGDOMAIN_t regId; |
| 368 | v_U8_t cntryCodeLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 369 | if(NULL == apCntryCode) |
| 370 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 371 | smsLog( pMac, LOGW, FL(" Invalid country Code Pointer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 372 | return eHAL_STATUS_FAILURE; |
| 373 | } |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 374 | smsLog( pMac, LOGW, FL(" country Code %.2s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 375 | /* To get correct Regulatory domain from NV table |
| 376 | * 2 character Country code should be used |
| 377 | * 3rd charater is optional for indoor/outdoor setting */ |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 378 | cntryCodeLength = WNI_CFG_COUNTRY_CODE_LEN; |
| 379 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | cntryCodeLength = strlen(apCntryCode); |
Madan Mohan Koyyalamudi | b666eb1 | 2012-09-18 17:29:47 -0700 | [diff] [blame] | 381 | |
| 382 | if (cntryCodeLength > WNI_CFG_COUNTRY_CODE_LEN) |
| 383 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 384 | smsLog( pMac, LOGW, FL(" Invalid Country Code Length") ); |
Madan Mohan Koyyalamudi | b666eb1 | 2012-09-18 17:29:47 -0700 | [diff] [blame] | 385 | return eHAL_STATUS_FAILURE; |
| 386 | } |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 387 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 388 | status = csrGetRegulatoryDomainForCountry(pMac, apCntryCode, ®Id); |
| 389 | if (status != eHAL_STATUS_SUCCESS) |
| 390 | { |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 391 | smsLog( pMac, LOGE, FL(" fail to get regId for country Code %.2s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 392 | return status; |
| 393 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 394 | status = WDA_SetRegDomain(hHal, regId); |
| 395 | if (status != eHAL_STATUS_SUCCESS) |
| 396 | { |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 397 | smsLog( pMac, LOGE, FL(" fail to get regId for country Code %.2s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 398 | return status; |
| 399 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 400 | pMac->scan.domainIdDefault = regId; |
| 401 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 402 | /* Clear CC field */ |
| 403 | palFillMemory( pMac->hHdd, |
| 404 | pMac->scan.countryCodeDefault, |
| 405 | WNI_CFG_COUNTRY_CODE_LEN, |
| 406 | 0 ); |
| 407 | /* Copy 2 or 3 bytes country code */ |
| 408 | palCopyMemory( pMac->hHdd, pMac->scan.countryCodeDefault, |
| 409 | apCntryCode, cntryCodeLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 410 | /* If 2 bytes country code, 3rd byte must be filled with space */ |
| 411 | if((WNI_CFG_COUNTRY_CODE_LEN - 1) == cntryCodeLength) |
| 412 | { |
| 413 | palFillMemory( pMac->hHdd, |
| 414 | pMac->scan.countryCodeDefault + 2, |
| 415 | 1, |
| 416 | 0x20 ); |
| 417 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 418 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 419 | pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN); |
| 420 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 421 | return status; |
| 422 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 423 | eHalStatus csrSetChannels(tHalHandle hHal, tCsrConfigParam *pParam ) |
| 424 | { |
| 425 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 426 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 427 | tANI_U8 index = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 428 | palCopyMemory( pMac->hHdd, pParam->Csr11dinfo.countryCode, |
| 429 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 430 | for ( index = 0; index < pMac->scan.base20MHzChannels.numChannels ; index++) |
| 431 | { |
| 432 | pParam->Csr11dinfo.Channels.channelList[index] = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 433 | pParam->Csr11dinfo.ChnPower[index].firstChannel = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 434 | pParam->Csr11dinfo.ChnPower[index].numChannels = 1; |
| 435 | pParam->Csr11dinfo.ChnPower[index].maxtxPower = pMac->scan.defaultPowerTable[index].pwr; |
| 436 | } |
| 437 | pParam->Csr11dinfo.Channels.numChannels = pMac->scan.base20MHzChannels.numChannels; |
| 438 | |
| 439 | return status; |
| 440 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 441 | eHalStatus csrClose(tpAniSirGlobal pMac) |
| 442 | { |
| 443 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 444 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 445 | csrStop(pMac); |
| 446 | csrRoamClose(pMac); |
| 447 | csrScanClose(pMac); |
| 448 | csrLLClose(&pMac->roam.statsClientReqList); |
| 449 | csrLLClose(&pMac->roam.peStatsReqList); |
| 450 | csrLLClose(&pMac->roam.roamCmdPendingList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 451 | /* DeInit Globals */ |
| 452 | csrRoamDeInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 453 | return (status); |
| 454 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 455 | eHalStatus csrStart(tpAniSirGlobal pMac) |
| 456 | { |
| 457 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 458 | tANI_U32 i; |
| 459 | |
| 460 | do |
| 461 | { |
| 462 | //save the global vos context |
| 463 | pMac->roam.gVosContext = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 464 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 465 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, i ); |
| 466 | |
| 467 | status = csrRoamStart(pMac); |
| 468 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 469 | pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE; |
| 470 | status = pmcRegisterPowerSaveCheck(pMac, csrCheckPSReady, pMac); |
| 471 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 472 | pMac->roam.sPendingCommands = 0; |
| 473 | csrScanEnable(pMac); |
| 474 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 475 | status = csrNeighborRoamInit(pMac); |
| 476 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
| 477 | pMac->roam.tlStatsReqInfo.numClient = 0; |
| 478 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 479 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 480 | //init the link quality indication also |
| 481 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND; |
| 482 | if(!HAL_STATUS_SUCCESS(status)) |
| 483 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 484 | smsLog(pMac, LOGW, " csrStart: Couldn't Init HO control blk "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 485 | break; |
| 486 | } |
| 487 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 488 | #if defined(ANI_LOGDUMP) |
| 489 | csrDumpInit(pMac); |
| 490 | #endif //#if defined(ANI_LOGDUMP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 491 | return (status); |
| 492 | } |
| 493 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 494 | eHalStatus csrStop(tpAniSirGlobal pMac) |
| 495 | { |
| 496 | tANI_U32 sessionId; |
| 497 | tANI_U32 i; |
| 498 | |
| 499 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 500 | { |
| 501 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 502 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 503 | csrScanDisable(pMac); |
| 504 | pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE; |
| 505 | pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 506 | csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE ); |
| 507 | |
| 508 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 509 | csrNeighborRoamClose(pMac); |
| 510 | #endif |
| 511 | csrScanFlushResult(pMac); //Do we want to do this? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 512 | // deregister from PMC since we register during csrStart() |
| 513 | // (ignore status since there is nothing we can do if it fails) |
| 514 | (void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 515 | //Reset the domain back to the deault |
| 516 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 517 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 518 | |
| 519 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 520 | { |
| 521 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP ,i ); |
| 522 | pMac->roam.curSubState[i] = eCSR_ROAM_SUBSTATE_NONE; |
| 523 | } |
| 524 | |
| 525 | return (eHAL_STATUS_SUCCESS); |
| 526 | } |
| 527 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 528 | eHalStatus csrReady(tpAniSirGlobal pMac) |
| 529 | { |
| 530 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 531 | csrScanGetSupportedChannels( pMac ); |
| 532 | //WNI_CFG_VALID_CHANNEL_LIST should be set by this time |
| 533 | //use it to init the background scan list |
| 534 | csrInitBGScanChannelList(pMac); |
| 535 | /* HDD issues the init scan */ |
| 536 | csrScanStartResultAgingTimer(pMac); |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 537 | /* If the gScanAgingTime is set to '0' then scan results aging timeout |
| 538 | based on timer feature is not enabled*/ |
| 539 | if(0 != pMac->scan.scanResultCfgAgingTime ) |
| 540 | { |
| 541 | csrScanStartResultCfgAgingTimer(pMac); |
| 542 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 543 | //Store the AC weights in TL for later use |
| 544 | WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 545 | status = csrInitChannelList( pMac ); |
| 546 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 547 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 548 | smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 549 | status ); |
| 550 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 551 | return (status); |
| 552 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 553 | void csrSetDefaultDot11Mode( tpAniSirGlobal pMac ) |
| 554 | { |
| 555 | v_U32_t wniDot11mode = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 556 | wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode); |
| 557 | ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE); |
| 558 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 559 | void csrSetGlobalCfgs( tpAniSirGlobal pMac ) |
| 560 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 561 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 562 | ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 563 | ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 564 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 565 | ((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled), |
| 566 | NULL, eANI_BOOLEAN_FALSE); |
| 567 | 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] | 568 | /* 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 |
| 569 | * Once session is established we will use the session related params stored in PE session for CB mode |
| 570 | */ |
| 571 | 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] | 572 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE); |
| 573 | |
| 574 | //Update the operating mode to configured value during initialization, |
| 575 | //So that client can advertise full capabilities in Probe request frame. |
| 576 | csrSetDefaultDot11Mode( pMac ); |
| 577 | } |
| 578 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 579 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac) |
| 580 | { |
| 581 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 582 | tANI_U32 i; |
| 583 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 584 | do |
| 585 | { |
| 586 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 587 | { |
| 588 | pSession = CSR_GET_SESSION( pMac, i ); |
| 589 | pSession->roamingTimerInfo.pMac = pMac; |
| 590 | pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 591 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 592 | pMac->roam.WaitForKeyTimerInfo.pMac = pMac; |
| 593 | pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 594 | status = palTimerAlloc(pMac->hHdd, &pMac->roam.hTimerWaitForKey, csrRoamWaitForKeyTimeOutHandler, |
| 595 | &pMac->roam.WaitForKeyTimerInfo); |
| 596 | if(!HAL_STATUS_SUCCESS(status)) |
| 597 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 598 | smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 599 | break; |
| 600 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 601 | status = palTimerAlloc(pMac->hHdd, &pMac->roam.tlStatsReqInfo.hTlStatsTimer, csrRoamTlStatsTimerHandler, pMac); |
| 602 | if(!HAL_STATUS_SUCCESS(status)) |
| 603 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 604 | smsLog(pMac, LOGE, FL("cannot allocate memory for summary Statistics timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 605 | return eHAL_STATUS_FAILURE; |
| 606 | } |
| 607 | }while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 608 | return (status); |
| 609 | } |
| 610 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 611 | eHalStatus csrRoamClose(tpAniSirGlobal pMac) |
| 612 | { |
| 613 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 614 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 615 | { |
| 616 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 617 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 618 | palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey); |
| 619 | palTimerFree(pMac->hHdd, pMac->roam.hTimerWaitForKey); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 620 | palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 621 | palTimerFree(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 622 | return (eHAL_STATUS_SUCCESS); |
| 623 | } |
| 624 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 625 | eHalStatus csrRoamStart(tpAniSirGlobal pMac) |
| 626 | { |
| 627 | (void)pMac; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 628 | return (eHAL_STATUS_SUCCESS); |
| 629 | } |
| 630 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 631 | void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 632 | { |
| 633 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 634 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 635 | csrRoamDeregStatisticsReq(pMac); |
| 636 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 637 | eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState) |
| 638 | { |
| 639 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Srinivas Girigowda | c84c57c | 2013-02-19 17:41:56 -0800 | [diff] [blame] | 640 | if ( CSR_IS_SESSION_VALID(pMac, sessionId) && (NULL != pState) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 641 | { |
| 642 | status = eHAL_STATUS_SUCCESS; |
| 643 | *pState = pMac->roam.roamSession[sessionId].connectState; |
| 644 | } |
| 645 | return (status); |
| 646 | } |
| 647 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 648 | eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 649 | { |
| 650 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 651 | tANI_U32 size = 0; |
| 652 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 653 | |
| 654 | if(!pSession) |
| 655 | { |
| 656 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 657 | return eHAL_STATUS_FAILURE; |
| 658 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 659 | |
| 660 | if(pProfile) |
| 661 | { |
| 662 | if(pSession->pConnectBssDesc) |
| 663 | { |
| 664 | do |
| 665 | { |
| 666 | size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length); |
| 667 | if(size) |
| 668 | { |
| 669 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile->pBssDesc, size); |
| 670 | if(HAL_STATUS_SUCCESS(status)) |
| 671 | { |
| 672 | palCopyMemory(pMac->hHdd, pProfile->pBssDesc, pSession->pConnectBssDesc, size); |
| 673 | } |
| 674 | else |
| 675 | break; |
| 676 | } |
| 677 | else |
| 678 | { |
| 679 | pProfile->pBssDesc = NULL; |
| 680 | } |
| 681 | pProfile->AuthType = pSession->connectedProfile.AuthType; |
| 682 | pProfile->EncryptionType = pSession->connectedProfile.EncryptionType; |
| 683 | pProfile->mcEncryptionType = pSession->connectedProfile.mcEncryptionType; |
| 684 | pProfile->BSSType = pSession->connectedProfile.BSSType; |
| 685 | pProfile->operationChannel = pSession->connectedProfile.operationChannel; |
| 686 | pProfile->CBMode = pSession->connectedProfile.CBMode; |
| 687 | palCopyMemory(pMac->hHdd, &pProfile->bssid, &pSession->connectedProfile.bssid, sizeof(tCsrBssid)); |
| 688 | palCopyMemory(pMac->hHdd, &pProfile->SSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid)); |
| 689 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 690 | if (pSession->connectedProfile.MDID.mdiePresent) |
| 691 | { |
| 692 | pProfile->MDID.mdiePresent = 1; |
| 693 | pProfile->MDID.mobilityDomain = pSession->connectedProfile.MDID.mobilityDomain; |
| 694 | } |
| 695 | else |
| 696 | { |
| 697 | pProfile->MDID.mdiePresent = 0; |
| 698 | pProfile->MDID.mobilityDomain = 0; |
| 699 | } |
| 700 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 701 | #ifdef FEATURE_WLAN_CCX |
| 702 | pProfile->isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 703 | if (csrIsAuthTypeCCX(pSession->connectedProfile.AuthType)) |
| 704 | { |
| 705 | palCopyMemory( pMac->hHdd, pProfile->ccxCckmInfo.krk, |
| 706 | pSession->connectedProfile.ccxCckmInfo.krk, CSR_KRK_KEY_LEN ); |
| 707 | pProfile->ccxCckmInfo.reassoc_req_num= |
| 708 | pSession->connectedProfile.ccxCckmInfo.reassoc_req_num; |
| 709 | pProfile->ccxCckmInfo.krk_plumbed = |
| 710 | pSession->connectedProfile.ccxCckmInfo.krk_plumbed; |
| 711 | } |
| 712 | #endif |
| 713 | }while(0); |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | return (status); |
| 718 | } |
| 719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 720 | eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 721 | { |
| 722 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | fec1ecb | 2013-05-03 08:10:33 -0700 | [diff] [blame] | 723 | |
| 724 | if((csrIsConnStateConnected(pMac, sessionId)) || |
| 725 | (csrIsConnStateIbss(pMac, sessionId))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 726 | { |
| 727 | if(pProfile) |
| 728 | { |
| 729 | status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile); |
| 730 | } |
| 731 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 732 | return (status); |
| 733 | } |
Jeff Johnson | fec1ecb | 2013-05-03 08:10:33 -0700 | [diff] [blame] | 734 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 735 | eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile) |
| 736 | { |
| 737 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 738 | |
| 739 | if(pProfile->pBssDesc) |
| 740 | { |
| 741 | palFreeMemory(pMac->hHdd, pProfile->pBssDesc); |
| 742 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 743 | if(pProfile->pAddIEAssoc) |
| 744 | { |
| 745 | palFreeMemory(pMac->hHdd, pProfile->pAddIEAssoc); |
| 746 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 747 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamConnectedProfile)); |
| 748 | pProfile->AuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 749 | return (status); |
| 750 | } |
| 751 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 752 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ) |
| 753 | { |
| 754 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 755 | if( pConnectedInfo->pbFrames ) |
| 756 | { |
| 757 | palFreeMemory( pMac->hHdd, pConnectedInfo->pbFrames ); |
| 758 | pConnectedInfo->pbFrames = NULL; |
| 759 | } |
| 760 | pConnectedInfo->nBeaconLength = 0; |
| 761 | pConnectedInfo->nAssocReqLength = 0; |
| 762 | pConnectedInfo->nAssocRspLength = 0; |
| 763 | pConnectedInfo->staId = 0; |
| 764 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 765 | pConnectedInfo->nRICRspLength = 0; |
| 766 | #endif |
| 767 | #ifdef FEATURE_WLAN_CCX |
| 768 | pConnectedInfo->nTspecIeLength = 0; |
| 769 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 770 | return ( status ); |
| 771 | } |
| 772 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 773 | |
| 774 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 775 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 776 | void csrReleaseCommandPreauth(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 777 | { |
| 778 | csrReinitPreauthCmd(pMac, pCommand); |
| 779 | csrReleaseCommand( pMac, pCommand ); |
| 780 | } |
| 781 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 782 | void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 783 | { |
| 784 | csrReinitRoamCmd(pMac, pCommand); |
| 785 | csrReleaseCommand( pMac, pCommand ); |
| 786 | } |
| 787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 788 | void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 789 | { |
| 790 | csrReinitScanCmd(pMac, pCommand); |
| 791 | csrReleaseCommand( pMac, pCommand ); |
| 792 | } |
| 793 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 794 | void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 795 | { |
| 796 | csrReinitWmStatusChangeCmd(pMac, pCommand); |
| 797 | csrReleaseCommand( pMac, pCommand ); |
| 798 | } |
| 799 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 800 | void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 801 | { |
| 802 | palZeroMemory(pMac->hHdd, &pCommand->u.setKeyCmd, sizeof(tSetKeyCmd)); |
| 803 | } |
| 804 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 805 | void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 806 | { |
| 807 | palZeroMemory(pMac->hHdd, &pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd)); |
| 808 | } |
| 809 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 810 | void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 811 | { |
| 812 | csrReinitSetKeyCmd(pMac, pCommand); |
| 813 | csrReleaseCommand( pMac, pCommand ); |
| 814 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 815 | void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 816 | { |
| 817 | csrReinitRemoveKeyCmd(pMac, pCommand); |
| 818 | csrReleaseCommand( pMac, pCommand ); |
| 819 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 820 | void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping ) |
| 821 | { |
| 822 | |
| 823 | if( eSmeCsrCommandMask & pCommand->command ) |
| 824 | { |
| 825 | switch (pCommand->command) |
| 826 | { |
| 827 | case eSmeCommandScan: |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 828 | // We need to inform the requester before dropping the scan command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 829 | smsLog( pMac, LOGW, "%s: Drop scan reason %d callback 0x%X", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 830 | __func__, pCommand->u.scanCmd.reason, (unsigned int)pCommand->u.scanCmd.callback); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 831 | if (NULL != pCommand->u.scanCmd.callback) |
| 832 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 833 | smsLog( pMac, LOGW, "%s callback scan requester", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 834 | csrScanCallCallback(pMac, pCommand, eCSR_SCAN_ABORT); |
| 835 | } |
| 836 | csrReleaseCommandScan( pMac, pCommand ); |
| 837 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 838 | case eSmeCommandRoam: |
| 839 | csrReleaseCommandRoam( pMac, pCommand ); |
| 840 | break; |
| 841 | |
| 842 | case eSmeCommandWmStatusChange: |
| 843 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 844 | break; |
| 845 | |
| 846 | case eSmeCommandSetKey: |
| 847 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 848 | break; |
| 849 | |
| 850 | case eSmeCommandRemoveKey: |
| 851 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 852 | break; |
| 853 | |
| 854 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 855 | smsLog( pMac, LOGW, " CSR abort standard command %d", pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 856 | csrReleaseCommand( pMac, pCommand ); |
| 857 | break; |
| 858 | } |
| 859 | } |
| 860 | } |
| 861 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 862 | void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId) |
| 863 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 864 | smsLog( pMac, LOG1, " CSR RoamSubstate: [ %d <== %d ]", NewSubstate, pMac->roam.curSubState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 865 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | if(pMac->roam.curSubState[sessionId] == NewSubstate) |
| 867 | { |
| 868 | return; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 869 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 870 | pMac->roam.curSubState[sessionId] = NewSubstate; |
| 871 | } |
| 872 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 873 | eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId) |
| 874 | { |
| 875 | eCsrRoamState PreviousState; |
| 876 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 877 | smsLog( pMac, LOG1, "CSR RoamState: [ %d <== %d ]", NewRoamState, pMac->roam.curState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 878 | |
| 879 | PreviousState = pMac->roam.curState[sessionId]; |
| 880 | |
| 881 | if ( NewRoamState != pMac->roam.curState[sessionId] ) |
| 882 | { |
| 883 | // Whenever we transition OUT of the Roaming state, clear the Roaming substate... |
| 884 | if ( CSR_IS_ROAM_JOINING(pMac, sessionId) ) |
| 885 | { |
| 886 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 887 | } |
| 888 | |
| 889 | pMac->roam.curState[sessionId] = NewRoamState; |
| 890 | } |
| 891 | return( PreviousState ); |
| 892 | } |
| 893 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 894 | void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset) |
| 895 | { |
| 896 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 897 | if(catOffset) |
| 898 | { |
| 899 | pMac->roam.configParam.bCatRssiOffset = catOffset; |
| 900 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 901 | { |
| 902 | pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)CSR_BEST_RSSI_VALUE - (int)(i * catOffset); |
| 903 | } |
| 904 | } |
| 905 | } |
| 906 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 907 | static void initConfigParam(tpAniSirGlobal pMac) |
| 908 | { |
| 909 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 910 | pMac->roam.configParam.agingCount = CSR_AGING_COUNT; |
| 911 | pMac->roam.configParam.channelBondingMode24GHz = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 912 | pMac->roam.configParam.channelBondingMode5GHz = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 913 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 914 | pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 915 | pMac->roam.configParam.eBand = eCSR_BAND_ALL; |
| 916 | pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 917 | pMac->roam.configParam.FragmentationThreshold = eCSR_DOT11_FRAG_THRESH_DEFAULT; |
| 918 | pMac->roam.configParam.HeartbeatThresh24 = 40; |
| 919 | pMac->roam.configParam.HeartbeatThresh50 = 40; |
| 920 | pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE; |
| 921 | pMac->roam.configParam.Is11dSupportEnabledOriginal = eANI_BOOLEAN_FALSE; |
| 922 | pMac->roam.configParam.Is11eSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 923 | pMac->roam.configParam.Is11hSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 924 | pMac->roam.configParam.RTSThreshold = 2346; |
| 925 | pMac->roam.configParam.shortSlotTime = eANI_BOOLEAN_TRUE; |
| 926 | pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto; |
| 927 | pMac->roam.configParam.ProprietaryRatesEnabled = eANI_BOOLEAN_TRUE; |
| 928 | pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO; |
| 929 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 930 | pMac->roam.configParam.scanAgeTimeNCNPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS; |
| 931 | pMac->roam.configParam.scanAgeTimeNCPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS; |
| 932 | pMac->roam.configParam.scanAgeTimeCNPS = CSR_SCAN_AGING_TIME_CONNECT_NO_PS; |
| 933 | pMac->roam.configParam.scanAgeTimeCPS = CSR_SCAN_AGING_TIME_CONNECT_W_PS; |
| 934 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 935 | { |
| 936 | pMac->roam.configParam.BssPreferValue[i] = i; |
| 937 | } |
| 938 | csrAssignRssiForCategory(pMac, CSR_DEFAULT_RSSI_DB_GAP); |
| 939 | pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME; |
| 940 | pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE; |
| 941 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 942 | pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE; |
| 943 | pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE; |
| 944 | pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; |
| 945 | pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; |
| 946 | pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME; |
| 947 | pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME; |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 948 | pMac->roam.configParam.nActiveMaxChnTimeBtc = CSR_ACTIVE_MAX_CHANNEL_TIME_BTC; |
| 949 | pMac->roam.configParam.nActiveMinChnTimeBtc = CSR_ACTIVE_MIN_CHANNEL_TIME_BTC; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame^] | 950 | pMac->roam.configParam.disableAggWithBtc = eANI_BOOLEAN_TRUE; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 951 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 952 | pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC; |
| 953 | pMac->roam.configParam.nActiveMinChnTimeConc = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC; |
| 954 | pMac->roam.configParam.nPassiveMaxChnTimeConc = CSR_PASSIVE_MAX_CHANNEL_TIME_CONC; |
| 955 | pMac->roam.configParam.nPassiveMinChnTimeConc = CSR_PASSIVE_MIN_CHANNEL_TIME_CONC; |
| 956 | pMac->roam.configParam.nRestTimeConc = CSR_REST_TIME_CONC; |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 957 | pMac->roam.configParam.nNumStaChanCombinedConc = CSR_NUM_STA_CHAN_COMBINED_CONC; |
| 958 | pMac->roam.configParam.nNumP2PChanCombinedConc = CSR_NUM_P2P_CHAN_COMBINED_CONC; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 959 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 960 | pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default |
| 961 | pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; |
| 962 | pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; |
| 963 | pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 964 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 965 | pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0; |
| 966 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 967 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 968 | pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3; |
| 969 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120; |
| 970 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = 125; |
| 971 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20; |
| 972 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40; |
| 973 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = 200; |
| 974 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels = 3; |
| 975 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[0] = 1; |
| 976 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[1] = 6; |
| 977 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11; |
| 978 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 979 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 980 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 981 | #ifdef WLAN_FEATURE_11AC |
| 982 | pMac->roam.configParam.nVhtChannelWidth = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1; |
| 983 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 984 | |
| 985 | pMac->roam.configParam.addTSWhenACMIsOff = 0; |
| 986 | pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE; |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 987 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 988 | //Remove this code once SLM_Sessionization is supported |
| 989 | //BMPS_WORKAROUND_NOT_NEEDED |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 990 | pMac->roam.configParam.doBMPSWorkaround = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 991 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 992 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 993 | eCsrBand csrGetCurrentBand(tHalHandle hHal) |
| 994 | { |
| 995 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 996 | return pMac->roam.configParam.bandCapability; |
| 997 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 998 | |
| 999 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1000 | tANI_BOOLEAN csrIsChannelInCountryValidList(tpAniSirGlobal pMac, tANI_U8 channel) |
| 1001 | { |
| 1002 | /* Get country code from CFG */ |
| 1003 | tANI_U8 *pCountryCode = pMac->scan.countryCodeCurrent; |
| 1004 | tANI_U8 i = 0; |
| 1005 | v_BOOL_t retVal = FALSE; |
| 1006 | tANI_U8 *pCountryValidChannelList = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList; |
| 1007 | tANI_U8 *pNumChannels = &pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels; |
| 1008 | |
| 1009 | /* Compare against KR valid list */ |
| 1010 | if ((0 == strncmp(pCountryCode, "KR", 2)) && |
| 1011 | (NULL != pCountryValidChannelList)) |
| 1012 | { |
| 1013 | for (i = 0; i <(*pNumChannels); i++) |
| 1014 | { |
| 1015 | if (channel == pCountryValidChannelList[i]) |
| 1016 | { |
| 1017 | retVal = TRUE; |
| 1018 | break; |
| 1019 | } |
| 1020 | } |
| 1021 | } |
| 1022 | else |
| 1023 | { |
| 1024 | retVal = csrRoamIsChannelValid(pMac, channel); |
| 1025 | } |
| 1026 | |
| 1027 | return retVal; |
| 1028 | } |
| 1029 | |
| 1030 | void csr_SetRevision(tpAniSirGlobal pMac, tANI_U8 revision) |
| 1031 | { |
| 1032 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1033 | pNeighborRoamInfo->cfgParams.countryChannelInfo.revision = revision; |
| 1034 | } |
| 1035 | |
| 1036 | /* |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1037 | This function flushes the roam scan cache |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1038 | */ |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1039 | eHalStatus csrFlushBgScanRoamChannelList(tpAniSirGlobal pMac) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1040 | { |
| 1041 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1042 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1043 | |
| 1044 | /* Free up the memory first (if required) */ |
| 1045 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1046 | { |
| 1047 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 1048 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1049 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1050 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1051 | return status; |
| 1052 | } |
| 1053 | |
| 1054 | |
| 1055 | |
| 1056 | /* |
| 1057 | This function flushes the roam scan cache and creates fresh cache |
| 1058 | based on the input channel list |
| 1059 | */ |
| 1060 | eHalStatus csrCreateBgScanRoamChannelList(tpAniSirGlobal pMac, |
| 1061 | const tANI_U8 *pChannelList, |
| 1062 | const tANI_U8 numChannels) |
| 1063 | { |
| 1064 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1065 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1066 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1067 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = numChannels; |
| 1068 | |
| 1069 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = |
| 1070 | vos_mem_malloc(pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
| 1071 | |
| 1072 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1073 | { |
| 1074 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 1075 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
| 1076 | return eHAL_STATUS_RESOURCES; |
| 1077 | } |
| 1078 | |
| 1079 | /* Update the roam global structure */ |
| 1080 | palCopyMemory(pMac->hHdd, pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
| 1081 | pChannelList, |
| 1082 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
| 1083 | return status; |
| 1084 | } |
| 1085 | |
| 1086 | /* This function modifies the bgscan channel list set via config ini or |
| 1087 | runtime, whenever the band changes. |
| 1088 | if the band is auto, then no operation is performed on the channel list |
| 1089 | if the band is 2.4G, then make sure channel list contains only 2.4G valid channels |
| 1090 | if the band is 5G, then make sure channel list contains only 5G valid channels |
| 1091 | */ |
| 1092 | eHalStatus csrUpdateBgScanConfigIniChannelList(tpAniSirGlobal pMac, |
| 1093 | eCsrBand eBand) |
| 1094 | { |
| 1095 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1096 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1097 | tANI_U8 outNumChannels = 0; |
| 1098 | tANI_U8 inNumChannels = 0; |
| 1099 | tANI_U8 *inPtr = NULL; |
| 1100 | tANI_U8 i = 0; |
| 1101 | tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1102 | |
| 1103 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1104 | |
| 1105 | { |
| 1106 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1107 | "No update required for channel list " |
| 1108 | "either cfg.ini channel list is not set up or " |
| 1109 | "auto band (Band %d)", eBand); |
| 1110 | return status; |
| 1111 | } |
| 1112 | |
| 1113 | inNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
| 1114 | inPtr = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 1115 | if (eCSR_BAND_24 == eBand) |
| 1116 | { |
| 1117 | for (i = 0; i < inNumChannels; i++) |
| 1118 | { |
| 1119 | if (CSR_IS_CHANNEL_24GHZ(inPtr[i]) && csrIsChannelInCountryValidList(pMac, inPtr[i])) |
| 1120 | { |
| 1121 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1122 | } |
| 1123 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1124 | csrFlushBgScanRoamChannelList(pMac); |
| 1125 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1126 | } |
| 1127 | else if (eCSR_BAND_5G == eBand) |
| 1128 | { |
| 1129 | for (i = 0; i < inNumChannels; i++) |
| 1130 | { |
| 1131 | /* Add 5G Non-DFS channel */ |
| 1132 | if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) && |
| 1133 | csrIsChannelInCountryValidList(pMac, inPtr[i]) && |
| 1134 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1135 | { |
| 1136 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1137 | } |
| 1138 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1139 | csrFlushBgScanRoamChannelList(pMac); |
| 1140 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1141 | } |
| 1142 | else if (eCSR_BAND_ALL == eBand) |
| 1143 | { |
| 1144 | for (i = 0; i < inNumChannels; i++) |
| 1145 | { |
| 1146 | if (csrIsChannelInCountryValidList(pMac, inPtr[i]) && |
| 1147 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1148 | { |
| 1149 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1150 | } |
| 1151 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1152 | csrFlushBgScanRoamChannelList(pMac); |
| 1153 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1154 | } |
| 1155 | else |
| 1156 | { |
| 1157 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 1158 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 1159 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 1160 | } |
| 1161 | |
| 1162 | return status; |
| 1163 | } |
| 1164 | |
| 1165 | /* |
| 1166 | This function initializes the valid channel list based on country code |
| 1167 | */ |
| 1168 | eHalStatus csrInitCountryValidChannelList(tpAniSirGlobal pMac, |
| 1169 | tANI_U8 Revision) |
| 1170 | { |
| 1171 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1172 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Jeff Johnson | bc4396f | 2013-04-03 18:26:56 -0700 | [diff] [blame] | 1173 | tANI_U8 **pOutChannelList = &pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.ChannelList; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1174 | tANI_U8 *pNumChannels = &pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels; |
| 1175 | const tANI_U8 *pChannelList = NULL; |
| 1176 | |
| 1177 | if (SME_KR_3 == Revision) |
| 1178 | { |
| 1179 | pChannelList = KR_3; |
| 1180 | *pNumChannels = sizeof(KR_3)/sizeof(KR_3[0]); |
| 1181 | } |
| 1182 | else if (SME_KR_24 == Revision) |
| 1183 | { |
| 1184 | pChannelList = KR_24; |
| 1185 | *pNumChannels = sizeof(KR_24)/sizeof(KR_24[0]); |
| 1186 | } |
| 1187 | else if (SME_KR_25 == Revision) |
| 1188 | { |
| 1189 | pChannelList = KR_25; |
| 1190 | *pNumChannels = sizeof(KR_25)/sizeof(KR_25[0]); |
| 1191 | } |
| 1192 | else |
| 1193 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1194 | |
Jeff Johnson | bc4396f | 2013-04-03 18:26:56 -0700 | [diff] [blame] | 1195 | /* Free any existing channel list */ |
| 1196 | vos_mem_free(*pOutChannelList); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1197 | |
Jeff Johnson | bc4396f | 2013-04-03 18:26:56 -0700 | [diff] [blame] | 1198 | *pOutChannelList = vos_mem_malloc(*pNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1199 | |
Jeff Johnson | bc4396f | 2013-04-03 18:26:56 -0700 | [diff] [blame] | 1200 | if (NULL == *pOutChannelList) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1201 | { |
| 1202 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 1203 | *pNumChannels = 0; |
| 1204 | return eHAL_STATUS_RESOURCES; |
| 1205 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1206 | /* Update the roam global structure */ |
Jeff Johnson | bc4396f | 2013-04-03 18:26:56 -0700 | [diff] [blame] | 1207 | palCopyMemory(pMac->hHdd, *pOutChannelList, pChannelList, *pNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1208 | return status; |
| 1209 | } |
| 1210 | |
| 1211 | #endif |
| 1212 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1213 | eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand) |
| 1214 | { |
| 1215 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1216 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1217 | if (CSR_IS_PHY_MODE_A_ONLY(pMac) && |
| 1218 | (eBand == eCSR_BAND_24)) |
| 1219 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1220 | /* DOT11 mode configured to 11a only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1221 | request to change the band to 2.4 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1222 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1223 | "failed to set band cfg80211 = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1224 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1225 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1226 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1227 | if ((CSR_IS_PHY_MODE_B_ONLY(pMac) || |
| 1228 | CSR_IS_PHY_MODE_G_ONLY(pMac)) && |
| 1229 | (eBand == eCSR_BAND_5G)) |
| 1230 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1231 | /* DOT11 mode configured to 11b/11g only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1232 | request to change the band to 5 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1233 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1234 | "failed to set band dot11mode = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1235 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1236 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1237 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1238 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1239 | "Band changed to %u (0 - ALL, 1 - 2.4 GHZ, 2 - 5GHZ)", eBand); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1240 | pMac->roam.configParam.eBand = eBand; |
| 1241 | pMac->roam.configParam.bandCapability = eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1242 | csrScanGetSupportedChannels( pMac ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1243 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1244 | csrUpdateBgScanConfigIniChannelList( pMac, eBand ); |
| 1245 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1246 | status = csrInitGetChannels( pMac ); |
| 1247 | if (eHAL_STATUS_SUCCESS == status) |
| 1248 | csrInitChannelList( hHal ); |
| 1249 | return status; |
| 1250 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1251 | |
| 1252 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1253 | /* The funcns csrConvertCBIniValueToPhyCBState and csrConvertPhyCBStateToIniValue have been |
| 1254 | * introduced to convert the ini value to the ENUM used in csr and MAC for CB state |
| 1255 | * Ideally we should have kept the ini value and enum value same and representing the same |
| 1256 | * cb values as in 11n standard i.e. |
| 1257 | * Set to 1 (SCA) if the secondary channel is above the primary channel |
| 1258 | * Set to 3 (SCB) if the secondary channel is below the primary channel |
| 1259 | * Set to 0 (SCN) if no secondary channel is present |
| 1260 | * However, since our driver is already distributed we will keep the ini definition as it is which is: |
| 1261 | * 0 - secondary none |
| 1262 | * 1 - secondary LOW |
| 1263 | * 2 - secondary HIGH |
| 1264 | * and convert to enum value used within the driver in csrChangeDefaultConfigParam using this funcn |
| 1265 | * The enum values are as follows: |
| 1266 | * PHY_SINGLE_CHANNEL_CENTERED = 0 |
| 1267 | * PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1 |
| 1268 | * PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 1269 | */ |
| 1270 | ePhyChanBondState csrConvertCBIniValueToPhyCBState(v_U32_t cbIniValue) |
| 1271 | { |
| 1272 | |
| 1273 | ePhyChanBondState phyCbState; |
| 1274 | switch (cbIniValue) { |
| 1275 | // secondary none |
| 1276 | case 0: |
| 1277 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1278 | break; |
| 1279 | // secondary LOW |
| 1280 | case 1: |
| 1281 | phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 1282 | break; |
| 1283 | // secondary HIGH |
| 1284 | case 2: |
| 1285 | phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 1286 | break; |
| 1287 | #ifdef WLAN_FEATURE_11AC |
| 1288 | case 3: |
| 1289 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
| 1290 | break; |
| 1291 | case 4: |
| 1292 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1293 | break; |
| 1294 | case 5: |
| 1295 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1296 | break; |
| 1297 | case 6: |
| 1298 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
| 1299 | break; |
| 1300 | case 7: |
| 1301 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
| 1302 | break; |
| 1303 | case 8: |
| 1304 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 1305 | break; |
| 1306 | case 9: |
| 1307 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
| 1308 | break; |
| 1309 | #endif |
| 1310 | default: |
| 1311 | // If an invalid value is passed, disable CHANNEL BONDING |
| 1312 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1313 | break; |
| 1314 | } |
| 1315 | return phyCbState; |
| 1316 | } |
| 1317 | |
| 1318 | v_U32_t csrConvertPhyCBStateToIniValue(ePhyChanBondState phyCbState) |
| 1319 | { |
| 1320 | |
| 1321 | v_U32_t cbIniValue; |
| 1322 | switch (phyCbState) { |
| 1323 | // secondary none |
| 1324 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 1325 | cbIniValue = 0; |
| 1326 | break; |
| 1327 | // secondary LOW |
| 1328 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 1329 | cbIniValue = 1; |
| 1330 | break; |
| 1331 | // secondary HIGH |
| 1332 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 1333 | cbIniValue = 2; |
| 1334 | break; |
| 1335 | #ifdef WLAN_FEATURE_11AC |
| 1336 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 1337 | cbIniValue = 3; |
| 1338 | break; |
| 1339 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 1340 | cbIniValue = 4; |
| 1341 | break; |
| 1342 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 1343 | cbIniValue = 5; |
| 1344 | break; |
| 1345 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 1346 | cbIniValue = 6; |
| 1347 | break; |
| 1348 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 1349 | cbIniValue = 7; |
| 1350 | break; |
| 1351 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 1352 | cbIniValue = 8; |
| 1353 | break; |
| 1354 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 1355 | cbIniValue = 9; |
| 1356 | break; |
| 1357 | #endif |
| 1358 | default: |
| 1359 | // return some invalid value |
| 1360 | cbIniValue = 10; |
| 1361 | break; |
| 1362 | } |
| 1363 | return cbIniValue; |
| 1364 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1365 | |
| 1366 | eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1367 | { |
| 1368 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1369 | |
| 1370 | if(pParam) |
| 1371 | { |
| 1372 | pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode; |
| 1373 | pMac->roam.configParam.Is11eSupportEnabled = pParam->Is11eSupportEnabled; |
| 1374 | pMac->roam.configParam.FragmentationThreshold = pParam->FragmentationThreshold; |
| 1375 | pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled; |
| 1376 | pMac->roam.configParam.Is11dSupportEnabledOriginal = pParam->Is11dSupportEnabled; |
| 1377 | pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled; |
| 1378 | |
| 1379 | pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode; |
Mohit Khanna | 7ed53f0 | 2012-09-11 17:52:10 -0700 | [diff] [blame] | 1380 | pMac->roam.configParam.fAllowMCCGODiffBI = pParam->fAllowMCCGODiffBI; |
| 1381 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1382 | /* channelBondingMode5GHz plays a dual role right now |
| 1383 | * 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 |
| 1384 | * This is how channelBondingMode5GHz works now and this is kept intact to avoid any cfg.ini change |
| 1385 | */ |
| 1386 | if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI) |
| 1387 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1388 | smsLog( pMac, LOGW, "Invalid CB value from ini in 2.4GHz band %d, CB DISABLED", pParam->channelBondingMode24GHz); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1389 | } |
| 1390 | pMac->roam.configParam.channelBondingMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode24GHz); |
| 1391 | if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI) |
| 1392 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1393 | smsLog( pMac, LOGW, "Invalid CB value from ini in 5GHz band %d, CB DISABLED", pParam->channelBondingMode5GHz); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1394 | } |
| 1395 | pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1396 | pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold; |
| 1397 | pMac->roam.configParam.phyMode = pParam->phyMode; |
| 1398 | pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime; |
| 1399 | pMac->roam.configParam.HeartbeatThresh24 = pParam->HeartbeatThresh24; |
| 1400 | pMac->roam.configParam.HeartbeatThresh50 = pParam->HeartbeatThresh50; |
| 1401 | pMac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled; |
| 1402 | pMac->roam.configParam.TxRate = pParam->TxRate; |
| 1403 | pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; |
| 1404 | pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; |
| 1405 | pMac->roam.configParam.bandCapability = pParam->bandCapability; |
| 1406 | pMac->roam.configParam.cbChoice = pParam->cbChoice; |
| 1407 | pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame^] | 1408 | pMac->roam.configParam.disableAggWithBtc = pParam->disableAggWithBtc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1409 | //if HDD passed down non zero values then only update, |
| 1410 | //otherwise keep using the defaults |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1411 | if (pParam->nActiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1412 | { |
| 1413 | pMac->roam.configParam.nActiveMaxChnTime = pParam->nActiveMaxChnTime; |
| 1414 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1415 | if (pParam->nActiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1416 | { |
| 1417 | pMac->roam.configParam.nActiveMinChnTime = pParam->nActiveMinChnTime; |
| 1418 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1419 | if (pParam->nPassiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1420 | { |
| 1421 | pMac->roam.configParam.nPassiveMaxChnTime = pParam->nPassiveMaxChnTime; |
| 1422 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1423 | if (pParam->nPassiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1424 | { |
| 1425 | pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime; |
| 1426 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1427 | if (pParam->nActiveMaxChnTimeBtc) |
| 1428 | { |
| 1429 | pMac->roam.configParam.nActiveMaxChnTimeBtc = pParam->nActiveMaxChnTimeBtc; |
| 1430 | } |
| 1431 | if (pParam->nActiveMinChnTimeBtc) |
| 1432 | { |
| 1433 | pMac->roam.configParam.nActiveMinChnTimeBtc = pParam->nActiveMinChnTimeBtc; |
| 1434 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1435 | #ifdef WLAN_AP_STA_CONCURRENCY |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1436 | if (pParam->nActiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1437 | { |
| 1438 | pMac->roam.configParam.nActiveMaxChnTimeConc = pParam->nActiveMaxChnTimeConc; |
| 1439 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1440 | if (pParam->nActiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1441 | { |
| 1442 | pMac->roam.configParam.nActiveMinChnTimeConc = pParam->nActiveMinChnTimeConc; |
| 1443 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1444 | if (pParam->nPassiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1445 | { |
| 1446 | pMac->roam.configParam.nPassiveMaxChnTimeConc = pParam->nPassiveMaxChnTimeConc; |
| 1447 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1448 | if (pParam->nPassiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1449 | { |
| 1450 | pMac->roam.configParam.nPassiveMinChnTimeConc = pParam->nPassiveMinChnTimeConc; |
| 1451 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1452 | if (pParam->nRestTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1453 | { |
| 1454 | pMac->roam.configParam.nRestTimeConc = pParam->nRestTimeConc; |
| 1455 | } |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1456 | if (pParam->nNumStaChanCombinedConc) |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1457 | { |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1458 | pMac->roam.configParam.nNumStaChanCombinedConc = pParam->nNumStaChanCombinedConc; |
| 1459 | } |
| 1460 | if (pParam->nNumP2PChanCombinedConc) |
| 1461 | { |
| 1462 | pMac->roam.configParam.nNumP2PChanCombinedConc = pParam->nNumP2PChanCombinedConc; |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1463 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1464 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1465 | //if upper layer wants to disable idle scan altogether set it to 0 |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1466 | if (pParam->impsSleepTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1467 | { |
| 1468 | //Change the unit from second to microsecond |
| 1469 | tANI_U32 impsSleepTime = pParam->impsSleepTime * PAL_TIMER_TO_SEC_UNIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1470 | if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime) |
| 1471 | { |
| 1472 | pMac->roam.configParam.impsSleepTime = impsSleepTime; |
| 1473 | } |
| 1474 | else |
| 1475 | { |
| 1476 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 1477 | } |
| 1478 | } |
| 1479 | else |
| 1480 | { |
| 1481 | pMac->roam.configParam.impsSleepTime = 0; |
| 1482 | } |
| 1483 | pMac->roam.configParam.eBand = pParam->eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1484 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, pMac->roam.configParam.phyMode, |
| 1485 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1486 | //if HDD passed down non zero values for age params, then only update, |
| 1487 | //otherwise keep using the defaults |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1488 | if (pParam->nScanResultAgeCount) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1489 | { |
| 1490 | pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount; |
| 1491 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1492 | if(pParam->scanAgeTimeNCNPS) |
| 1493 | { |
| 1494 | pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS; |
| 1495 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1496 | if(pParam->scanAgeTimeNCPS) |
| 1497 | { |
| 1498 | pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS; |
| 1499 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1500 | if(pParam->scanAgeTimeCNPS) |
| 1501 | { |
| 1502 | pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS; |
| 1503 | } |
| 1504 | if(pParam->scanAgeTimeCPS) |
| 1505 | { |
| 1506 | pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS; |
| 1507 | } |
| 1508 | |
| 1509 | csrAssignRssiForCategory(pMac, pParam->bCatRssiOffset); |
| 1510 | pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime; |
| 1511 | pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels; |
| 1512 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority; |
| 1513 | pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch; |
| 1514 | pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1515 | pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold; |
| 1516 | pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1517 | pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled; |
| 1518 | pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity; |
| 1519 | pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS; |
| 1520 | //Assign this before calling CsrInit11dInfo |
| 1521 | pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1522 | if( csrIs11dSupported( pMac ) ) |
| 1523 | { |
| 1524 | status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo); |
| 1525 | } |
| 1526 | else |
| 1527 | { |
| 1528 | pMac->scan.curScanType = eSIR_ACTIVE_SCAN; |
| 1529 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1530 | |
| 1531 | /* Initialize the power + channel information if 11h is enabled. |
| 1532 | If 11d is enabled this information has already been initialized */ |
| 1533 | if( csrIs11hSupported( pMac ) && !csrIs11dSupported( pMac ) ) |
| 1534 | { |
| 1535 | csrInitChannelPowerList(pMac, &pParam->Csr11dinfo); |
| 1536 | } |
| 1537 | |
| 1538 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1539 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1540 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.csr11rConfig, &pParam->csr11rConfig, sizeof(tCsr11rConfigParams) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1541 | smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1542 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1543 | #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] | 1544 | pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1545 | pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1546 | pMac->roam.configParam.nImmediateRoamRssiDiff = pParam->nImmediateRoamRssiDiff; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1547 | smsLog( pMac, LOG1, "nImmediateRoamRssiDiff = %d", |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1548 | pMac->roam.configParam.nImmediateRoamRssiDiff ); |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 1549 | pMac->roam.configParam.nRoamPrefer5GHz = pParam->nRoamPrefer5GHz; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 1550 | pMac->roam.configParam.nRoamIntraBand = pParam->nRoamIntraBand; |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1551 | pMac->roam.configParam.isWESModeEnabled = pParam->isWESModeEnabled; |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 1552 | pMac->roam.configParam.nProbes = pParam->nProbes; |
| 1553 | pMac->roam.configParam.nRoamScanHomeAwayTime = pParam->nRoamScanHomeAwayTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1554 | #endif |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1555 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1556 | pMac->roam.configParam.isRoamOffloadScanEnabled = pParam->isRoamOffloadScanEnabled; |
| 1557 | #endif |
| 1558 | #ifdef FEATURE_WLAN_LFR |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1559 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled; |
| 1560 | #endif |
| 1561 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1562 | #ifdef FEATURE_WLAN_CCX |
| 1563 | pMac->roam.configParam.isCcxIniFeatureEnabled = pParam->isCcxIniFeatureEnabled; |
| 1564 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1565 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1566 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.neighborRoamConfig, &pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1567 | smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod); |
| 1568 | smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold); |
| 1569 | smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold); |
| 1570 | smsLog( pMac, LOG1, "nNeighborScanMinChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime); |
| 1571 | smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime); |
| 1572 | smsLog( pMac, LOG1, "nMaxNeighborRetries = %d", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries); |
| 1573 | smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod); |
| 1574 | smsLog( pMac, LOG1, "nEmptyScanRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1575 | { |
| 1576 | int i; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1577 | smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1578 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1579 | { |
| 1580 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1581 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1582 | smsLog( pMac, LOG1, ""); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1583 | } |
| 1584 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1585 | pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff; |
| 1586 | pMac->scan.fValidateList = pParam->fValidateList; |
| 1587 | pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d; |
| 1588 | pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan; |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 1589 | pMac->scan.scanResultCfgAgingTime = pParam->scanCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1590 | pMac->roam.configParam.fScanTwice = pParam->fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1591 | pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl; |
| 1592 | /* This parameter is not available in cfg and not passed from upper layers. Instead it is initialized here |
| 1593 | * This paramtere is used in concurrency to determine if there are concurrent active sessions. |
| 1594 | * Is used as a temporary fix to disconnect all active sessions when BMPS enabled so the active session if Infra STA |
| 1595 | * will automatically connect back and resume BMPS since resume BMPS is not working when moving from concurrent to |
| 1596 | * single session |
| 1597 | */ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1598 | //Remove this code once SLM_Sessionization is supported |
| 1599 | //BMPS_WORKAROUND_NOT_NEEDED |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1600 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 1601 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1602 | #ifdef WLAN_FEATURE_11AC |
| 1603 | pMac->roam.configParam.nVhtChannelWidth = pParam->nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1604 | pMac->roam.configParam.txBFEnable= pParam->enableTxBF; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1605 | pMac->roam.configParam.txBFCsnValue = pParam->txBFCsnValue; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1606 | #endif |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1607 | pMac->roam.configParam.txLdpcEnable = pParam->enableTxLdpc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1608 | } |
| 1609 | |
| 1610 | return status; |
| 1611 | } |
| 1612 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1613 | eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1614 | { |
| 1615 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1616 | if(pParam) |
| 1617 | { |
| 1618 | pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode; |
| 1619 | pParam->Is11eSupportEnabled = pMac->roam.configParam.Is11eSupportEnabled; |
| 1620 | pParam->FragmentationThreshold = pMac->roam.configParam.FragmentationThreshold; |
| 1621 | pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled; |
| 1622 | pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 1623 | pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1624 | pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz); |
| 1625 | pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1626 | pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold; |
| 1627 | pParam->phyMode = pMac->roam.configParam.phyMode; |
| 1628 | pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 1629 | pParam->HeartbeatThresh24 = pMac->roam.configParam.HeartbeatThresh24; |
| 1630 | pParam->HeartbeatThresh50 = pMac->roam.configParam.HeartbeatThresh50; |
| 1631 | pParam->ProprietaryRatesEnabled = pMac->roam.configParam.ProprietaryRatesEnabled; |
| 1632 | pParam->TxRate = pMac->roam.configParam.TxRate; |
| 1633 | pParam->AdHocChannel24 = pMac->roam.configParam.AdHocChannel24; |
| 1634 | pParam->AdHocChannel5G = pMac->roam.configParam.AdHocChannel5G; |
| 1635 | pParam->bandCapability = pMac->roam.configParam.bandCapability; |
| 1636 | pParam->cbChoice = pMac->roam.configParam.cbChoice; |
| 1637 | pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1638 | pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime; |
| 1639 | pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime; |
| 1640 | pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; |
| 1641 | pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame^] | 1642 | pParam->nActiveMaxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; |
| 1643 | pParam->nActiveMinChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; |
| 1644 | pParam->disableAggWithBtc = pMac->roam.configParam.disableAggWithBtc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1645 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1646 | pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc; |
| 1647 | pParam->nActiveMinChnTimeConc = pMac->roam.configParam.nActiveMinChnTimeConc; |
| 1648 | pParam->nPassiveMaxChnTimeConc = pMac->roam.configParam.nPassiveMaxChnTimeConc; |
| 1649 | pParam->nPassiveMinChnTimeConc = pMac->roam.configParam.nPassiveMinChnTimeConc; |
| 1650 | pParam->nRestTimeConc = pMac->roam.configParam.nRestTimeConc; |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1651 | pParam->nNumStaChanCombinedConc = pMac->roam.configParam.nNumStaChanCombinedConc; |
| 1652 | pParam->nNumP2PChanCombinedConc = pMac->roam.configParam.nNumP2PChanCombinedConc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1653 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1654 | //Change the unit from microsecond to second |
| 1655 | pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT; |
| 1656 | pParam->eBand = pMac->roam.configParam.eBand; |
| 1657 | pParam->nScanResultAgeCount = pMac->roam.configParam.agingCount; |
| 1658 | pParam->scanAgeTimeNCNPS = pMac->roam.configParam.scanAgeTimeNCNPS; |
| 1659 | pParam->scanAgeTimeNCPS = pMac->roam.configParam.scanAgeTimeNCPS; |
| 1660 | pParam->scanAgeTimeCNPS = pMac->roam.configParam.scanAgeTimeCNPS; |
| 1661 | pParam->scanAgeTimeCPS = pMac->roam.configParam.scanAgeTimeCPS; |
| 1662 | pParam->bCatRssiOffset = pMac->roam.configParam.bCatRssiOffset; |
| 1663 | pParam->nRoamingTime = pMac->roam.configParam.nRoamingTime; |
| 1664 | pParam->fEnforce11dChannels = pMac->roam.configParam.fEnforce11dChannels; |
| 1665 | pParam->fSupplicantCountryCodeHasPriority = pMac->roam.configParam.fSupplicantCountryCodeHasPriority; |
| 1666 | pParam->fEnforceCountryCodeMatch = pMac->roam.configParam.fEnforceCountryCodeMatch; |
| 1667 | pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain; |
| 1668 | pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold; |
| 1669 | pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1670 | pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled; |
| 1671 | pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap; |
| 1672 | pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 1673 | pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1674 | pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff; |
| 1675 | pParam->fValidateList = pMac->roam.configParam.fValidateList; |
| 1676 | pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d; |
| 1677 | pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan; |
| 1678 | pParam->fScanTwice = pMac->roam.configParam.fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1679 | pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl; |
Madan Mohan Koyyalamudi | ed41951 | 2012-11-29 15:53:46 -0800 | [diff] [blame] | 1680 | pParam->fEnableMCCMode = pMac->roam.configParam.fenableMCCMode; |
Madan Mohan Koyyalamudi | 057bd80 | 2012-11-29 16:02:39 -0800 | [diff] [blame] | 1681 | pParam->fAllowMCCGODiffBI = pMac->roam.configParam.fAllowMCCGODiffBI; |
Sunil Ravi | 39b2e53 | 2013-01-20 23:45:53 -0800 | [diff] [blame] | 1682 | pParam->scanCfgAgingTime = pMac->scan.scanResultCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1683 | |
| 1684 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1685 | palCopyMemory( pMac->hHdd, &pParam->neighborRoamConfig, &pMac->roam.configParam.neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
| 1686 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1687 | #ifdef WLAN_FEATURE_11AC |
| 1688 | pParam->nVhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1689 | pParam->enableTxBF = pMac->roam.configParam.txBFEnable; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1690 | pParam->txBFCsnValue = pMac->roam.configParam.txBFCsnValue; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1691 | #endif |
Venkata Prathyusha Kuntupalli | f2695c1 | 2013-04-17 15:41:23 -0700 | [diff] [blame] | 1692 | pParam->enableTxLdpc = pMac->roam.configParam.txLdpcEnable; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1693 | csrSetChannels(pMac, pParam); |
| 1694 | |
| 1695 | status = eHAL_STATUS_SUCCESS; |
| 1696 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1697 | return (status); |
| 1698 | } |
| 1699 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1700 | eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded) |
| 1701 | { |
| 1702 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 1703 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1704 | tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE; |
| 1705 | eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1706 | do |
| 1707 | { |
| 1708 | if(eCSR_BAND_24 == eBand) |
| 1709 | { |
| 1710 | if(CSR_IS_RADIO_A_ONLY(pMac)) break; |
| 1711 | if((eCSR_DOT11_MODE_11a & phyMode) || (eCSR_DOT11_MODE_11a_ONLY & phyMode)) break; |
| 1712 | } |
| 1713 | if(eCSR_BAND_5G == eBand) |
| 1714 | { |
| 1715 | if(CSR_IS_RADIO_BG_ONLY(pMac)) break; |
| 1716 | if((eCSR_DOT11_MODE_11b & phyMode) || (eCSR_DOT11_MODE_11b_ONLY & phyMode) || |
| 1717 | (eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1718 | ) |
| 1719 | { |
| 1720 | break; |
| 1721 | } |
| 1722 | } |
| 1723 | if((0 == phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode)) |
| 1724 | { |
| 1725 | newPhyMode = eCSR_DOT11_MODE_TAURUS; |
| 1726 | } |
| 1727 | else if(eCSR_DOT11_MODE_AUTO & phyMode) |
| 1728 | { |
| 1729 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1730 | } |
| 1731 | else |
| 1732 | { |
| 1733 | //Check for dual band and higher capability first |
| 1734 | if(eCSR_DOT11_MODE_11n_ONLY & phyMode) |
| 1735 | { |
| 1736 | if(eCSR_DOT11_MODE_11n_ONLY != phyMode) break; |
| 1737 | newPhyMode = eCSR_DOT11_MODE_11n_ONLY; |
| 1738 | } |
| 1739 | else if(eCSR_DOT11_MODE_11a_ONLY & phyMode) |
| 1740 | { |
| 1741 | if(eCSR_DOT11_MODE_11a_ONLY != phyMode) break; |
| 1742 | if(eCSR_BAND_24 == eBand) break; |
| 1743 | newPhyMode = eCSR_DOT11_MODE_11a_ONLY; |
| 1744 | eBand = eCSR_BAND_5G; |
| 1745 | } |
| 1746 | else if(eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1747 | { |
| 1748 | if(eCSR_DOT11_MODE_11g_ONLY != phyMode) break; |
| 1749 | if(eCSR_BAND_5G == eBand) break; |
| 1750 | newPhyMode = eCSR_DOT11_MODE_11g_ONLY; |
| 1751 | eBand = eCSR_BAND_24; |
| 1752 | } |
| 1753 | else if(eCSR_DOT11_MODE_11b_ONLY & phyMode) |
| 1754 | { |
| 1755 | if(eCSR_DOT11_MODE_11b_ONLY != phyMode) break; |
| 1756 | if(eCSR_BAND_5G == eBand) break; |
| 1757 | newPhyMode = eCSR_DOT11_MODE_11b_ONLY; |
| 1758 | eBand = eCSR_BAND_24; |
| 1759 | } |
| 1760 | else if(eCSR_DOT11_MODE_11n & phyMode) |
| 1761 | { |
| 1762 | newPhyMode = eCSR_DOT11_MODE_11n; |
| 1763 | } |
| 1764 | else if(eCSR_DOT11_MODE_abg & phyMode) |
| 1765 | { |
| 1766 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1767 | } |
| 1768 | else if(eCSR_DOT11_MODE_11a & phyMode) |
| 1769 | { |
| 1770 | if((eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11b & phyMode)) |
| 1771 | { |
| 1772 | if(eCSR_BAND_ALL == eBand) |
| 1773 | { |
| 1774 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1775 | } |
| 1776 | else |
| 1777 | { |
| 1778 | //bad setting |
| 1779 | break; |
| 1780 | } |
| 1781 | } |
| 1782 | else |
| 1783 | { |
| 1784 | newPhyMode = eCSR_DOT11_MODE_11a; |
| 1785 | eBand = eCSR_BAND_5G; |
| 1786 | } |
| 1787 | } |
| 1788 | else if(eCSR_DOT11_MODE_11g & phyMode) |
| 1789 | { |
| 1790 | newPhyMode = eCSR_DOT11_MODE_11g; |
| 1791 | eBand = eCSR_BAND_24; |
| 1792 | } |
| 1793 | else if(eCSR_DOT11_MODE_11b & phyMode) |
| 1794 | { |
| 1795 | newPhyMode = eCSR_DOT11_MODE_11b; |
| 1796 | eBand = eCSR_BAND_24; |
| 1797 | } |
| 1798 | else |
| 1799 | { |
| 1800 | //We will never be here |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1801 | smsLog( pMac, LOGE, FL(" cannot recognize the phy mode 0x%08X"), phyMode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1802 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1803 | } |
| 1804 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1805 | //Done validating |
| 1806 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1807 | //Now we need to check whether a restart is needed. |
| 1808 | if(eBand != pMac->roam.configParam.eBand) |
| 1809 | { |
| 1810 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1811 | break; |
| 1812 | } |
| 1813 | if(newPhyMode != pMac->roam.configParam.phyMode) |
| 1814 | { |
| 1815 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1816 | break; |
| 1817 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1818 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1819 | if(HAL_STATUS_SUCCESS(status)) |
| 1820 | { |
| 1821 | pMac->roam.configParam.eBand = eBand; |
| 1822 | pMac->roam.configParam.phyMode = newPhyMode; |
| 1823 | if(pfRestartNeeded) |
| 1824 | { |
| 1825 | *pfRestartNeeded = fRestartNeeded; |
| 1826 | } |
| 1827 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1828 | return (status); |
| 1829 | } |
| 1830 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1831 | void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList ) |
| 1832 | { |
| 1833 | tANI_U8 Index; |
| 1834 | tANI_U8 cChannels; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1835 | // for dual band NICs, don't need to trim the channel list.... |
| 1836 | if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) ) |
| 1837 | { |
| 1838 | // 2.4 GHz band operation requires the channel list to be trimmed to |
| 1839 | // the 2.4 GHz channels only... |
| 1840 | if ( CSR_IS_24_BAND_ONLY( pMac ) ) |
| 1841 | { |
| 1842 | for( Index = 0, cChannels = 0; Index < pChannelList->numChannels; |
| 1843 | Index++ ) |
| 1844 | { |
| 1845 | if ( CSR_IS_CHANNEL_24GHZ(pChannelList->channelList[ Index ]) ) |
| 1846 | { |
| 1847 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 1848 | cChannels++; |
| 1849 | } |
| 1850 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1851 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 1852 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 1853 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 1854 | // only if we need to. |
| 1855 | // |
| 1856 | // The amount of memory to clear is the number of channesl that we trimmed |
| 1857 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 1858 | |
| 1859 | if ( pChannelList->numChannels > cChannels ) |
| 1860 | { |
| 1861 | palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ], |
| 1862 | sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) ); |
| 1863 | |
| 1864 | } |
| 1865 | |
| 1866 | pChannelList->numChannels = cChannels; |
| 1867 | } |
| 1868 | else if ( CSR_IS_5G_BAND_ONLY( pMac ) ) |
| 1869 | { |
| 1870 | for ( Index = 0, cChannels = 0; Index < pChannelList->numChannels; Index++ ) |
| 1871 | { |
| 1872 | if ( CSR_IS_CHANNEL_5GHZ(pChannelList->channelList[ Index ]) ) |
| 1873 | { |
| 1874 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 1875 | cChannels++; |
| 1876 | } |
| 1877 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1878 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 1879 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 1880 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 1881 | // only if we need to. |
| 1882 | // |
| 1883 | // The amount of memory to clear is the number of channesl that we trimmed |
| 1884 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 1885 | if ( pChannelList->numChannels > cChannels ) |
| 1886 | { |
| 1887 | palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ], |
| 1888 | sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) ); |
| 1889 | } |
| 1890 | |
| 1891 | pChannelList->numChannels = cChannels; |
| 1892 | } |
| 1893 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1894 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1895 | #define INFRA_AP_DEFAULT_CHANNEL 6 |
| 1896 | eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum) |
| 1897 | { |
| 1898 | tANI_U8 index= 0; |
| 1899 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1900 | for (index=0; index < pMac->scan.base20MHzChannels.numChannels ;index++) |
| 1901 | { |
| 1902 | if(pMac->scan.base20MHzChannels.channelList[ index ] == chnNum){ |
| 1903 | status = eHAL_STATUS_SUCCESS; |
| 1904 | break; |
| 1905 | } |
| 1906 | } |
| 1907 | return status; |
| 1908 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 1909 | |
| 1910 | eHalStatus csrGet5GChannels(tpAniSirGlobal pMac) |
| 1911 | { |
| 1912 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1913 | tANI_U8 num20MHzChannelsFound = 0; |
| 1914 | VOS_STATUS vosStatus; |
| 1915 | tANI_U8 num40MHzChannelsFound = 0; |
| 1916 | tANI_U8 Index = 0; |
| 1917 | tANI_U8 channelList = 0; |
| 1918 | |
| 1919 | // Updating the defaultpower Table for changed Domain Id |
| 1920 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 1921 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 1922 | |
| 1923 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 1924 | { |
| 1925 | smsLog( pMac, LOGE, FL("failed to get channels")); |
| 1926 | status = eHAL_STATUS_FAILURE; |
| 1927 | } |
| 1928 | else |
| 1929 | { |
| 1930 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 1931 | { |
| 1932 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1933 | } |
| 1934 | |
| 1935 | // Move the only 5GHZ channel list to the global data, |
| 1936 | // As 2.4GHZ list coming from the AP for the changed domain |
| 1937 | // structure -- this will be used as the scan list |
| 1938 | for(channelList = 0; channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN; channelList++) |
| 1939 | { |
| 1940 | // If Channel is 5GHz just break the for loop |
| 1941 | if(!(pMac->scan.base20MHzChannels.channelList[ channelList ] > 0 && pMac->scan.base20MHzChannels.channelList[ channelList ] <= 14)) |
| 1942 | break; |
| 1943 | } |
| 1944 | // Update the 5G channels from nv.bin |
| 1945 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 1946 | { |
| 1947 | if(pMac->scan.defaultPowerTable[Index].chanId >= 36 && pMac->scan.defaultPowerTable[Index].chanId <= 165) |
| 1948 | { |
Krunal Soni | a75019a | 2013-05-01 01:08:22 -0700 | [diff] [blame] | 1949 | if (channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 1950 | { |
| 1951 | pMac->scan.base20MHzChannels.channelList[ channelList ] = pMac->scan.defaultPowerTable[Index].chanId; |
| 1952 | channelList++; |
| 1953 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 1954 | } |
| 1955 | } |
| 1956 | |
| 1957 | pMac->scan.numChannelsDefault = (num20MHzChannelsFound > channelList) ? num20MHzChannelsFound : channelList; |
| 1958 | pMac->scan.base20MHzChannels.numChannels = (num20MHzChannelsFound > channelList) ? num20MHzChannelsFound : channelList; |
| 1959 | // Filling the remaining index as Zero Just for causion |
| 1960 | for(Index = pMac->scan.base20MHzChannels.numChannels; Index < WNI_CFG_VALID_CHANNEL_LIST_LEN; Index++) |
| 1961 | pMac->scan.base20MHzChannels.channelList[ Index ] = 0; |
| 1962 | } |
| 1963 | return status; |
| 1964 | } |
| 1965 | |
| 1966 | eHalStatus csrGet24GChannels(tpAniSirGlobal pMac) |
| 1967 | { |
| 1968 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1969 | tANI_U8 num20MHzChannelsFound = 0; |
| 1970 | VOS_STATUS vosStatus; |
| 1971 | tANI_U8 Index = 0; |
| 1972 | tANI_U8 num40MHzChannelsFound = 0; |
| 1973 | tANI_U8 channelList5GBackup[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}, nuum5GchannelListBackup; |
| 1974 | tANI_U8 channelList = 0; |
| 1975 | |
| 1976 | // Read the scan channel list (including the power limit) from EEPROM |
| 1977 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 1978 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 1979 | |
| 1980 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 1981 | { |
| 1982 | smsLog( pMac, LOGE, FL("failed to get channels \n")); |
| 1983 | status = eHAL_STATUS_FAILURE; |
| 1984 | } |
| 1985 | else |
| 1986 | { |
| 1987 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 1988 | { |
| 1989 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1990 | } |
| 1991 | |
| 1992 | // Move the 2.4GHZ channel list only to the global data, |
| 1993 | // As 5GHz list been provided by AP as part of 11d IE |
| 1994 | // structure -- this will be used as the scan list |
| 1995 | for(channelList = 0, nuum5GchannelListBackup = 0; channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN; channelList++) |
| 1996 | { |
| 1997 | if(pMac->scan.base20MHzChannels.channelList[ channelList ] >= 36 && pMac->scan.base20MHzChannels.channelList[ channelList ] <= 165) |
| 1998 | { |
| 1999 | // First taking the 5GHz channel list backup |
| 2000 | channelList5GBackup[nuum5GchannelListBackup] = pMac->scan.base20MHzChannels.channelList[ channelList ]; |
| 2001 | nuum5GchannelListBackup++; |
| 2002 | } |
| 2003 | } |
| 2004 | // Updating the 2.4GHz list |
| 2005 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 2006 | { |
| 2007 | if(pMac->scan.defaultPowerTable[Index].chanId > 0 && pMac->scan.defaultPowerTable[Index].chanId <= 14) |
| 2008 | pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[Index].chanId; |
| 2009 | } |
| 2010 | // Restoring the Backed up 5 GHZ channels |
| 2011 | for(channelList = 0;channelList < nuum5GchannelListBackup; channelList++ ) |
| 2012 | { |
Krunal Soni | a75019a | 2013-05-01 01:08:22 -0700 | [diff] [blame] | 2013 | if (Index < WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 2014 | { |
| 2015 | pMac->scan.base20MHzChannels.channelList[ Index ] = channelList5GBackup[channelList]; |
| 2016 | Index++; |
| 2017 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2018 | } |
| 2019 | |
| 2020 | pMac->scan.numChannelsDefault = (num20MHzChannelsFound > Index) ? num20MHzChannelsFound : Index; |
| 2021 | pMac->scan.base20MHzChannels.numChannels = (num20MHzChannelsFound > Index) ? num20MHzChannelsFound : Index; |
| 2022 | } |
| 2023 | return (status); |
| 2024 | } |
| 2025 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2026 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac) |
| 2027 | { |
| 2028 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2029 | tANI_U8 num20MHzChannelsFound = 0; |
| 2030 | VOS_STATUS vosStatus; |
| 2031 | tANI_U8 Index = 0; |
| 2032 | tANI_U8 num40MHzChannelsFound = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2033 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2034 | |
| 2035 | //TODO: this interface changed to include the 40MHz channel list |
| 2036 | // this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation |
| 2037 | // Read the scan channel list (including the power limit) from EEPROM |
| 2038 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 2039 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 2040 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 2041 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2042 | smsLog( pMac, LOGE, FL("failed to get channels ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2043 | status = eHAL_STATUS_FAILURE; |
| 2044 | } |
| 2045 | else |
| 2046 | { |
| 2047 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 2048 | { |
| 2049 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2050 | } |
| 2051 | pMac->scan.numChannelsDefault = num20MHzChannelsFound; |
| 2052 | // Move the channel list to the global data |
| 2053 | // structure -- this will be used as the scan list |
| 2054 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 2055 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2056 | pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[ Index ].chanId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2057 | } |
| 2058 | pMac->scan.base20MHzChannels.numChannels = num20MHzChannelsFound; |
| 2059 | if(num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 2060 | { |
| 2061 | num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2062 | } |
| 2063 | for ( Index = 0; Index < num40MHzChannelsFound; Index++) |
| 2064 | { |
| 2065 | pMac->scan.base40MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable40MHz[ Index ].chanId; |
| 2066 | } |
| 2067 | pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound; |
| 2068 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2069 | return (status); |
| 2070 | } |
| 2071 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2072 | eHalStatus csrInitChannelList( tHalHandle hHal ) |
| 2073 | { |
| 2074 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2075 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2076 | csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels); |
| 2077 | csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels); |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 2078 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_FALSE); |
| 2079 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2080 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2081 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2082 | |
| 2083 | return (status); |
| 2084 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2085 | eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, |
| 2086 | tCsrUpdateConfigParam *pUpdateConfigParam) |
| 2087 | { |
| 2088 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2089 | tCsr11dinfo *ps11dinfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2090 | ps11dinfo = &pUpdateConfigParam->Csr11dinfo; |
| 2091 | status = CsrInit11dInfo(pMac, ps11dinfo); |
| 2092 | return status; |
| 2093 | } |
| 2094 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2095 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2096 | { |
| 2097 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2098 | tANI_U8 index; |
| 2099 | tANI_U32 count=0; |
| 2100 | tSirMacChanInfo *pChanInfo; |
| 2101 | tSirMacChanInfo *pChanInfoStart; |
| 2102 | tANI_BOOLEAN applyConfig = TRUE; |
| 2103 | |
| 2104 | if(!ps11dinfo) |
| 2105 | { |
| 2106 | return (status); |
| 2107 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2108 | if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) ) |
| 2109 | { |
| 2110 | pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels; |
| 2111 | status = palCopyMemory(pMac->hHdd, pMac->scan.base20MHzChannels.channelList, |
| 2112 | ps11dinfo->Channels.channelList, ps11dinfo->Channels.numChannels); |
| 2113 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
| 2114 | } |
| 2115 | else |
| 2116 | { |
| 2117 | //No change |
| 2118 | return (eHAL_STATUS_SUCCESS); |
| 2119 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2120 | //legacy maintenance |
| 2121 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, |
| 2122 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 2123 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2124 | //Tush: at csropen get this initialized with default, during csr reset if this |
| 2125 | // already set with some value no need initilaize with default again |
| 2126 | if(0 == pMac->scan.countryCodeCurrent[0]) |
| 2127 | { |
| 2128 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 2129 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 2130 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
| 2131 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2132 | // need to add the max power channel list |
| 2133 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN))) |
| 2134 | { |
| 2135 | palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2136 | pChanInfoStart = pChanInfo; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2137 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2138 | { |
| 2139 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2140 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2141 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2142 | pChanInfo++; |
| 2143 | count++; |
| 2144 | } |
| 2145 | if(count) |
| 2146 | { |
| 2147 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2148 | } |
| 2149 | palFreeMemory(pMac->hHdd, pChanInfoStart); |
| 2150 | } |
| 2151 | //Only apply them to CFG when not in STOP state. Otherwise they will be applied later |
| 2152 | if( HAL_STATUS_SUCCESS(status) ) |
| 2153 | { |
| 2154 | for( index = 0; index < CSR_ROAM_SESSION_MAX; index++ ) |
| 2155 | { |
| 2156 | if((CSR_IS_SESSION_VALID(pMac, index)) && CSR_IS_ROAM_STOP(pMac, index)) |
| 2157 | { |
| 2158 | applyConfig = FALSE; |
| 2159 | } |
| 2160 | } |
| 2161 | |
| 2162 | if(TRUE == applyConfig) |
| 2163 | { |
| 2164 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2165 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2166 | } |
| 2167 | |
| 2168 | } |
| 2169 | return (status); |
| 2170 | } |
| 2171 | /* Initialize the Channel + Power List in the local cache and in the CFG */ |
| 2172 | eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2173 | { |
| 2174 | tANI_U8 index; |
| 2175 | tANI_U32 count=0; |
| 2176 | tSirMacChanInfo *pChanInfo; |
| 2177 | tSirMacChanInfo *pChanInfoStart; |
| 2178 | |
| 2179 | if(!ps11dinfo || !pMac) |
| 2180 | { |
| 2181 | return eHAL_STATUS_FAILURE; |
| 2182 | } |
| 2183 | |
| 2184 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN))) |
| 2185 | { |
| 2186 | palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2187 | pChanInfoStart = pChanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2188 | |
| 2189 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2190 | { |
| 2191 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2192 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2193 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2194 | pChanInfo++; |
| 2195 | count++; |
| 2196 | } |
| 2197 | if(count) |
| 2198 | { |
| 2199 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2200 | } |
| 2201 | palFreeMemory(pMac->hHdd, pChanInfoStart); |
| 2202 | } |
| 2203 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2204 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2205 | } |
| 2206 | |
| 2207 | //pCommand may be NULL |
| 2208 | //Pass in sessionId in case pCommand is NULL. sessionId is not used in case pCommand is not NULL. |
| 2209 | void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason) |
| 2210 | { |
| 2211 | tListElem *pEntry, *pNextEntry; |
| 2212 | tSmeCmd *pDupCommand; |
| 2213 | tDblLinkList localList; |
| 2214 | |
| 2215 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 2216 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 2217 | { |
| 2218 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 2219 | return; |
| 2220 | } |
| 2221 | csrLLLock( &pMac->sme.smeCmdPendingList ); |
| 2222 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK ); |
| 2223 | while( pEntry ) |
| 2224 | { |
| 2225 | pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ); |
| 2226 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2227 | // Remove the previous command if.. |
| 2228 | // - the new roam command is for the same RoamReason... |
| 2229 | // - the new roam command is a NewProfileList. |
| 2230 | // - the new roam command is a Forced Dissoc |
| 2231 | // - the new roam command is from an 802.11 OID (OID_SSID or OID_BSSID). |
| 2232 | if ( |
| 2233 | (pCommand && ( pCommand->sessionId == pDupCommand->sessionId ) && |
| 2234 | ((pCommand->command == pDupCommand->command) && |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 2235 | /* This peermac check is requried for Softap/GO scenarios |
| 2236 | * For STA scenario below OR check will suffice as pCommand will |
| 2237 | * always be NULL for STA scenarios |
| 2238 | */ |
| 2239 | (vos_mem_compare(pDupCommand->u.roamCmd.peerMac, pCommand->u.roamCmd.peerMac, sizeof(v_MACADDR_t))) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2240 | (pCommand->u.roamCmd.roamReason == pDupCommand->u.roamCmd.roamReason || |
| 2241 | eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason || |
| 2242 | eCsrHddIssued == pCommand->u.roamCmd.roamReason))) |
| 2243 | || |
| 2244 | //below the pCommand is NULL |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2245 | ( (sessionId == pDupCommand->sessionId) && |
| 2246 | (eSmeCommandRoam == pDupCommand->command) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2247 | ((eCsrForcedDisassoc == eRoamReason) || |
| 2248 | (eCsrHddIssued == eRoamReason)) |
| 2249 | ) |
| 2250 | ) |
| 2251 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2252 | smsLog(pMac, LOGW, FL(" roamReason = %d"), pDupCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2253 | // Remove the 'stale' roam command from the pending list... |
| 2254 | if(csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK )) |
| 2255 | { |
| 2256 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 2257 | } |
| 2258 | } |
| 2259 | pEntry = pNextEntry; |
| 2260 | } |
| 2261 | csrLLUnlock( &pMac->sme.smeCmdPendingList ); |
| 2262 | |
| 2263 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 2264 | { |
| 2265 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 2266 | //Tell caller that the command is cancelled |
| 2267 | csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL, pDupCommand->u.roamCmd.roamId, |
| 2268 | eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE); |
| 2269 | csrReleaseCommandRoam(pMac, pDupCommand); |
| 2270 | } |
| 2271 | csrLLClose(&localList); |
| 2272 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2273 | eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, |
| 2274 | tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2) |
| 2275 | { |
| 2276 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2277 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2278 | WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type); |
| 2279 | #endif |
| 2280 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2281 | if( CSR_IS_SESSION_VALID( pMac, sessionId) ) |
| 2282 | { |
| 2283 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2284 | } |
| 2285 | else |
| 2286 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2287 | smsLog(pMac, LOGE, "Session ID:%d is not valid", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2288 | VOS_ASSERT(0); |
| 2289 | return eHAL_STATUS_FAILURE; |
| 2290 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2291 | if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo) |
| 2292 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2293 | smsLog(pMac, LOGW, " Assoc complete result = %d statusCode = %d reasonCode = %d", u2, pRoamInfo->statusCode, pRoamInfo->reasonCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2294 | } |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 2295 | if ((u1 == eCSR_ROAM_FT_REASSOC_FAILED) && (pSession->bRefAssocStartCnt)) { |
| 2296 | /* |
| 2297 | * Decrement bRefAssocStartCnt for FT reassoc failure. |
| 2298 | * Reason: For FT reassoc failures, we first call |
| 2299 | * csrRoamCallCallback before notifying a failed roam |
| 2300 | * completion through csrRoamComplete. The latter in |
| 2301 | * turn calls csrRoamProcessResults which tries to |
| 2302 | * once again call csrRoamCallCallback if bRefAssocStartCnt |
| 2303 | * is non-zero. Since this is redundant for FT reassoc |
| 2304 | * failure, decrement bRefAssocStartCnt. |
| 2305 | */ |
| 2306 | pSession->bRefAssocStartCnt--; |
| 2307 | } |
| 2308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2309 | if ( (pSession == NULL) || |
| 2310 | (eANI_BOOLEAN_FALSE == pSession->sessionActive) ) |
| 2311 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2312 | smsLog(pMac, LOG1, "Session ID is not valid"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2313 | return eHAL_STATUS_FAILURE; |
| 2314 | } |
| 2315 | |
| 2316 | if(NULL != pSession->callback) |
| 2317 | { |
| 2318 | if( pRoamInfo ) |
| 2319 | { |
| 2320 | pRoamInfo->sessionId = (tANI_U8)sessionId; |
| 2321 | } |
| 2322 | |
| 2323 | /* avoid holding the global lock when making the roaming callback , original change came |
| 2324 | from a raised CR (CR304874). Since this callback is in HDD a potential deadlock |
| 2325 | is possible on other OS ports where the callback may need to take locks to protect |
| 2326 | HDD state |
| 2327 | UPDATE : revert this change but keep the comments here. Need to revisit as there are callbacks |
| 2328 | that may actually depend on the lock being held */ |
| 2329 | // TODO: revisit: sme_ReleaseGlobalLock( &pMac->sme ); |
| 2330 | status = pSession->callback(pSession->pContext, pRoamInfo, roamId, u1, u2); |
| 2331 | // TODO: revisit: sme_AcquireGlobalLock( &pMac->sme ); |
| 2332 | } |
| 2333 | //EVENT_WLAN_STATUS: eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 2334 | // eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED, |
| 2335 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2336 | palZeroMemory(pMac->hHdd, &connectionStatus, sizeof(vos_event_wlan_status_payload_type)); |
| 2337 | if((eCSR_ROAM_ASSOCIATION_COMPLETION == u1) && (eCSR_ROAM_RESULT_ASSOCIATED == u2)) |
| 2338 | { |
| 2339 | connectionStatus.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 2340 | connectionStatus.bssType = pRoamInfo->u.pConnectedProfile->BSSType; |
| 2341 | if(NULL != pRoamInfo->pBssDesc) |
| 2342 | { |
| 2343 | connectionStatus.rssi = pRoamInfo->pBssDesc->rssi * (-1); |
| 2344 | connectionStatus.channel = pRoamInfo->pBssDesc->channelId; |
| 2345 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2346 | connectionStatus.qosCapability = pRoamInfo->u.pConnectedProfile->qosConnection; |
| 2347 | connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType); |
| 2348 | connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType); |
| 2349 | palCopyMemory(pMac->hHdd, connectionStatus.ssid, pRoamInfo->u.pConnectedProfile->SSID.ssId, 6); |
| 2350 | connectionStatus.reason = eCSR_REASON_UNSPECIFIED; |
| 2351 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2352 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2353 | if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2)) |
| 2354 | { |
| 2355 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2356 | connectionStatus.reason = eCSR_REASON_MIC_ERROR; |
| 2357 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2358 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2359 | if(eCSR_ROAM_RESULT_FORCED == u2) |
| 2360 | { |
| 2361 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2362 | connectionStatus.reason = eCSR_REASON_USER_REQUESTED; |
| 2363 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2364 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2365 | if(eCSR_ROAM_RESULT_DISASSOC_IND == u2) |
| 2366 | { |
| 2367 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2368 | connectionStatus.reason = eCSR_REASON_DISASSOC; |
| 2369 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2370 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2371 | if(eCSR_ROAM_RESULT_DEAUTH_IND == u2) |
| 2372 | { |
| 2373 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2374 | connectionStatus.reason = eCSR_REASON_DEAUTH; |
| 2375 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2376 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2377 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2378 | |
| 2379 | return (status); |
| 2380 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2381 | // Returns whether handoff is currently in progress or not |
| 2382 | tANI_BOOLEAN csrRoamIsHandoffInProgress(tpAniSirGlobal pMac) |
| 2383 | { |
| 2384 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 2385 | return csrNeighborRoamIsHandoffInProgress(pMac); |
| 2386 | #else |
| 2387 | return eANI_BOOLEAN_FALSE; |
| 2388 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2389 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2390 | eHalStatus csrRoamIssueDisassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2391 | eCsrRoamSubState NewSubstate, tANI_BOOLEAN fMICFailure ) |
| 2392 | { |
| 2393 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2394 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2395 | tANI_U16 reasonCode; |
| 2396 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2397 | |
| 2398 | if(!pSession) |
| 2399 | { |
| 2400 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2401 | return eHAL_STATUS_FAILURE; |
| 2402 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2403 | |
| 2404 | //Restore AC weight in case we change it |
| 2405 | if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 2406 | { |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 2407 | smsLog(pMac, LOG1, FL(" restore AC weights (%d-%d-%d-%d)"), pMac->roam.ucACWeights[0], pMac->roam.ucACWeights[1], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2408 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 2409 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 2410 | } |
| 2411 | |
| 2412 | if ( fMICFailure ) |
| 2413 | { |
| 2414 | reasonCode = eSIR_MAC_MIC_FAILURE_REASON; |
| 2415 | } |
| 2416 | else if (NewSubstate == eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF) |
| 2417 | { |
| 2418 | reasonCode = eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2419 | } |
| 2420 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2421 | { |
| 2422 | reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 2423 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2424 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2425 | if ( (csrRoamIsHandoffInProgress(pMac)) && |
| 2426 | (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF)) |
| 2427 | { |
| 2428 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2429 | palCopyMemory(pMac->hHdd, &bssId, pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, sizeof(tSirMacAddr)); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2430 | } |
| 2431 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2432 | #endif |
| 2433 | if(pSession->pConnectBssDesc) |
| 2434 | { |
| 2435 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2436 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2437 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2438 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 2439 | smsLog( pMac, LOG2, "CSR Attempting to Disassociate Bssid=%02x-%02x-%02x-%02x-%02x-%02x" |
| 2440 | "subState = %d reason=%d", bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], bssId[ 3 ], |
| 2441 | bssId[ 4 ], bssId[ 5 ], NewSubstate, reasonCode); |
| 2442 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2443 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2444 | |
| 2445 | status = csrSendMBDisassocReqMsg( pMac, sessionId, bssId, reasonCode ); |
| 2446 | |
| 2447 | if(HAL_STATUS_SUCCESS(status)) |
| 2448 | { |
| 2449 | csrRoamLinkDown(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2450 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2451 | //no need to tell QoS that we are disassociating, it will be taken care off in assoc req for HO |
| 2452 | if(eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate) |
| 2453 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2454 | //notify QoS module that disassoc happening |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2455 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 2456 | } |
| 2457 | #endif |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2458 | } |
| 2459 | else |
| 2460 | { |
| 2461 | smsLog(pMac, LOGW, FL("csrSendMBDisassocReqMsg failed with status %d"), status); |
| 2462 | } |
| 2463 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2464 | return (status); |
| 2465 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2466 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2467 | /* --------------------------------------------------------------------------- |
| 2468 | \fn csrRoamIssueDisassociateStaCmd |
| 2469 | \brief csr function that HDD calls to disassociate a associated station |
| 2470 | \param sessionId - session Id for Soft AP |
| 2471 | \param pPeerMacAddr - MAC of associated station to delete |
| 2472 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2473 | \return eHalStatus |
| 2474 | ---------------------------------------------------------------------------*/ |
| 2475 | eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, |
| 2476 | tANI_U32 sessionId, |
| 2477 | tANI_U8 *pPeerMacAddr, |
| 2478 | tANI_U32 reason) |
| 2479 | { |
| 2480 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2481 | tSmeCmd *pCommand; |
| 2482 | |
| 2483 | do |
| 2484 | { |
| 2485 | pCommand = csrGetCommandBuffer( pMac ); |
| 2486 | if ( !pCommand ) |
| 2487 | { |
| 2488 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2489 | status = eHAL_STATUS_RESOURCES; |
| 2490 | break; |
| 2491 | } |
| 2492 | pCommand->command = eSmeCommandRoam; |
| 2493 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2494 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocSta; |
| 2495 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2496 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2497 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2498 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2499 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2500 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2501 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2502 | } |
| 2503 | }while(0); |
| 2504 | |
| 2505 | return status; |
| 2506 | } |
| 2507 | |
| 2508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2509 | /* --------------------------------------------------------------------------- |
| 2510 | \fn csrRoamIssueDeauthSta |
| 2511 | \brief csr function that HDD calls to delete a associated station |
| 2512 | \param sessionId - session Id for Soft AP |
| 2513 | \param pPeerMacAddr - MAC of associated station to delete |
| 2514 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2515 | \return eHalStatus |
| 2516 | ---------------------------------------------------------------------------*/ |
| 2517 | eHalStatus csrRoamIssueDeauthStaCmd( tpAniSirGlobal pMac, |
| 2518 | tANI_U32 sessionId, |
| 2519 | tANI_U8 *pPeerMacAddr, |
| 2520 | tANI_U32 reason) |
| 2521 | { |
| 2522 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2523 | tSmeCmd *pCommand; |
| 2524 | |
| 2525 | do |
| 2526 | { |
| 2527 | pCommand = csrGetCommandBuffer( pMac ); |
| 2528 | if ( !pCommand ) |
| 2529 | { |
| 2530 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2531 | status = eHAL_STATUS_RESOURCES; |
| 2532 | break; |
| 2533 | } |
| 2534 | pCommand->command = eSmeCommandRoam; |
| 2535 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2536 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 2537 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2538 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2539 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2540 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2541 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2542 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2543 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2544 | } |
| 2545 | }while(0); |
| 2546 | |
| 2547 | return status; |
| 2548 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2549 | eHalStatus |
| 2550 | csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2551 | tANI_BOOLEAN bEnable ) |
| 2552 | { |
| 2553 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2554 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2555 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2556 | if (!pSession) |
| 2557 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2558 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2559 | return (status); |
| 2560 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2561 | if (pSession->pConnectBssDesc) |
| 2562 | { |
| 2563 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2564 | } |
| 2565 | else |
| 2566 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2567 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2568 | return (status); |
| 2569 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2570 | smsLog( pMac, LOG2, "CSR issuing tkip counter measures for Bssid = %02x-%02x-%02x-%02x-%02x-%02x, Enable = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2571 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2572 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] , bEnable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2573 | status = csrSendMBTkipCounterMeasuresReqMsg( pMac, sessionId, bEnable, bssId ); |
| 2574 | return (status); |
| 2575 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2576 | eHalStatus |
| 2577 | csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2578 | VOS_MODULE_ID modId, void *pUsrContext, |
| 2579 | void *pfnSapEventCallback, v_U8_t *pAssocStasBuf ) |
| 2580 | { |
| 2581 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2582 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2583 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2584 | if (!pSession) |
| 2585 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2586 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2587 | return (status); |
| 2588 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2589 | if(pSession->pConnectBssDesc) |
| 2590 | { |
| 2591 | palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) ); |
| 2592 | } |
| 2593 | else |
| 2594 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2595 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2596 | return (status); |
| 2597 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2598 | smsLog( pMac, LOG2, "CSR getting associated stations for Bssid = %02x-%02x-%02x-%02x-%02x-%02x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2599 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2600 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2601 | status = csrSendMBGetAssociatedStasReqMsg( pMac, sessionId, modId, bssId, pUsrContext, pfnSapEventCallback, pAssocStasBuf ); |
| 2602 | return (status); |
| 2603 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2604 | eHalStatus |
| 2605 | csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2606 | void *pUsrContext, void *pfnSapEventCallback, v_MACADDR_t pRemoveMac ) |
| 2607 | { |
| 2608 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2609 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2610 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2611 | |
| 2612 | if (!pSession) |
| 2613 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2614 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2615 | return (status); |
| 2616 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2617 | if(pSession->pConnectBssDesc) |
| 2618 | { |
| 2619 | palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) ); |
| 2620 | } |
| 2621 | else |
| 2622 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2623 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2624 | return (status); |
| 2625 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2626 | smsLog( pMac, LOG2, "CSR getting WPS Session Overlap for Bssid = %02x-%02x-%02x-%02x-%02x-%02x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2627 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2628 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
| 2629 | |
| 2630 | status = csrSendMBGetWPSPBCSessions( pMac, sessionId, bssId, pUsrContext, pfnSapEventCallback, pRemoveMac); |
| 2631 | |
| 2632 | return (status); |
| 2633 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2634 | eHalStatus csrRoamIssueDeauth( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 2635 | { |
| 2636 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2637 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2638 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2639 | |
| 2640 | if (!pSession) |
| 2641 | { |
| 2642 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2643 | return eHAL_STATUS_FAILURE; |
| 2644 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2645 | |
| 2646 | if(pSession->pConnectBssDesc) |
| 2647 | { |
| 2648 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2649 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2650 | smsLog( pMac, LOG2, "CSR Attempting to Deauth Bssid= %02x-%02x-%02x-%02x-%02x-%02x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2651 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2652 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2653 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2654 | |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2655 | status = csrSendMBDeauthReqMsg( pMac, sessionId, bssId, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2656 | if(!HAL_STATUS_SUCCESS(status)) |
| 2657 | { |
| 2658 | smsLog(pMac, LOGW, FL("csrSendMBDeauthReqMsg failed with status %d"), status); |
| 2659 | } |
| 2660 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2661 | return (status); |
| 2662 | } |
| 2663 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2664 | eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc ) |
| 2665 | { |
| 2666 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2667 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2668 | tANI_U32 size; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2669 | |
| 2670 | if(!pSession) |
| 2671 | { |
| 2672 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2673 | return eHAL_STATUS_FAILURE; |
| 2674 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2675 | |
| 2676 | // If no BSS description was found in this connection (happens with start IBSS), then |
| 2677 | // nix the BSS description that we keep around for the connected BSS) and get out... |
| 2678 | if(NULL == pBssDesc) |
| 2679 | { |
| 2680 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2681 | } |
| 2682 | else |
| 2683 | { |
| 2684 | size = pBssDesc->length + sizeof( pBssDesc->length ); |
| 2685 | if(NULL != pSession->pConnectBssDesc) |
| 2686 | { |
| 2687 | if(((pSession->pConnectBssDesc->length) + sizeof(pSession->pConnectBssDesc->length)) < size) |
| 2688 | { |
| 2689 | //not enough room for the new BSS, pMac->roam.pConnectBssDesc is freed inside |
| 2690 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2691 | } |
| 2692 | } |
| 2693 | if(NULL == pSession->pConnectBssDesc) |
| 2694 | { |
| 2695 | status = palAllocateMemory( pMac->hHdd, (void **)&pSession->pConnectBssDesc, size); |
| 2696 | } |
| 2697 | if ( HAL_STATUS_SUCCESS(status) && pSession->pConnectBssDesc ) |
| 2698 | { |
| 2699 | palCopyMemory( pMac->hHdd, pSession->pConnectBssDesc, pBssDesc, size ); |
| 2700 | } |
| 2701 | } |
| 2702 | |
| 2703 | return (status); |
| 2704 | } |
| 2705 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2706 | eHalStatus csrRoamPrepareBssConfig(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2707 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 2708 | tDot11fBeaconIEs *pIes) |
| 2709 | { |
| 2710 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2711 | eCsrCfgDot11Mode cfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2712 | VOS_ASSERT( pIes != NULL ); |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 2713 | if (pIes == NULL) |
| 2714 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2715 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2716 | do |
| 2717 | { |
| 2718 | palCopyMemory(pMac->hHdd, &pBssConfig->BssCap, &pBssDesc->capabilityInfo, sizeof(tSirMacCapabilityInfo)); |
| 2719 | //get qos |
| 2720 | pBssConfig->qosType = csrGetQoSFromBssDesc(pMac, pBssDesc, pIes); |
| 2721 | //get SSID |
| 2722 | if(pIes->SSID.present) |
| 2723 | { |
| 2724 | palCopyMemory(pMac->hHdd, &pBssConfig->SSID.ssId, pIes->SSID.ssid, pIes->SSID.num_ssid); |
| 2725 | pBssConfig->SSID.length = pIes->SSID.num_ssid; |
| 2726 | } |
| 2727 | else |
| 2728 | pBssConfig->SSID.length = 0; |
| 2729 | if(csrIsNULLSSID(pBssConfig->SSID.ssId, pBssConfig->SSID.length)) |
| 2730 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2731 | smsLog(pMac, LOGW, " BSS desc SSID is a wildcard"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2732 | //Return failed if profile doesn't have an SSID either. |
| 2733 | if(pProfile->SSIDs.numOfSSIDs == 0) |
| 2734 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2735 | smsLog(pMac, LOGW, " Both BSS desc and profile doesn't have SSID"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2736 | status = eHAL_STATUS_FAILURE; |
| 2737 | break; |
| 2738 | } |
| 2739 | } |
| 2740 | if(CSR_IS_CHANNEL_5GHZ(pBssDesc->channelId)) |
| 2741 | { |
| 2742 | pBssConfig->eBand = eCSR_BAND_5G; |
| 2743 | } |
| 2744 | else |
| 2745 | { |
| 2746 | pBssConfig->eBand = eCSR_BAND_24; |
| 2747 | } |
| 2748 | //phymode |
| 2749 | if(csrIsPhyModeMatch( pMac, pProfile->phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes )) |
| 2750 | { |
| 2751 | pBssConfig->uCfgDot11Mode = cfgDot11Mode; |
| 2752 | } |
| 2753 | else |
| 2754 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2755 | smsLog(pMac, LOGW, " Can not find match phy mode"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2756 | //force it |
| 2757 | if(eCSR_BAND_24 == pBssConfig->eBand) |
| 2758 | { |
| 2759 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2760 | } |
| 2761 | else |
| 2762 | { |
| 2763 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2764 | } |
| 2765 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2766 | //Qos |
| 2767 | if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) && |
| 2768 | (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos)) |
| 2769 | { |
| 2770 | //Joining BSS is not 11n capable and WMM is disabled on client. |
| 2771 | //Disable QoS and WMM |
| 2772 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2773 | } |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2774 | |
| 2775 | if (((pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11N) || |
Pratik Bhalgat | 8d46164 | 2012-11-22 16:55:42 +0530 | [diff] [blame] | 2776 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC)) && |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2777 | ((pBssConfig->qosType != eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP) || |
| 2778 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_HCF) || |
| 2779 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_eDCF) )) |
| 2780 | { |
| 2781 | //Joining BSS is 11n capable and WMM is disabled on AP. |
| 2782 | //Assume all HT AP's are QOS AP's and enable WMM |
| 2783 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2784 | } |
| 2785 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2786 | //auth type |
| 2787 | switch( pProfile->negotiatedAuthType ) |
| 2788 | { |
| 2789 | default: |
| 2790 | case eCSR_AUTH_TYPE_WPA: |
| 2791 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2792 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2793 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2794 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2795 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2796 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2797 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2798 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2799 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2800 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2801 | break; |
| 2802 | } |
| 2803 | //short slot time |
| 2804 | if( eCSR_CFG_DOT11_MODE_11B != cfgDot11Mode ) |
| 2805 | { |
| 2806 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2807 | } |
| 2808 | else |
| 2809 | { |
| 2810 | pBssConfig->uShortSlotTime = 0; |
| 2811 | } |
| 2812 | if(pBssConfig->BssCap.ibss) |
| 2813 | { |
| 2814 | //We don't support 11h on IBSS |
| 2815 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2816 | } |
| 2817 | else |
| 2818 | { |
| 2819 | pBssConfig->f11hSupport = pMac->roam.configParam.Is11hSupportEnabled; |
| 2820 | } |
| 2821 | //power constraint |
| 2822 | pBssConfig->uPowerLimit = csrGet11hPowerConstraint(pMac, &pIes->PowerConstraints); |
| 2823 | //heartbeat |
| 2824 | if ( CSR_IS_11A_BSS( pBssDesc ) ) |
| 2825 | { |
| 2826 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2827 | } |
| 2828 | else |
| 2829 | { |
| 2830 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 2831 | } |
| 2832 | //Join timeout |
| 2833 | // 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] | 2834 | // be 10 x the BeaconInterval. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2835 | if ( pBssDesc->beaconInterval ) |
| 2836 | { |
| 2837 | //Make sure it is bigger than the minimal |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2838 | 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] | 2839 | } |
| 2840 | else |
| 2841 | { |
| 2842 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
| 2843 | } |
| 2844 | //validate CB |
| 2845 | pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes); |
| 2846 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2847 | return (status); |
| 2848 | } |
| 2849 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2850 | static eHalStatus csrRoamPrepareBssConfigFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2851 | tBssConfigParam *pBssConfig, tSirBssDescription *pBssDesc) |
| 2852 | { |
| 2853 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2854 | tANI_U8 operationChannel = 0; |
| 2855 | tANI_U8 qAPisEnabled = FALSE; |
| 2856 | //SSID |
| 2857 | pBssConfig->SSID.length = 0; |
| 2858 | if(pProfile->SSIDs.numOfSSIDs) |
| 2859 | { |
| 2860 | //only use the first one |
| 2861 | palCopyMemory(pMac->hHdd, &pBssConfig->SSID, &pProfile->SSIDs.SSIDList[0].SSID, sizeof(tSirMacSSid)); |
| 2862 | } |
| 2863 | else |
| 2864 | { |
| 2865 | //SSID must present |
| 2866 | return eHAL_STATUS_FAILURE; |
| 2867 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2868 | //Settomg up the capabilities |
| 2869 | if( csrIsBssTypeIBSS(pProfile->BSSType) ) |
| 2870 | { |
| 2871 | pBssConfig->BssCap.ibss = 1; |
| 2872 | } |
| 2873 | else |
| 2874 | { |
| 2875 | pBssConfig->BssCap.ess = 1; |
| 2876 | } |
| 2877 | if( eCSR_ENCRYPT_TYPE_NONE != pProfile->EncryptionType.encryptionType[0] ) |
| 2878 | { |
| 2879 | pBssConfig->BssCap.privacy = 1; |
| 2880 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2881 | pBssConfig->eBand = pMac->roam.configParam.eBand; |
| 2882 | //phymode |
| 2883 | if(pProfile->ChannelInfo.ChannelList) |
| 2884 | { |
| 2885 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 2886 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2887 | pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, operationChannel, |
| 2888 | &pBssConfig->eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2889 | //QOS |
| 2890 | //Is this correct to always set to this //*** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2891 | if ( pBssConfig->BssCap.ess == 1 ) |
| 2892 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2893 | /*For Softap case enable WMM*/ |
| 2894 | if(CSR_IS_INFRA_AP(pProfile) && (eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode )){ |
| 2895 | qAPisEnabled = TRUE; |
| 2896 | } |
| 2897 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2898 | if (csrRoamGetQosInfoFromBss(pMac, pBssDesc) == eHAL_STATUS_SUCCESS) { |
| 2899 | qAPisEnabled = TRUE; |
| 2900 | } else { |
| 2901 | qAPisEnabled = FALSE; |
| 2902 | } |
| 2903 | } else { |
| 2904 | qAPisEnabled = TRUE; |
| 2905 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2906 | if (( eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && qAPisEnabled) || |
| 2907 | (( eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && qAPisEnabled) || |
| 2908 | ( eCSR_CFG_DOT11_MODE_TAURUS == pBssConfig->uCfgDot11Mode ) ) //For 11n, need QoS |
| 2909 | ) |
| 2910 | { |
| 2911 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2912 | } else { |
| 2913 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2914 | } |
| 2915 | |
| 2916 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 2917 | switch( pProfile->AuthType.authType[0] ) //Take the preferred Auth type. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2918 | { |
| 2919 | default: |
| 2920 | case eCSR_AUTH_TYPE_WPA: |
| 2921 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2922 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2923 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2924 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2925 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2926 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2927 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2928 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2929 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2930 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2931 | break; |
| 2932 | } |
| 2933 | //short slot time |
| 2934 | if( WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode ) |
| 2935 | { |
| 2936 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2937 | } |
| 2938 | else |
| 2939 | { |
| 2940 | pBssConfig->uShortSlotTime = 0; |
| 2941 | } |
| 2942 | //power constraint. We don't support 11h on IBSS |
| 2943 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2944 | pBssConfig->uPowerLimit = 0; |
| 2945 | //heartbeat |
| 2946 | if ( eCSR_BAND_5G == pBssConfig->eBand ) |
| 2947 | { |
| 2948 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2949 | } |
| 2950 | else |
| 2951 | { |
| 2952 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 2953 | } |
| 2954 | //Join timeout |
| 2955 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2956 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2957 | return (status); |
| 2958 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2959 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc) |
| 2960 | { |
| 2961 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2962 | tDot11fBeaconIEs *pIes = NULL; |
| 2963 | |
| 2964 | do |
| 2965 | { |
| 2966 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 2967 | { |
| 2968 | //err msg |
| 2969 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2970 | "csrRoamGetQosInfoFromBss() failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2971 | break; |
| 2972 | } |
| 2973 | //check if the AP is QAP & it supports APSD |
| 2974 | if( CSR_IS_QOS_BSS(pIes) ) |
| 2975 | { |
| 2976 | return eHAL_STATUS_SUCCESS; |
| 2977 | } |
| 2978 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2979 | return status; |
| 2980 | } |
| 2981 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2982 | void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy ) |
| 2983 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2984 | // !! Note: the only difference between this function and the csrSetCfgPrivacyFromProfile() is the |
| 2985 | // setting of the privacy CFG based on the advertised privacy setting from the AP for WPA associations. |
| 2986 | // See !!Note: below in this function... |
| 2987 | tANI_U32 PrivacyEnabled = 0; |
| 2988 | tANI_U32 RsnEnabled = 0; |
| 2989 | tANI_U32 WepDefaultKeyId = 0; |
| 2990 | tANI_U32 WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; /* default 40 bits */ |
| 2991 | tANI_U32 Key0Length = 0; |
| 2992 | tANI_U32 Key1Length = 0; |
| 2993 | tANI_U32 Key2Length = 0; |
| 2994 | tANI_U32 Key3Length = 0; |
| 2995 | |
| 2996 | // Reserve for the biggest key |
| 2997 | tANI_U8 Key0[ WNI_CFG_WEP_DEFAULT_KEY_1_LEN ]; |
| 2998 | tANI_U8 Key1[ WNI_CFG_WEP_DEFAULT_KEY_2_LEN ]; |
| 2999 | tANI_U8 Key2[ WNI_CFG_WEP_DEFAULT_KEY_3_LEN ]; |
| 3000 | tANI_U8 Key3[ WNI_CFG_WEP_DEFAULT_KEY_4_LEN ]; |
| 3001 | |
| 3002 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 3003 | { |
| 3004 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3005 | |
| 3006 | // for NO encryption, turn off Privacy and Rsn. |
| 3007 | PrivacyEnabled = 0; |
| 3008 | RsnEnabled = 0; |
| 3009 | |
| 3010 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 3011 | |
| 3012 | // clear out the WEP keys that may be hanging around. |
| 3013 | Key0Length = 0; |
| 3014 | Key1Length = 0; |
| 3015 | Key2Length = 0; |
| 3016 | Key3Length = 0; |
| 3017 | |
| 3018 | break; |
| 3019 | |
| 3020 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3021 | case eCSR_ENCRYPT_TYPE_WEP40: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3022 | |
| 3023 | // Privacy is ON. NO RSN for Wep40 static key. |
| 3024 | PrivacyEnabled = 1; |
| 3025 | RsnEnabled = 0; |
| 3026 | |
| 3027 | // Set the Wep default key ID. |
| 3028 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3029 | // Wep key size if 5 bytes (40 bits). |
| 3030 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3031 | |
| 3032 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 3033 | if ( pProfile->Keys.KeyLength[0] ) |
| 3034 | { |
| 3035 | palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[0], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 3036 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3037 | } |
| 3038 | else |
| 3039 | { |
| 3040 | Key0Length = 0; |
| 3041 | } |
| 3042 | |
| 3043 | if ( pProfile->Keys.KeyLength[1] ) |
| 3044 | { |
| 3045 | palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[1], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 3046 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3047 | } |
| 3048 | else |
| 3049 | { |
| 3050 | Key1Length = 0; |
| 3051 | } |
| 3052 | |
| 3053 | if ( pProfile->Keys.KeyLength[2] ) |
| 3054 | { |
| 3055 | palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[2], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 3056 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3057 | } |
| 3058 | else |
| 3059 | { |
| 3060 | Key2Length = 0; |
| 3061 | } |
| 3062 | |
| 3063 | if ( pProfile->Keys.KeyLength[3] ) |
| 3064 | { |
| 3065 | palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[3], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 3066 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3067 | } |
| 3068 | else |
| 3069 | { |
| 3070 | Key3Length = 0; |
| 3071 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3072 | break; |
| 3073 | |
| 3074 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3075 | case eCSR_ENCRYPT_TYPE_WEP104: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3076 | |
| 3077 | // Privacy is ON. NO RSN for Wep40 static key. |
| 3078 | PrivacyEnabled = 1; |
| 3079 | RsnEnabled = 0; |
| 3080 | |
| 3081 | // Set the Wep default key ID. |
| 3082 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
| 3083 | |
| 3084 | // Wep key size if 13 bytes (104 bits). |
| 3085 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3086 | |
| 3087 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 3088 | if ( pProfile->Keys.KeyLength[0] ) |
| 3089 | { |
| 3090 | palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[ 0 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 3091 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3092 | } |
| 3093 | else |
| 3094 | { |
| 3095 | Key0Length = 0; |
| 3096 | } |
| 3097 | |
| 3098 | if ( pProfile->Keys.KeyLength[1] ) |
| 3099 | { |
| 3100 | palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[ 1 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 3101 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3102 | } |
| 3103 | else |
| 3104 | { |
| 3105 | Key1Length = 0; |
| 3106 | } |
| 3107 | |
| 3108 | if ( pProfile->Keys.KeyLength[2] ) |
| 3109 | { |
| 3110 | palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[ 2 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 3111 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3112 | } |
| 3113 | else |
| 3114 | { |
| 3115 | Key2Length = 0; |
| 3116 | } |
| 3117 | |
| 3118 | if ( pProfile->Keys.KeyLength[3] ) |
| 3119 | { |
| 3120 | palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[ 3 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 3121 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3122 | } |
| 3123 | else |
| 3124 | { |
| 3125 | Key3Length = 0; |
| 3126 | } |
| 3127 | |
| 3128 | break; |
| 3129 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3130 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3131 | case eCSR_ENCRYPT_TYPE_AES: |
| 3132 | #ifdef FEATURE_WLAN_WAPI |
| 3133 | case eCSR_ENCRYPT_TYPE_WPI: |
| 3134 | #endif /* FEATURE_WLAN_WAPI */ |
| 3135 | // !! Note: this is the only difference between this function and the csrSetCfgPrivacyFromProfile() |
| 3136 | // (setting of the privacy CFG based on the advertised privacy setting from the AP for WPA/WAPI associations ). |
| 3137 | PrivacyEnabled = (0 != fPrivacy); |
| 3138 | |
| 3139 | // turn on RSN enabled for WPA associations |
| 3140 | RsnEnabled = 1; |
| 3141 | |
| 3142 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 3143 | |
| 3144 | // clear out the static WEP keys that may be hanging around. |
| 3145 | Key0Length = 0; |
| 3146 | Key1Length = 0; |
| 3147 | Key2Length = 0; |
| 3148 | Key3Length = 0; |
| 3149 | |
| 3150 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3151 | default: |
| 3152 | PrivacyEnabled = 0; |
| 3153 | RsnEnabled = 0; |
| 3154 | break; |
| 3155 | } |
| 3156 | |
| 3157 | ccmCfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3158 | ccmCfgSetInt(pMac, WNI_CFG_RSN_ENABLED, RsnEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3159 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length, NULL, eANI_BOOLEAN_FALSE); |
| 3160 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length, NULL, eANI_BOOLEAN_FALSE); |
| 3161 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length, NULL, eANI_BOOLEAN_FALSE); |
| 3162 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length, NULL, eANI_BOOLEAN_FALSE); |
| 3163 | ccmCfgSetInt(pMac, WNI_CFG_WEP_KEY_LENGTH, WepKeyLength, NULL, eANI_BOOLEAN_FALSE); |
| 3164 | ccmCfgSetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId, NULL, eANI_BOOLEAN_FALSE); |
| 3165 | } |
| 3166 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3167 | static void csrSetCfgSsid( tpAniSirGlobal pMac, tSirMacSSid *pSSID ) |
| 3168 | { |
| 3169 | tANI_U32 len = 0; |
| 3170 | if(pSSID->length <= WNI_CFG_SSID_LEN) |
| 3171 | { |
| 3172 | len = pSSID->length; |
| 3173 | } |
| 3174 | ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pSSID->ssId, len, NULL, eANI_BOOLEAN_FALSE); |
| 3175 | } |
| 3176 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3177 | eHalStatus csrSetQosToCfg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrMediaAccessType qosType ) |
| 3178 | { |
| 3179 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3180 | tANI_U32 QoSEnabled; |
| 3181 | tANI_U32 WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3182 | // set the CFG enable/disable variables based on the qosType being configured... |
| 3183 | switch( qosType ) |
| 3184 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3185 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p: |
| 3186 | QoSEnabled = FALSE; |
| 3187 | WmeEnabled = TRUE; |
| 3188 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3189 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP: |
| 3190 | QoSEnabled = FALSE; |
| 3191 | WmeEnabled = TRUE; |
| 3192 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3193 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify: |
| 3194 | QoSEnabled = FALSE; |
| 3195 | WmeEnabled = TRUE; |
| 3196 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3197 | case eCSR_MEDIUM_ACCESS_11e_eDCF: |
| 3198 | QoSEnabled = TRUE; |
| 3199 | WmeEnabled = FALSE; |
| 3200 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3201 | case eCSR_MEDIUM_ACCESS_11e_HCF: |
| 3202 | QoSEnabled = TRUE; |
| 3203 | WmeEnabled = FALSE; |
| 3204 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3205 | default: |
| 3206 | case eCSR_MEDIUM_ACCESS_DCF: |
| 3207 | QoSEnabled = FALSE; |
| 3208 | WmeEnabled = FALSE; |
| 3209 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3210 | } |
| 3211 | //save the WMM setting for later use |
| 3212 | pMac->roam.roamSession[sessionId].fWMMConnection = (tANI_BOOLEAN)WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3213 | status = ccmCfgSetInt(pMac, WNI_CFG_QOS_ENABLED, QoSEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3214 | status = ccmCfgSetInt(pMac, WNI_CFG_WME_ENABLED, WmeEnabled, NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3215 | return (status); |
| 3216 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3217 | static eHalStatus csrGetRateSet( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc, |
| 3218 | tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet) |
| 3219 | { |
| 3220 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3221 | int i; |
| 3222 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3223 | tANI_U8 *pDstRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3224 | palZeroMemory(pMac->hHdd, pOpRateSet, sizeof(tSirMacRateSet)); |
| 3225 | palZeroMemory(pMac->hHdd, pExRateSet, sizeof(tSirMacRateSet)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3226 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3227 | |
| 3228 | if( NULL != pIes ) |
| 3229 | { |
| 3230 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3231 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3232 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3233 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3234 | // would blindly put the rates we support into our Operational Rate set |
| 3235 | // (including the basic rates, which we have already verified are |
| 3236 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3237 | // However, it turns out that this is not always the case. Some AP's |
| 3238 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3239 | // too. Now, we're a little more careful: |
| 3240 | pDstRate = pOpRateSet->rate; |
| 3241 | if(pIes->SuppRates.present) |
| 3242 | { |
| 3243 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3244 | { |
| 3245 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) ) |
| 3246 | { |
| 3247 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 3248 | pOpRateSet->numRates++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3249 | } |
| 3250 | } |
| 3251 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3252 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3253 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3254 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3255 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3256 | { |
| 3257 | // If there are Extended Rates in the beacon, we will reflect those |
| 3258 | // extended rates that we support in out Extended Operational Rate |
| 3259 | // set: |
| 3260 | pDstRate = pExRateSet->rate; |
| 3261 | if(pIes->ExtSuppRates.present) |
| 3262 | { |
| 3263 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3264 | { |
| 3265 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) ) |
| 3266 | { |
| 3267 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3268 | pExRateSet->numRates++; |
| 3269 | } |
| 3270 | } |
| 3271 | } |
| 3272 | } |
| 3273 | }//Parsing BSSDesc |
| 3274 | else |
| 3275 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3276 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3277 | } |
| 3278 | if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0) status = eHAL_STATUS_SUCCESS; |
| 3279 | return status; |
| 3280 | } |
| 3281 | |
| 3282 | static void csrSetCfgRateSet( tpAniSirGlobal pMac, eCsrPhyMode phyMode, tCsrRoamProfile *pProfile, |
| 3283 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3284 | { |
| 3285 | int i; |
| 3286 | tANI_U8 *pDstRate; |
| 3287 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3288 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3289 | tANI_U32 OperationalRatesLength = 0; |
| 3290 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3291 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3292 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3293 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3294 | tANI_U32 PropRatesEnable = 0; |
| 3295 | tANI_U8 MCSRateIdxSet[ SIZE_OF_SUPPORTED_MCS_SET ]; |
| 3296 | tANI_U32 MCSRateLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3297 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3298 | if( NULL != pIes ) |
| 3299 | { |
| 3300 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3301 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3302 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3303 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3304 | // would blindly put the rates we support into our Operational Rate set |
| 3305 | // (including the basic rates, which we have already verified are |
| 3306 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3307 | // However, it turns out that this is not always the case. Some AP's |
| 3308 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3309 | // too. Now, we're a little more careful: |
| 3310 | pDstRate = OperationalRates; |
| 3311 | if(pIes->SuppRates.present) |
| 3312 | { |
| 3313 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3314 | { |
| 3315 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) && |
| 3316 | ( OperationalRatesLength < CSR_DOT11_SUPPORTED_RATES_MAX )) |
| 3317 | { |
| 3318 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
| 3319 | OperationalRatesLength++; |
| 3320 | } |
| 3321 | } |
| 3322 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3323 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3324 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3325 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3326 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3327 | { |
| 3328 | // If there are Extended Rates in the beacon, we will reflect those |
| 3329 | // extended rates that we support in out Extended Operational Rate |
| 3330 | // set: |
| 3331 | pDstRate = ExtendedOperationalRates; |
| 3332 | if(pIes->ExtSuppRates.present) |
| 3333 | { |
| 3334 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3335 | { |
| 3336 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) && |
| 3337 | ( ExtendedOperationalRatesLength < CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX )) |
| 3338 | { |
| 3339 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3340 | ExtendedOperationalRatesLength++; |
| 3341 | } |
| 3342 | } |
| 3343 | } |
| 3344 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3345 | // Enable proprietary MAC features if peer node is Airgo node and STA |
| 3346 | // user wants to use them |
| 3347 | if( pIes->Airgo.present && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3348 | { |
| 3349 | PropRatesEnable = 1; |
| 3350 | } |
| 3351 | else |
| 3352 | { |
| 3353 | PropRatesEnable = 0; |
| 3354 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3355 | // For ANI network companions, we need to populate the proprietary rate |
| 3356 | // set with any proprietary rates we found in the beacon, only if user |
| 3357 | // allows them... |
| 3358 | if ( PropRatesEnable && pIes->Airgo.PropSuppRates.present && |
| 3359 | ( pIes->Airgo.PropSuppRates.num_rates > 0 )) |
| 3360 | { |
| 3361 | ProprietaryOperationalRatesLength = pIes->Airgo.PropSuppRates.num_rates; |
| 3362 | if ( ProprietaryOperationalRatesLength > sizeof(ProprietaryOperationalRates) ) |
| 3363 | { |
| 3364 | ProprietaryOperationalRatesLength = sizeof (ProprietaryOperationalRates); |
| 3365 | } |
| 3366 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, pIes->Airgo.PropSuppRates.rates, ProprietaryOperationalRatesLength ); |
| 3367 | } |
| 3368 | else { |
| 3369 | // No proprietary modes... |
| 3370 | ProprietaryOperationalRatesLength = 0; |
| 3371 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3372 | /* Get MCS Rate */ |
| 3373 | pDstRate = MCSRateIdxSet; |
| 3374 | if ( pIes->HTCaps.present ) |
| 3375 | { |
| 3376 | for ( i = 0; i < VALID_MAX_MCS_INDEX; i++ ) |
| 3377 | { |
| 3378 | if ( (unsigned int)pIes->HTCaps.supportedMCSSet[0] & (1 << i) ) |
| 3379 | { |
| 3380 | MCSRateLength++; |
| 3381 | *pDstRate++ = i; |
| 3382 | } |
| 3383 | } |
| 3384 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3385 | // Set the operational rate set CFG variables... |
| 3386 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3387 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3388 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3389 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3390 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3391 | ProprietaryOperationalRates, |
| 3392 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3393 | ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE); |
| 3394 | ccmCfgSetStr(pMac, WNI_CFG_CURRENT_MCS_SET, MCSRateIdxSet, |
| 3395 | MCSRateLength, NULL, eANI_BOOLEAN_FALSE); |
| 3396 | }//Parsing BSSDesc |
| 3397 | else |
| 3398 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3399 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3400 | } |
| 3401 | } |
| 3402 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3403 | static void csrSetCfgRateSetFromProfile( tpAniSirGlobal pMac, |
| 3404 | tCsrRoamProfile *pProfile ) |
| 3405 | { |
| 3406 | tSirMacRateSetIE DefaultSupportedRates11a = { SIR_MAC_RATESET_EID, |
| 3407 | { 8, |
| 3408 | { SIR_MAC_RATE_6, |
| 3409 | SIR_MAC_RATE_9, |
| 3410 | SIR_MAC_RATE_12, |
| 3411 | SIR_MAC_RATE_18, |
| 3412 | SIR_MAC_RATE_24, |
| 3413 | SIR_MAC_RATE_36, |
| 3414 | SIR_MAC_RATE_48, |
| 3415 | SIR_MAC_RATE_54 } } }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3416 | tSirMacRateSetIE DefaultSupportedRates11b = { SIR_MAC_RATESET_EID, |
| 3417 | { 4, |
| 3418 | { SIR_MAC_RATE_1, |
| 3419 | SIR_MAC_RATE_2, |
| 3420 | SIR_MAC_RATE_5_5, |
| 3421 | SIR_MAC_RATE_11 } } }; |
| 3422 | |
| 3423 | |
| 3424 | tSirMacPropRateSet DefaultSupportedPropRates = { 3, |
| 3425 | { SIR_MAC_RATE_72, |
| 3426 | SIR_MAC_RATE_96, |
| 3427 | SIR_MAC_RATE_108 } }; |
| 3428 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3429 | eCsrBand eBand; |
| 3430 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3431 | tANI_U32 OperationalRatesLength = 0; |
| 3432 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3433 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3434 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3435 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3436 | tANI_U32 PropRatesEnable = 0; |
| 3437 | tANI_U8 operationChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3438 | if(pProfile->ChannelInfo.ChannelList) |
| 3439 | { |
| 3440 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 3441 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3442 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3443 | // For 11a networks, the 11a rates go into the Operational Rate set. For 11b and 11g |
| 3444 | // networks, the 11b rates appear in the Operational Rate set. In either case, |
| 3445 | // we can blindly put the rates we support into our Operational Rate set |
| 3446 | // (including the basic rates, which we have already verified are supported |
| 3447 | // earlier in the roaming decision). |
| 3448 | if ( eCSR_BAND_5G == eBand ) |
| 3449 | { |
| 3450 | // 11a rates into the Operational Rate Set. |
| 3451 | OperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3452 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
| 3453 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3454 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3455 | OperationalRatesLength ); |
| 3456 | |
| 3457 | // Nothing in the Extended rate set. |
| 3458 | ExtendedOperationalRatesLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3459 | // populate proprietary rates if user allows them |
| 3460 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3461 | { |
| 3462 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3463 | sizeof(*DefaultSupportedPropRates.propRate); |
| 3464 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, |
| 3465 | DefaultSupportedPropRates.propRate, |
| 3466 | ProprietaryOperationalRatesLength ); |
| 3467 | } |
| 3468 | else |
| 3469 | { |
| 3470 | // No proprietary modes |
| 3471 | ProprietaryOperationalRatesLength = 0; |
| 3472 | } |
| 3473 | } |
| 3474 | else if ( eCSR_CFG_DOT11_MODE_11B == cfgDot11Mode ) |
| 3475 | { |
| 3476 | // 11b rates into the Operational Rate Set. |
| 3477 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3478 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
| 3479 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3480 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3481 | OperationalRatesLength ); |
| 3482 | // Nothing in the Extended rate set. |
| 3483 | ExtendedOperationalRatesLength = 0; |
| 3484 | // No proprietary modes |
| 3485 | ProprietaryOperationalRatesLength = 0; |
| 3486 | } |
| 3487 | else |
| 3488 | { |
| 3489 | // 11G |
| 3490 | |
| 3491 | // 11b rates into the Operational Rate Set. |
| 3492 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3493 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
| 3494 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3495 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3496 | OperationalRatesLength ); |
| 3497 | |
| 3498 | // 11a rates go in the Extended rate set. |
| 3499 | ExtendedOperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3500 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
| 3501 | palCopyMemory( pMac->hHdd, ExtendedOperationalRates, |
| 3502 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3503 | ExtendedOperationalRatesLength ); |
| 3504 | |
| 3505 | // populate proprietary rates if user allows them |
| 3506 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3507 | { |
| 3508 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3509 | sizeof(*DefaultSupportedPropRates.propRate); |
| 3510 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, |
| 3511 | DefaultSupportedPropRates.propRate, |
| 3512 | ProprietaryOperationalRatesLength ); |
| 3513 | } |
| 3514 | else |
| 3515 | { |
| 3516 | // No proprietary modes |
| 3517 | ProprietaryOperationalRatesLength = 0; |
| 3518 | } |
| 3519 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3520 | // set this to 1 if prop. rates need to be advertised in to the IBSS beacon and user wants to use them |
| 3521 | if ( ProprietaryOperationalRatesLength && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3522 | { |
| 3523 | PropRatesEnable = 1; |
| 3524 | } |
| 3525 | else |
| 3526 | { |
| 3527 | PropRatesEnable = 0; |
| 3528 | } |
| 3529 | |
| 3530 | // Set the operational rate set CFG variables... |
| 3531 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3532 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3533 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3534 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3535 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3536 | ProprietaryOperationalRates, |
| 3537 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3538 | 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] | 3539 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3540 | void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result) |
| 3541 | { |
| 3542 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3543 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3544 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 3545 | tANI_U32 sessionId; |
| 3546 | tSmeCmd *pCommand = NULL; |
| 3547 | |
| 3548 | if(NULL == pEntry) |
| 3549 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3550 | smsLog(pMac, LOGW, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3551 | return; |
| 3552 | } |
| 3553 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 3554 | sessionId = pCommand->sessionId; |
| 3555 | |
| 3556 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 3557 | { |
| 3558 | csrRoamingStateConfigCnfProcessor(pMac, (tANI_U32)result); |
| 3559 | } |
| 3560 | } |
| 3561 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3562 | //This function is very dump. It is here because PE still need WNI_CFG_PHY_MODE |
| 3563 | tANI_U32 csrRoamGetPhyModeFromDot11Mode(eCsrCfgDot11Mode dot11Mode, eCsrBand band) |
| 3564 | { |
| 3565 | if(eCSR_CFG_DOT11_MODE_11B == dot11Mode) |
| 3566 | { |
| 3567 | return (WNI_CFG_PHY_MODE_11B); |
| 3568 | } |
| 3569 | else |
| 3570 | { |
| 3571 | if(eCSR_BAND_24 == band) |
| 3572 | return (WNI_CFG_PHY_MODE_11G); |
| 3573 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3574 | return (WNI_CFG_PHY_MODE_11A); |
| 3575 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3576 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3577 | |
| 3578 | #ifdef WLAN_FEATURE_11AC |
| 3579 | ePhyChanBondState csrGetHTCBStateFromVHTCBState(ePhyChanBondState aniCBMode) |
| 3580 | { |
| 3581 | switch ( aniCBMode ) |
| 3582 | { |
| 3583 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 3584 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 3585 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 3586 | return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 3587 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 3588 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 3589 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 3590 | return PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 3591 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3592 | default : |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3593 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 3594 | } |
| 3595 | } |
| 3596 | #endif |
| 3597 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3598 | //pIes may be NULL |
| 3599 | eHalStatus csrRoamSetBssConfigCfg(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3600 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 3601 | tDot11fBeaconIEs *pIes) |
| 3602 | { |
| 3603 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3604 | tANI_U32 cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3605 | tANI_U8 channel = 0; |
| 3606 | //Make sure we have the domain info for the BSS we try to connect to. |
| 3607 | //Do we need to worry about sequence for OSs that are not Windows?? |
| 3608 | if(pBssDesc) |
| 3609 | { |
| 3610 | if(csrLearnCountryInformation(pMac, pBssDesc, pIes, eANI_BOOLEAN_TRUE)) |
| 3611 | { |
| 3612 | //Make sure the 11d info from this BSSDesc can be applied |
| 3613 | pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE; |
| 3614 | csrApplyCountryInformation( pMac, TRUE ); |
| 3615 | } |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3616 | if ((csrIs11dSupported (pMac)) && pIes) |
| 3617 | { |
| 3618 | if (!pIes->Country.present) |
| 3619 | csrResetCountryInformation(pMac, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE ); |
| 3620 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3621 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3622 | //Qos |
| 3623 | csrSetQosToCfg( pMac, sessionId, pBssConfig->qosType ); |
| 3624 | //SSID |
| 3625 | csrSetCfgSsid(pMac, &pBssConfig->SSID ); |
| 3626 | //fragment threshold |
| 3627 | //ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3628 | //RTS threshold |
| 3629 | //ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3630 | |
| 3631 | //ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, csrTranslateToWNICfgDot11Mode(pMac, pBssConfig->uCfgDot11Mode), NULL, eANI_BOOLEAN_FALSE); |
| 3632 | |
| 3633 | //Auth type |
| 3634 | ccmCfgSetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType, NULL, eANI_BOOLEAN_FALSE); |
| 3635 | //encryption type |
| 3636 | csrSetCfgPrivacy(pMac, pProfile, (tANI_BOOLEAN)pBssConfig->BssCap.privacy ); |
| 3637 | //short slot time |
| 3638 | 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] | 3639 | //11d |
| 3640 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 3641 | ((pBssConfig->f11hSupport) ? pBssConfig->f11hSupport : pProfile->ieee80211d), |
| 3642 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3643 | /*//11h |
| 3644 | ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3645 | */ |
| 3646 | ccmCfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, pBssConfig->uPowerLimit, NULL, eANI_BOOLEAN_FALSE); |
| 3647 | //CB |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3648 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 3649 | if(CSR_IS_INFRA_AP(pProfile) || CSR_IS_WDS_AP(pProfile) || CSR_IS_IBSS(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3650 | { |
| 3651 | channel = pProfile->operationChannel; |
| 3652 | } |
| 3653 | else |
| 3654 | { |
| 3655 | if(pBssDesc) |
| 3656 | { |
| 3657 | channel = pBssDesc->channelId; |
| 3658 | } |
| 3659 | } |
| 3660 | if(0 != channel) |
| 3661 | { |
| 3662 | if(CSR_IS_CHANNEL_24GHZ(channel)) |
| 3663 | {//for now if we are on 2.4 Ghz, CB will be always disabled |
| 3664 | cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3665 | } |
| 3666 | else |
| 3667 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3668 | cfgCb = pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3669 | } |
| 3670 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3671 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | a0d8893 | 2012-11-13 10:51:26 -0800 | [diff] [blame] | 3672 | // cbMode = 1 in cfg.ini is mapped to PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 3673 | // in function csrConvertCBIniValueToPhyCBState() |
| 3674 | // So, max value for cbMode in 40MHz mode is 3 (MAC\src\include\sirParams.h) |
| 3675 | if(cfgCb > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3676 | { |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3677 | if(!WDA_getFwWlanFeatCaps(DOT11AC)) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3678 | cfgCb = csrGetHTCBStateFromVHTCBState(cfgCb); |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3679 | } |
| 3680 | else |
| 3681 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3682 | ccmCfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, pMac->roam.configParam.nVhtChannelWidth, NULL, eANI_BOOLEAN_FALSE); |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3683 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3684 | } |
| 3685 | else |
| 3686 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3687 | ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, cfgCb, NULL, eANI_BOOLEAN_FALSE); |
| 3688 | //Rate |
| 3689 | //Fixed Rate |
| 3690 | if(pBssDesc) |
| 3691 | { |
| 3692 | csrSetCfgRateSet(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile, pBssDesc, pIes); |
| 3693 | } |
| 3694 | else |
| 3695 | { |
| 3696 | csrSetCfgRateSetFromProfile(pMac, pProfile); |
| 3697 | } |
| 3698 | //Make this the last CFG to set. The callback will trigger a join_req |
| 3699 | //Join time out |
| 3700 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId ); |
| 3701 | |
| 3702 | 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] | 3703 | return (status); |
| 3704 | } |
| 3705 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3706 | eHalStatus csrRoamStopNetwork( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3707 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3708 | { |
| 3709 | eHalStatus status; |
| 3710 | tBssConfigParam *pBssConfig; |
| 3711 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3712 | |
| 3713 | if(!pSession) |
| 3714 | { |
| 3715 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3716 | return eHAL_STATUS_FAILURE; |
| 3717 | } |
| 3718 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3719 | status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); |
| 3720 | if(HAL_STATUS_SUCCESS(status)) |
| 3721 | { |
| 3722 | palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam)); |
| 3723 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, pBssConfig, pIes); |
| 3724 | if(HAL_STATUS_SUCCESS(status)) |
| 3725 | { |
| 3726 | pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3727 | /* This will allow to pass cbMode during join req */ |
| 3728 | pSession->bssParams.cbMode= pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3729 | //For IBSS, we need to prepare some more information |
| 3730 | if( csrIsBssTypeIBSS(pProfile->BSSType) || CSR_IS_WDS( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3731 | || CSR_IS_INFRA_AP(pProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3732 | ) |
| 3733 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3734 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3735 | } |
| 3736 | // If we are in an IBSS, then stop the IBSS... |
| 3737 | ////Not worry about WDS connection for now |
| 3738 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 3739 | { |
| 3740 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 3741 | } |
| 3742 | else |
| 3743 | { |
| 3744 | // if we are in an Infrastructure association.... |
| 3745 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 3746 | { |
| 3747 | // and the new Bss is an Ibss OR we are roaming from Infra to Infra |
| 3748 | // across SSIDs (roaming to a new SSID)... // |
| 3749 | //Not worry about WDS connection for now |
| 3750 | if ( pBssDesc && ( ( csrIsIbssBssDesc( pBssDesc ) ) || |
| 3751 | !csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIes ) ) ) |
| 3752 | { |
| 3753 | // then we need to disassociate from the Infrastructure network... |
| 3754 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 3755 | } |
| 3756 | else |
| 3757 | { |
| 3758 | // In an Infrastucture and going to an Infrastructure network with the same SSID. This |
| 3759 | // calls for a Reassociation sequence. So issue the CFG sets for this new AP. |
| 3760 | if ( pBssDesc ) |
| 3761 | { |
| 3762 | // Set parameters for this Bss. |
| 3763 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
| 3764 | } |
| 3765 | } |
| 3766 | } |
| 3767 | else |
| 3768 | { |
| 3769 | // Neiher in IBSS nor in Infra. We can go ahead and set the CFG for tne new network... |
| 3770 | // Nothing to stop. |
| 3771 | if ( pBssDesc || CSR_IS_WDS_AP( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3772 | || CSR_IS_INFRA_AP(pProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3773 | ) |
| 3774 | { |
| 3775 | // Set parameters for this Bss. |
| 3776 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
| 3777 | } |
| 3778 | } |
| 3779 | } |
| 3780 | }//Success getting BSS config info |
| 3781 | palFreeMemory(pMac->hHdd, pBssConfig); |
| 3782 | }//Allocate memory |
| 3783 | |
| 3784 | return (status); |
| 3785 | } |
| 3786 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3787 | eCsrJoinState csrRoamJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3788 | tCsrScanResultInfo *pScanResult, tCsrRoamProfile *pProfile ) |
| 3789 | { |
| 3790 | eCsrJoinState eRoamState = eCsrContinueRoaming; |
| 3791 | eHalStatus status; |
| 3792 | tSirBssDescription *pBssDesc = &pScanResult->BssDescriptor; |
| 3793 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)( pScanResult->pvIes ); //This may be NULL |
| 3794 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3795 | |
| 3796 | if(!pSession) |
| 3797 | { |
| 3798 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3799 | return (eCsrStopRoaming); |
| 3800 | } |
| 3801 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3802 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 3803 | { |
| 3804 | status = csrRoamStartWds( pMac, sessionId, pProfile, pBssDesc ); |
| 3805 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 3806 | { |
| 3807 | eRoamState = eCsrStopRoaming; |
| 3808 | } |
| 3809 | } |
| 3810 | else |
| 3811 | { |
| 3812 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 3813 | { |
| 3814 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
| 3815 | return (eCsrStopRoaming); |
| 3816 | } |
| 3817 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 3818 | { |
| 3819 | // If we are connected in infrastructure mode and the Join Bss description is for the same BssID, then we are |
| 3820 | // attempting to join the AP we are already connected with. In that case, see if the Bss or Sta capabilities |
| 3821 | // have changed and handle the changes (without disturbing the current association). |
| 3822 | |
| 3823 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && |
| 3824 | csrIsBssIdEqual( pMac, pBssDesc, pSession->pConnectBssDesc ) && |
| 3825 | csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIesLocal ) |
| 3826 | ) |
| 3827 | { |
| 3828 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 3829 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 3830 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 3831 | // a new Association. |
| 3832 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 3833 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3834 | smsLog(pMac, LOGW, FL(" detect same profile authType = %d encryType = %d"), pProfile->AuthType, pProfile->EncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3835 | if(csrRoamIsSameProfileKeys(pMac, &pSession->connectedProfile, pProfile)) |
| 3836 | { |
| 3837 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 3838 | } |
| 3839 | else |
| 3840 | { |
| 3841 | tBssConfigParam bssConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3842 | //The key changes |
| 3843 | palZeroMemory(pMac->hHdd, &bssConfig, sizeof(bssConfig)); |
| 3844 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 3845 | if(HAL_STATUS_SUCCESS(status)) |
| 3846 | { |
| 3847 | pSession->bssParams.uCfgDot11Mode = bssConfig.uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3848 | pSession->bssParams.cbMode = bssConfig.cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3849 | //Reapply the config including Keys so reassoc is happening. |
| 3850 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 3851 | if(!HAL_STATUS_SUCCESS(status)) |
| 3852 | { |
| 3853 | eRoamState = eCsrStopRoaming; |
| 3854 | } |
| 3855 | } |
| 3856 | else |
| 3857 | { |
| 3858 | eRoamState = eCsrStopRoaming; |
| 3859 | } |
| 3860 | }//same profile |
| 3861 | } |
| 3862 | else |
| 3863 | { |
| 3864 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, sessionId, |
| 3865 | eCSR_ROAM_SUBSTATE_DISASSOC_REQ, FALSE ))) |
| 3866 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3867 | smsLog(pMac, LOGW, FL(" fail to issue disassociate")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3868 | eRoamState = eCsrStopRoaming; |
| 3869 | } |
| 3870 | } |
| 3871 | } |
| 3872 | else |
| 3873 | { |
| 3874 | // note: we used to pre-auth here with open authentication networks but that was not working so well. |
| 3875 | // we had a lot of join timeouts when testing at Samsung. removing this step helped associations |
| 3876 | // work much better. |
| 3877 | // |
| 3878 | // |
| 3879 | // stop the existing network before attempting to join the new network... |
| 3880 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 3881 | { |
| 3882 | eRoamState = eCsrStopRoaming; |
| 3883 | } |
| 3884 | } |
| 3885 | }//Infra |
| 3886 | else |
| 3887 | { |
| 3888 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 3889 | { |
| 3890 | eRoamState = eCsrStopRoaming; |
| 3891 | } |
| 3892 | } |
| 3893 | if( pIesLocal && !pScanResult->pvIes ) |
| 3894 | { |
| 3895 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 3896 | } |
| 3897 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3898 | return( eRoamState ); |
| 3899 | } |
| 3900 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3901 | eHalStatus csrRoamShouldRoam(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3902 | tSirBssDescription *pBssDesc, tANI_U32 roamId) |
| 3903 | { |
| 3904 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3905 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3906 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 3907 | roamInfo.pBssDesc = pBssDesc; |
| 3908 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, roamId, eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE); |
| 3909 | return (status); |
| 3910 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3911 | //In case no matching BSS is found, use whatever default we can find |
| 3912 | static void csrRoamAssignDefaultParam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 3913 | { |
| 3914 | //Need to get all negotiated types in place first |
| 3915 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 3916 | switch( pCommand->u.roamCmd.roamProfile.AuthType.authType[0] ) //Take the preferred Auth type. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3917 | { |
| 3918 | default: |
| 3919 | case eCSR_AUTH_TYPE_WPA: |
| 3920 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 3921 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 3922 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3923 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 3924 | break; |
| 3925 | |
| 3926 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 3927 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 3928 | break; |
| 3929 | |
| 3930 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 3931 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 3932 | break; |
| 3933 | } |
| 3934 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 3935 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 3936 | //In this case, the multicast encryption needs to follow the uncast ones. |
| 3937 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 3938 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 3939 | } |
| 3940 | |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 3941 | |
| 3942 | static void csrSetAbortRoamingCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 3943 | { |
| 3944 | switch(pCommand->u.roamCmd.roamReason) |
| 3945 | { |
| 3946 | case eCsrLostLink1: |
| 3947 | pCommand->u.roamCmd.roamReason = eCsrLostLink1Abort; |
| 3948 | break; |
| 3949 | case eCsrLostLink2: |
| 3950 | pCommand->u.roamCmd.roamReason = eCsrLostLink2Abort; |
| 3951 | break; |
| 3952 | case eCsrLostLink3: |
| 3953 | pCommand->u.roamCmd.roamReason = eCsrLostLink3Abort; |
| 3954 | break; |
| 3955 | default: |
| 3956 | smsLog(pMac, LOGE, FL(" aborting roaming reason %d not recognized"), |
| 3957 | pCommand->u.roamCmd.roamReason); |
| 3958 | break; |
| 3959 | } |
| 3960 | } |
| 3961 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3962 | static eCsrJoinState csrRoamJoinNextBss( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fUseSameBss ) |
| 3963 | { |
| 3964 | eHalStatus status; |
| 3965 | tCsrScanResult *pScanResult = NULL; |
| 3966 | eCsrJoinState eRoamState = eCsrStopRoaming; |
| 3967 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 3968 | tANI_BOOLEAN fDone = eANI_BOOLEAN_FALSE; |
| 3969 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 3970 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 3971 | v_U8_t acm_mask = 0; |
| 3972 | #endif |
| 3973 | tANI_U32 sessionId = pCommand->sessionId; |
| 3974 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 3975 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 3976 | tANI_U8 concurrentChannel = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3977 | |
| 3978 | if(!pSession) |
| 3979 | { |
| 3980 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3981 | return (eCsrStopRoaming); |
| 3982 | } |
| 3983 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3984 | do |
| 3985 | { |
| 3986 | // Check for Cardbus eject condition, before trying to Roam to any BSS |
| 3987 | //***if( !balIsCardPresent(pAdapter) ) break; |
| 3988 | |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 3989 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 3990 | memcpy (&roamInfo.bssid, &pSession->joinFailStatusCode.bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3991 | if(NULL != pBSSList) |
| 3992 | { |
| 3993 | // When handling AP's capability change, continue to associate to |
| 3994 | // same BSS and make sure pRoamBssEntry is not Null. |
| 3995 | if((eANI_BOOLEAN_FALSE == fUseSameBss) || (pCommand->u.roamCmd.pRoamBssEntry == NULL)) |
| 3996 | { |
| 3997 | if(pCommand->u.roamCmd.pRoamBssEntry == NULL) |
| 3998 | { |
| 3999 | //Try the first BSS |
| 4000 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4001 | pCommand->u.roamCmd.pRoamBssEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 4002 | } |
| 4003 | else |
| 4004 | { |
| 4005 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 4006 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 4007 | { |
| 4008 | //Done with all the BSSs |
| 4009 | //In this case, will tell HDD the completion |
| 4010 | break; |
| 4011 | } |
| 4012 | else |
| 4013 | { |
| 4014 | //We need to indicate to HDD that we are done with this one. |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 4015 | //palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4016 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; //this shall not be NULL |
| 4017 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4018 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4019 | pRoamInfo = &roamInfo; |
| 4020 | } |
| 4021 | } |
| 4022 | while(pCommand->u.roamCmd.pRoamBssEntry) |
| 4023 | { |
| 4024 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4025 | /*If concurrency enabled take the concurrent connected channel first. */ |
| 4026 | /* Valid multichannel concurrent sessions exempted */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4027 | if (vos_concurrent_sessions_running() && |
| 4028 | !csrIsValidMcConcurrentSession(pMac, sessionId, &pScanResult->Result.BssDescriptor)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4029 | { |
| 4030 | concurrentChannel = |
| 4031 | csrGetConcurrentOperationChannel(pMac); |
| 4032 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4033 | " csr Concurrent Channel = %d", __func__, concurrentChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4034 | if ((concurrentChannel) && |
| 4035 | (concurrentChannel == |
| 4036 | pScanResult->Result.BssDescriptor.channelId)) |
| 4037 | { |
| 4038 | //make this 0 because we do not want the |
| 4039 | //below check to pass as we don't want to |
| 4040 | //connect on other channel |
| 4041 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 4042 | FL("Concurrent channel match =%d"), |
| 4043 | concurrentChannel); |
| 4044 | concurrentChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4045 | } |
| 4046 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4047 | |
| 4048 | if (!concurrentChannel) |
| 4049 | { |
| 4050 | |
| 4051 | if(HAL_STATUS_SUCCESS(csrRoamShouldRoam(pMac, |
| 4052 | sessionId, &pScanResult->Result.BssDescriptor, |
| 4053 | pCommand->u.roamCmd.roamId))) |
| 4054 | { |
| 4055 | //Ok to roam this |
| 4056 | break; |
| 4057 | } |
| 4058 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4059 | else |
| 4060 | { |
| 4061 | eRoamState = eCsrStopRoamingDueToConcurrency; |
| 4062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4063 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 4064 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 4065 | { |
| 4066 | //Done with all the BSSs |
| 4067 | fDone = eANI_BOOLEAN_TRUE; |
| 4068 | break; |
| 4069 | } |
| 4070 | } |
| 4071 | if(fDone) |
| 4072 | { |
| 4073 | break; |
| 4074 | } |
| 4075 | } |
| 4076 | } |
| 4077 | //We have something to roam, tell HDD when it is infra. |
| 4078 | //For IBSS, the indication goes back to HDD via eCSR_ROAM_IBSS_IND |
| 4079 | //For WDS, the indication is eCSR_ROAM_WDS_IND |
| 4080 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 4081 | { |
| 4082 | if(pRoamInfo) |
| 4083 | { |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4084 | if(pSession->bRefAssocStartCnt) |
| 4085 | { |
| 4086 | pSession->bRefAssocStartCnt--; |
| 4087 | //Complete the last association attemp because a new one is about to be tried |
| 4088 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4089 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4090 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4091 | } |
| 4092 | } |
| 4093 | /* If the roaming has stopped, not to continue the roaming command*/ |
| 4094 | if ( !CSR_IS_ROAMING(pSession) && CSR_IS_ROAMING_COMMAND(pCommand) ) |
| 4095 | { |
| 4096 | //No need to complete roaming here as it already completes |
| 4097 | smsLog(pMac, LOGW, FL(" Roam command (reason %d) aborted due to roaming completed"), |
| 4098 | pCommand->u.roamCmd.roamReason); |
| 4099 | eRoamState = eCsrStopRoaming; |
| 4100 | csrSetAbortRoamingCommand(pMac, pCommand); |
| 4101 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4102 | } |
| 4103 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 4104 | if(pScanResult) |
| 4105 | { |
| 4106 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4107 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->Result.BssDescriptor, &pIesLocal))) ) |
| 4108 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4109 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4110 | fDone = eANI_BOOLEAN_TRUE; |
| 4111 | eRoamState = eCsrStopRoaming; |
| 4112 | break; |
| 4113 | } |
| 4114 | roamInfo.pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4115 | pCommand->u.roamCmd.pLastRoamBss = roamInfo.pBssDesc; |
| 4116 | //No need to put uapsd_mask in if the BSS doesn't support uAPSD |
| 4117 | if( pCommand->u.roamCmd.roamProfile.uapsd_mask && |
| 4118 | CSR_IS_QOS_BSS(pIesLocal) && |
| 4119 | CSR_IS_UAPSD_BSS(pIesLocal) ) |
| 4120 | { |
| 4121 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4122 | acm_mask = sme_QosGetACMMask(pMac, &pScanResult->Result.BssDescriptor, |
| 4123 | pIesLocal); |
| 4124 | pCommand->u.roamCmd.roamProfile.uapsd_mask &= ~(acm_mask); |
| 4125 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4126 | } |
| 4127 | else |
| 4128 | { |
| 4129 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 4130 | } |
| 4131 | if( pIesLocal && !pScanResult->Result.pvIes) |
| 4132 | { |
| 4133 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 4134 | } |
| 4135 | } |
| 4136 | else |
| 4137 | { |
| 4138 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 4139 | } |
| 4140 | roamInfo.pProfile = pProfile; |
| 4141 | pSession->bRefAssocStartCnt++; |
| 4142 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4143 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4144 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4145 | if ( NULL == pCommand->u.roamCmd.pRoamBssEntry ) |
| 4146 | { |
| 4147 | // If this is a start IBSS profile, then we need to start the IBSS. |
| 4148 | if ( CSR_IS_START_IBSS(pProfile) ) |
| 4149 | { |
| 4150 | tANI_BOOLEAN fSameIbss = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4151 | // Attempt to start this IBSS... |
| 4152 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 4153 | status = csrRoamStartIbss( pMac, sessionId, pProfile, &fSameIbss ); |
| 4154 | if(HAL_STATUS_SUCCESS(status)) |
| 4155 | { |
| 4156 | if ( fSameIbss ) |
| 4157 | { |
| 4158 | eRoamState = eCsrStartIbssSameIbss; |
| 4159 | } |
| 4160 | else |
| 4161 | { |
| 4162 | eRoamState = eCsrContinueRoaming; |
| 4163 | } |
| 4164 | } |
| 4165 | else |
| 4166 | { |
| 4167 | //it somehow fail need to stop |
| 4168 | eRoamState = eCsrStopRoaming; |
| 4169 | } |
| 4170 | break; |
| 4171 | } |
| 4172 | else if ( (CSR_IS_WDS_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4173 | || (CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4174 | ) |
| 4175 | { |
| 4176 | // Attempt to start this WDS... |
| 4177 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 4178 | /* For AP WDS, we dont have any BSSDescription */ |
| 4179 | status = csrRoamStartWds( pMac, sessionId, pProfile, NULL ); |
| 4180 | if(HAL_STATUS_SUCCESS(status)) |
| 4181 | { |
| 4182 | eRoamState = eCsrContinueRoaming; |
| 4183 | } |
| 4184 | else |
| 4185 | { |
| 4186 | //it somehow fail need to stop |
| 4187 | eRoamState = eCsrStopRoaming; |
| 4188 | } |
| 4189 | } |
| 4190 | else |
| 4191 | { |
| 4192 | //Nothing we can do |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4193 | smsLog(pMac, LOGW, FL("cannot continue without BSS list")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4194 | eRoamState = eCsrStopRoaming; |
| 4195 | break; |
| 4196 | } |
| 4197 | } |
| 4198 | else //We have BSS |
| 4199 | { |
| 4200 | //Need to assign these value because they are used in csrIsSameProfile |
| 4201 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4202 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = pScanResult->ucEncryptionType; //Negotiated while building scan result. |
| 4203 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = pScanResult->mcEncryptionType; |
| 4204 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = pScanResult->authType; |
| 4205 | if ( CSR_IS_START_IBSS(&pCommand->u.roamCmd.roamProfile) ) |
| 4206 | { |
| 4207 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 4208 | { |
| 4209 | eRoamState = eCsrStartIbssSameIbss; |
| 4210 | break; |
| 4211 | } |
| 4212 | } |
| 4213 | if( pCommand->u.roamCmd.fReassocToSelfNoCapChange ) |
| 4214 | { |
| 4215 | //trying to connect to the one already connected |
| 4216 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_FALSE; |
| 4217 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 4218 | break; |
| 4219 | } |
| 4220 | // Attempt to Join this Bss... |
| 4221 | eRoamState = csrRoamJoin( pMac, sessionId, &pScanResult->Result, pProfile ); |
| 4222 | break; |
| 4223 | } |
| 4224 | |
| 4225 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4226 | if( (eCsrStopRoaming == eRoamState) && (CSR_IS_INFRASTRUCTURE( pProfile )) ) |
| 4227 | { |
| 4228 | //Need to indicate association_completion if association_start has been done |
| 4229 | if(pSession->bRefAssocStartCnt > 0) |
| 4230 | { |
| 4231 | pSession->bRefAssocStartCnt--; |
| 4232 | //Complete the last association attemp because a new one is about to be tried |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 4233 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4234 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4235 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 4236 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 4237 | } |
| 4238 | } |
| 4239 | |
| 4240 | return( eRoamState ); |
| 4241 | } |
| 4242 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4243 | static eHalStatus csrRoam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4244 | { |
| 4245 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4246 | eCsrJoinState RoamState; |
| 4247 | tANI_U32 sessionId = pCommand->sessionId; |
| 4248 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4249 | //***if( hddIsRadioStateOn( pAdapter ) ) |
| 4250 | { |
| 4251 | // Attept to join a Bss... |
| 4252 | RoamState = csrRoamJoinNextBss( pMac, pCommand, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4253 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4254 | // if nothing to join.. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4255 | if (( eCsrStopRoaming == RoamState ) || ( eCsrStopRoamingDueToConcurrency == RoamState)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4256 | { |
| 4257 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4258 | // and if connected in Infrastructure mode... |
| 4259 | if ( csrIsConnStateInfra(pMac, sessionId) ) |
| 4260 | { |
| 4261 | //... then we need to issue a disassociation |
| 4262 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, FALSE ); |
| 4263 | if(!HAL_STATUS_SUCCESS(status)) |
| 4264 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4265 | smsLog(pMac, LOGW, FL(" failed to issue disassociate, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4266 | //roam command is completed by caller in the failed case |
| 4267 | fComplete = eANI_BOOLEAN_TRUE; |
| 4268 | } |
| 4269 | } |
| 4270 | else if( csrIsConnStateIbss(pMac, sessionId) ) |
| 4271 | { |
| 4272 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4273 | if(!HAL_STATUS_SUCCESS(status)) |
| 4274 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4275 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4276 | //roam command is completed by caller in the failed case |
| 4277 | fComplete = eANI_BOOLEAN_TRUE; |
| 4278 | } |
| 4279 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4280 | else if (csrIsConnStateConnectedInfraAp(pMac, sessionId)) |
| 4281 | { |
| 4282 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4283 | if(!HAL_STATUS_SUCCESS(status)) |
| 4284 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4285 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4286 | //roam command is completed by caller in the failed case |
| 4287 | fComplete = eANI_BOOLEAN_TRUE; |
| 4288 | } |
| 4289 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4290 | else |
| 4291 | { |
| 4292 | fComplete = eANI_BOOLEAN_TRUE; |
| 4293 | } |
| 4294 | if(fComplete) |
| 4295 | { |
| 4296 | // ... otherwise, we can complete the Roam command here. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4297 | if(eCsrStopRoamingDueToConcurrency == RoamState) |
| 4298 | { |
| 4299 | csrRoamComplete( pMac, eCsrJoinFailureDueToConcurrency, NULL ); |
| 4300 | } |
| 4301 | else |
| 4302 | { |
| 4303 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 4304 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4305 | } |
| 4306 | } |
| 4307 | else if ( eCsrReassocToSelfNoCapChange == RoamState ) |
| 4308 | { |
| 4309 | csrRoamComplete( pMac, eCsrSilentlyStopRoamingSaveState, NULL ); |
| 4310 | } |
| 4311 | else if ( eCsrStartIbssSameIbss == RoamState ) |
| 4312 | { |
| 4313 | csrRoamComplete( pMac, eCsrSilentlyStopRoaming, NULL ); |
| 4314 | } |
| 4315 | }//hddIsRadioStateOn |
| 4316 | |
| 4317 | return status; |
| 4318 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4319 | eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4320 | { |
| 4321 | tANI_U32 sessionId; |
| 4322 | tCsrRoamSession *pSession; |
| 4323 | tCsrScanResult *pScanResult = NULL; |
| 4324 | tSirBssDescription *pBssDesc = NULL; |
| 4325 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4326 | sessionId = pCommand->sessionId; |
| 4327 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4328 | |
| 4329 | if(!pSession) |
| 4330 | { |
| 4331 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4332 | return eHAL_STATUS_FAILURE; |
| 4333 | } |
| 4334 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4335 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 4336 | { |
| 4337 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4338 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4339 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4340 | return eHAL_STATUS_FAILURE; |
| 4341 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4342 | if (pCommand->u.roamCmd.pRoamBssEntry) |
| 4343 | { |
| 4344 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4345 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4346 | } |
| 4347 | else |
| 4348 | { |
| 4349 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4350 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4351 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4352 | return eHAL_STATUS_FAILURE; |
| 4353 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4354 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 4355 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 4356 | return status; |
| 4357 | } |
| 4358 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4359 | eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4360 | { |
| 4361 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4362 | tCsrRoamInfo roamInfo; |
| 4363 | tANI_U32 sessionId = pCommand->sessionId; |
| 4364 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4365 | |
| 4366 | if(!pSession) |
| 4367 | { |
| 4368 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4369 | return eHAL_STATUS_FAILURE; |
| 4370 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4371 | |
| 4372 | switch ( pCommand->u.roamCmd.roamReason ) |
| 4373 | { |
| 4374 | case eCsrForcedDisassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4375 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4376 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4377 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4378 | case eCsrSmeIssuedDisassocForHandoff: |
| 4379 | //Not to free pMac->roam.pCurRoamProfile (via csrFreeRoamProfile) because it is needed after disconnect |
| 4380 | #if 0 // TODO : Confirm this change |
| 4381 | status = csrRoamProcessDisassociate( pMac, pCommand, FALSE ); |
| 4382 | #else |
| 4383 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 4384 | #endif |
| 4385 | |
| 4386 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4387 | case eCsrForcedDisassocMICFailure: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4388 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, TRUE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4389 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4390 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4391 | case eCsrForcedDeauth: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4392 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, FALSE, FALSE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4393 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4394 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4395 | case eCsrHddIssuedReassocToSameAP: |
| 4396 | case eCsrSmeIssuedReassocToSameAP: |
| 4397 | { |
| 4398 | tDot11fBeaconIEs *pIes = NULL; |
| 4399 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4400 | if( pSession->pConnectBssDesc ) |
| 4401 | { |
| 4402 | status = csrGetParsedBssDescriptionIEs(pMac, pSession->pConnectBssDesc, &pIes); |
| 4403 | if(!HAL_STATUS_SUCCESS(status) ) |
| 4404 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4405 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4406 | } |
| 4407 | else |
| 4408 | { |
| 4409 | roamInfo.reasonCode = eCsrRoamReasonStaCapabilityChanged; |
| 4410 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
| 4411 | pSession->roamingReason = eCsrReassocRoaming; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4412 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 4413 | roamInfo.pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4414 | pSession->bRefAssocStartCnt++; |
| 4415 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4416 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4417 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4418 | smsLog(pMac, LOG1, FL(" calling csrRoamIssueReassociate")); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4419 | status = csrRoamIssueReassociate( pMac, sessionId, pSession->pConnectBssDesc, pIes, |
| 4420 | &pCommand->u.roamCmd.roamProfile ); |
| 4421 | if(!HAL_STATUS_SUCCESS(status)) |
| 4422 | { |
| 4423 | smsLog(pMac, LOGE, FL("csrRoamIssueReassociate failed with status %d"), status); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 4424 | csrReleaseCommandRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4425 | } |
| 4426 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4427 | palFreeMemory(pMac->hHdd, pIes); |
| 4428 | pIes = NULL; |
| 4429 | } |
| 4430 | } |
| 4431 | break; |
| 4432 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4433 | case eCsrCapsChange: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4434 | smsLog(pMac, LOGE, FL("received eCsrCapsChange ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4435 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4436 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE); |
| 4437 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4438 | case eCsrSmeIssuedFTReassoc: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4439 | smsLog(pMac, LOGE, FL("received FT Reassoc Req ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4440 | status = csrProcessFTReassocRoamCommand(pMac, pCommand); |
| 4441 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4442 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4443 | case eCsrStopBss: |
| 4444 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4445 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4446 | break; |
| 4447 | |
| 4448 | case eCsrForcedDisassocSta: |
| 4449 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4450 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId); |
| 4451 | status = csrSendMBDisassocReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4452 | pCommand->u.roamCmd.reason); |
| 4453 | break; |
| 4454 | |
| 4455 | case eCsrForcedDeauthSta: |
| 4456 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4457 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId); |
| 4458 | status = csrSendMBDeauthReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4459 | pCommand->u.roamCmd.reason); |
| 4460 | break; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4461 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4462 | case eCsrPerformPreauth: |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 4463 | smsLog(pMac, LOG1, FL("Attempting FT PreAuth Req")); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4464 | status = csrRoamIssueFTPreauthReq(pMac, sessionId, |
| 4465 | pCommand->u.roamCmd.pLastRoamBss); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4466 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4467 | |
| 4468 | default: |
| 4469 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4470 | |
| 4471 | if( pCommand->u.roamCmd.fUpdateCurRoamProfile ) |
| 4472 | { |
| 4473 | //Remember the roaming profile |
| 4474 | csrFreeRoamProfile(pMac, sessionId); |
| 4475 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)))) |
| 4476 | { |
| 4477 | palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 4478 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, &pCommand->u.roamCmd.roamProfile); |
| 4479 | } |
| 4480 | } |
| 4481 | |
| 4482 | //At this point, original uapsd_mask is saved in pCurRoamProfile |
| 4483 | //uapsd_mask in the pCommand may change from this point on. |
| 4484 | |
| 4485 | // Attempt to roam with the new scan results (if we need to..) |
| 4486 | status = csrRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4487 | if(!HAL_STATUS_SUCCESS(status)) |
| 4488 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4489 | smsLog(pMac, LOGW, FL("csrRoam() failed with status = 0x%08X"), status); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4490 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4491 | break; |
| 4492 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4493 | return (status); |
| 4494 | } |
| 4495 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4496 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4497 | { |
| 4498 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4499 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4500 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
| 4501 | palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd)); |
| 4502 | } |
| 4503 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4504 | void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4505 | { |
| 4506 | if(pCommand->u.roamCmd.fReleaseBssList) |
| 4507 | { |
| 4508 | csrScanResultPurge(pMac, pCommand->u.roamCmd.hBSSList); |
| 4509 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 4510 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 4511 | } |
| 4512 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 4513 | { |
| 4514 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 4515 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 4516 | } |
| 4517 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4518 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
| 4519 | palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd)); |
| 4520 | } |
| 4521 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4522 | void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4523 | { |
| 4524 | palZeroMemory(pMac->hHdd, &pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd)); |
| 4525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4526 | void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context ) |
| 4527 | { |
| 4528 | tListElem *pEntry; |
| 4529 | tSmeCmd *pCommand; |
| 4530 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4531 | smsLog( pMac, LOG2, "Roam Completion ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4532 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 4533 | if ( pEntry ) |
| 4534 | { |
| 4535 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4536 | // If the head of the queue is Active and it is a ROAM command, remove |
| 4537 | // and put this on the Free queue. |
| 4538 | if ( eSmeCommandRoam == pCommand->command ) |
| 4539 | { |
| 4540 | //we need to process the result first before removing it from active list because state changes |
| 4541 | //still happening insides roamQProcessRoamResults so no other roam command should be issued |
| 4542 | fReleaseCommand = csrRoamProcessResults( pMac, pCommand, Result, Context ); |
| 4543 | if( fReleaseCommand ) |
| 4544 | { |
| 4545 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 4546 | { |
| 4547 | csrReleaseCommandRoam( pMac, pCommand ); |
| 4548 | } |
| 4549 | else |
| 4550 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4551 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4552 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4553 | } |
| 4554 | } |
| 4555 | else |
| 4556 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4557 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4558 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4559 | } |
| 4560 | } |
| 4561 | else |
| 4562 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4563 | smsLog( pMac, LOGW, "CSR: Roam Completion called but ROAM command is not ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4564 | } |
| 4565 | } |
| 4566 | else |
| 4567 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4568 | smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4569 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4570 | if( fReleaseCommand ) |
| 4571 | { |
| 4572 | smeProcessPendingQueue( pMac ); |
| 4573 | } |
| 4574 | } |
| 4575 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4576 | void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4577 | { |
| 4578 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4579 | if(!pSession) |
| 4580 | { |
| 4581 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4582 | return; |
| 4583 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4584 | palZeroMemory( pMac->hHdd, &(pSession->PmkidCandidateInfo[0]), sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED ); |
| 4585 | pSession->NumPmkidCandidate = 0; |
| 4586 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4587 | #ifdef FEATURE_WLAN_WAPI |
| 4588 | void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4589 | { |
| 4590 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4591 | if(!pSession) |
| 4592 | { |
| 4593 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4594 | return; |
| 4595 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4596 | palZeroMemory( pMac->hHdd, &(pSession->BkidCandidateInfo[0]), sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED ); |
| 4597 | pSession->NumBkidCandidate = 0; |
| 4598 | } |
| 4599 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4600 | extern tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ]; |
| 4601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4602 | static eHalStatus csrRoamSaveSecurityRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrAuthType authType, |
| 4603 | tSirBssDescription *pSirBssDesc, |
| 4604 | tDot11fBeaconIEs *pIes) |
| 4605 | { |
| 4606 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4607 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4608 | tDot11fBeaconIEs *pIesLocal = pIes; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4609 | |
| 4610 | if(!pSession) |
| 4611 | { |
| 4612 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4613 | return eHAL_STATUS_FAILURE; |
| 4614 | } |
| 4615 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4616 | if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4617 | (eCSR_AUTH_TYPE_WPA_PSK == authType) || |
| 4618 | (eCSR_AUTH_TYPE_RSN == authType) || |
| 4619 | (eCSR_AUTH_TYPE_RSN_PSK == authType) |
| 4620 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4621 | || |
| 4622 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4623 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) |
| 4624 | #endif /* FEATURE_WLAN_WAPI */ |
| 4625 | #ifdef FEATURE_WLAN_WAPI |
| 4626 | || |
| 4627 | (eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4628 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType) |
| 4629 | #endif /* FEATURE_WLAN_WAPI */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4630 | #ifdef WLAN_FEATURE_11W |
| 4631 | || |
| 4632 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) |
| 4633 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4634 | ) |
| 4635 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4636 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 4637 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4638 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4639 | } |
| 4640 | if( pIesLocal ) |
| 4641 | { |
| 4642 | tANI_U32 nIeLen; |
| 4643 | tANI_U8 *pIeBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4644 | if((eCSR_AUTH_TYPE_RSN == authType) || |
| 4645 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4646 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4647 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) || |
| 4648 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4649 | #if defined WLAN_FEATURE_11W |
| 4650 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) || |
| 4651 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4652 | (eCSR_AUTH_TYPE_RSN_PSK == authType)) |
| 4653 | { |
| 4654 | if(pIesLocal->RSN.present) |
| 4655 | { |
| 4656 | //Calculate the actual length |
| 4657 | nIeLen = 8 //version + gp_cipher_suite + pwise_cipher_suite_count |
| 4658 | + pIesLocal->RSN.pwise_cipher_suite_count * 4 //pwise_cipher_suites |
| 4659 | + 2 //akm_suite_count |
| 4660 | + pIesLocal->RSN.akm_suite_count * 4 //akm_suites |
| 4661 | + 2; //reserved |
| 4662 | if( pIesLocal->RSN.pmkid_count ) |
| 4663 | { |
| 4664 | nIeLen += 2 + pIesLocal->RSN.pmkid_count * 4; //pmkid |
| 4665 | } |
| 4666 | //nIeLen doesn't count EID and length fields |
| 4667 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2)))) |
| 4668 | { |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 4669 | palZeroMemory(pMac->hHdd, pSession->pWpaRsnRspIE, nIeLen + 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4670 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_RSN; |
| 4671 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4672 | //copy upto akm_suites |
| 4673 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 4674 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.version, sizeof(pIesLocal->RSN.version)); |
| 4675 | pIeBuf += sizeof(pIesLocal->RSN.version); |
| 4676 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.gp_cipher_suite, sizeof(pIesLocal->RSN.gp_cipher_suite)); |
| 4677 | pIeBuf += sizeof(pIesLocal->RSN.gp_cipher_suite); |
| 4678 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.pwise_cipher_suite_count, sizeof(pIesLocal->RSN.pwise_cipher_suite_count)); |
| 4679 | pIeBuf += sizeof(pIesLocal->RSN.pwise_cipher_suite_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4680 | if( pIesLocal->RSN.pwise_cipher_suite_count ) |
| 4681 | { |
| 4682 | //copy pwise_cipher_suites |
| 4683 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.pwise_cipher_suites, |
| 4684 | pIesLocal->RSN.pwise_cipher_suite_count * 4); |
| 4685 | pIeBuf += pIesLocal->RSN.pwise_cipher_suite_count * 4; |
| 4686 | } |
| 4687 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.akm_suite_count, 2); |
| 4688 | pIeBuf += 2; |
| 4689 | if( pIesLocal->RSN.akm_suite_count ) |
| 4690 | { |
| 4691 | //copy akm_suites |
| 4692 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites, |
| 4693 | pIesLocal->RSN.akm_suite_count * 4); |
| 4694 | pIeBuf += pIesLocal->RSN.akm_suite_count * 4; |
| 4695 | } |
| 4696 | //copy the rest |
| 4697 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites + |
| 4698 | pIesLocal->RSN.akm_suite_count * 4, |
| 4699 | 2 + pIesLocal->RSN.pmkid_count * 4); |
| 4700 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4701 | } |
| 4702 | } |
| 4703 | } |
| 4704 | else if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4705 | (eCSR_AUTH_TYPE_WPA_PSK == authType)) |
| 4706 | { |
| 4707 | if(pIesLocal->WPA.present) |
| 4708 | { |
| 4709 | //Calculate the actual length |
| 4710 | nIeLen = 12 //OUI + version + multicast_cipher + unicast_cipher_count |
| 4711 | + pIesLocal->WPA.unicast_cipher_count * 4 //unicast_ciphers |
| 4712 | + 2 //auth_suite_count |
| 4713 | + pIesLocal->WPA.auth_suite_count * 4; //auth_suites |
| 4714 | // The WPA capabilities follows the Auth Suite (two octects)-- |
| 4715 | // this field is optional, and we always "send" zero, so just |
| 4716 | // remove it. This is consistent with our assumptions in the |
| 4717 | // frames compiler; c.f. bug 15234: |
| 4718 | //nIeLen doesn't count EID and length fields |
| 4719 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2)))) |
| 4720 | { |
| 4721 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_WPA; |
| 4722 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4723 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 4724 | //Copy WPA OUI |
| 4725 | palCopyMemory(pMac->hHdd, pIeBuf, &csrWpaOui[1], 4); |
| 4726 | pIeBuf += 4; |
| 4727 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.version, 8 + |
| 4728 | pIesLocal->WPA.unicast_cipher_count * 4); |
| 4729 | pIeBuf += 8 + pIesLocal->WPA.unicast_cipher_count * 4; |
| 4730 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.auth_suite_count, 2 + |
| 4731 | pIesLocal->WPA.auth_suite_count * 4); |
| 4732 | pIeBuf += pIesLocal->WPA.auth_suite_count * 4; |
| 4733 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4734 | } |
| 4735 | } |
| 4736 | } |
| 4737 | #ifdef FEATURE_WLAN_WAPI |
| 4738 | else if((eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4739 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType)) |
| 4740 | { |
| 4741 | if(pIesLocal->WAPI.present) |
| 4742 | { |
| 4743 | //Calculate the actual length |
| 4744 | nIeLen = 4 //version + akm_suite_count |
| 4745 | + pIesLocal->WAPI.akm_suite_count * 4 // akm_suites |
| 4746 | + 2 //pwise_cipher_suite_count |
| 4747 | + pIesLocal->WAPI.unicast_cipher_suite_count * 4 //pwise_cipher_suites |
| 4748 | + 6; //gp_cipher_suite + preauth + reserved |
| 4749 | if( pIesLocal->WAPI.bkid_count ) |
| 4750 | { |
| 4751 | nIeLen += 2 + pIesLocal->WAPI.bkid_count * 4; //bkid |
| 4752 | } |
| 4753 | |
| 4754 | //nIeLen doesn't count EID and length fields |
| 4755 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiRspIE, nIeLen + 2)))) |
| 4756 | { |
| 4757 | pSession->pWapiRspIE[0] = DOT11F_EID_WAPI; |
| 4758 | pSession->pWapiRspIE[1] = (tANI_U8)nIeLen; |
| 4759 | pIeBuf = pSession->pWapiRspIE + 2; |
| 4760 | //copy upto akm_suite_count |
| 4761 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.version, 4); |
| 4762 | pIeBuf += 4; |
| 4763 | if( pIesLocal->WAPI.akm_suite_count ) |
| 4764 | { |
| 4765 | //copy akm_suites |
| 4766 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.akm_suites, |
| 4767 | pIesLocal->WAPI.akm_suite_count * 4); |
| 4768 | pIeBuf += pIesLocal->WAPI.akm_suite_count * 4; |
| 4769 | } |
| 4770 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.unicast_cipher_suite_count, 2); |
| 4771 | pIeBuf += 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4772 | if( pIesLocal->WAPI.unicast_cipher_suite_count ) |
| 4773 | { |
| 4774 | //copy pwise_cipher_suites |
| 4775 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.unicast_cipher_suites, |
| 4776 | pIesLocal->WAPI.unicast_cipher_suite_count * 4); |
| 4777 | pIeBuf += pIesLocal->WAPI.unicast_cipher_suite_count * 4; |
| 4778 | } |
| 4779 | //gp_cipher_suite + preauth + reserved + bkid_count |
| 4780 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.multicast_cipher_suite, 8); |
| 4781 | pIeBuf += 8; |
| 4782 | if( pIesLocal->WAPI.bkid_count ) |
| 4783 | { |
| 4784 | //copy akm_suites |
| 4785 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.bkid, pIesLocal->WAPI.bkid_count * 4); |
| 4786 | pIeBuf += pIesLocal->WAPI.bkid_count * 4; |
| 4787 | } |
| 4788 | pSession->nWapiRspIeLength = nIeLen + 2; |
| 4789 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4790 | } |
| 4791 | } |
| 4792 | #endif /* FEATURE_WLAN_WAPI */ |
| 4793 | if( !pIes ) |
| 4794 | { |
| 4795 | //locally allocated |
| 4796 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 4797 | } |
| 4798 | } |
| 4799 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4800 | return (status); |
| 4801 | } |
| 4802 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4803 | static void csrCheckAndUpdateACWeight( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIEs ) |
| 4804 | { |
| 4805 | v_U8_t bACWeights[WLANTL_MAX_AC]; |
| 4806 | v_U8_t paramBk, paramBe, paramVi, paramVo; |
| 4807 | v_BOOL_t fWeightChange = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4808 | //Compare two ACs' EDCA parameters, from low to high (BK, BE, VI, VO) |
| 4809 | //The "formula" is, if lower AC's AIFSN+CWMin is bigger than a fixed amount |
| 4810 | //of the higher AC one, make the higher AC has the same weight as the lower AC. |
| 4811 | //This doesn't address the case where the lower AC needs a real higher weight |
| 4812 | if( pIEs->WMMParams.present ) |
| 4813 | { |
| 4814 | //no change to the lowest ones |
| 4815 | bACWeights[WLANTL_AC_BK] = pMac->roam.ucACWeights[WLANTL_AC_BK]; |
| 4816 | bACWeights[WLANTL_AC_BE] = pMac->roam.ucACWeights[WLANTL_AC_BE]; |
| 4817 | bACWeights[WLANTL_AC_VI] = pMac->roam.ucACWeights[WLANTL_AC_VI]; |
| 4818 | bACWeights[WLANTL_AC_VO] = pMac->roam.ucACWeights[WLANTL_AC_VO]; |
| 4819 | paramBk = pIEs->WMMParams.acbk_aifsn + pIEs->WMMParams.acbk_acwmin; |
| 4820 | paramBe = pIEs->WMMParams.acbe_aifsn + pIEs->WMMParams.acbe_acwmin; |
| 4821 | paramVi = pIEs->WMMParams.acvi_aifsn + pIEs->WMMParams.acvi_acwmin; |
| 4822 | paramVo = pIEs->WMMParams.acvo_aifsn + pIEs->WMMParams.acvo_acwmin; |
| 4823 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramBe) ) |
| 4824 | { |
| 4825 | bACWeights[WLANTL_AC_BE] = bACWeights[WLANTL_AC_BK]; |
| 4826 | fWeightChange = VOS_TRUE; |
| 4827 | } |
| 4828 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVi) ) |
| 4829 | { |
| 4830 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BK]; |
| 4831 | fWeightChange = VOS_TRUE; |
| 4832 | } |
| 4833 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVi) ) |
| 4834 | { |
| 4835 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BE]; |
| 4836 | fWeightChange = VOS_TRUE; |
| 4837 | } |
| 4838 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVo) ) |
| 4839 | { |
| 4840 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BK]; |
| 4841 | fWeightChange = VOS_TRUE; |
| 4842 | } |
| 4843 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVo) ) |
| 4844 | { |
| 4845 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BE]; |
| 4846 | fWeightChange = VOS_TRUE; |
| 4847 | } |
| 4848 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramVi, paramVo) ) |
| 4849 | { |
| 4850 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_VI]; |
| 4851 | fWeightChange = VOS_TRUE; |
| 4852 | } |
| 4853 | if(fWeightChange) |
| 4854 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4855 | smsLog(pMac, LOGE, FL(" change AC weights (%d-%d-%d-%d)"), bACWeights[0], bACWeights[1], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4856 | bACWeights[2], bACWeights[3]); |
| 4857 | WLANTL_SetACWeights(pMac->roam.gVosContext, bACWeights); |
| 4858 | } |
| 4859 | } |
| 4860 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4861 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4862 | //Returns whether the current association is a 11r assoc or not |
| 4863 | tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac) |
| 4864 | { |
| 4865 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4866 | return csrNeighborRoamIs11rAssoc(pMac); |
| 4867 | #else |
| 4868 | return eANI_BOOLEAN_FALSE; |
| 4869 | #endif |
| 4870 | } |
| 4871 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4872 | #ifdef FEATURE_WLAN_CCX |
| 4873 | //Returns whether the current association is a CCX assoc or not |
| 4874 | tANI_BOOLEAN csrRoamIsCCXAssoc(tpAniSirGlobal pMac) |
| 4875 | { |
| 4876 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4877 | return csrNeighborRoamIsCCXAssoc(pMac); |
| 4878 | #else |
| 4879 | return eANI_BOOLEAN_FALSE; |
| 4880 | #endif |
| 4881 | } |
| 4882 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4883 | #ifdef FEATURE_WLAN_LFR |
| 4884 | //Returns whether "Legacy Fast Roaming" is currently enabled...or not |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4885 | tANI_BOOLEAN csrRoamIsFastRoamEnabled(tpAniSirGlobal pMac, tANI_U32 sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4886 | { |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4887 | tCsrRoamSession *pSession = NULL; |
| 4888 | |
| 4889 | if (CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 4890 | { |
| 4891 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4892 | if (NULL != pSession->pCurRoamProfile) |
| 4893 | { |
| 4894 | if (pSession->pCurRoamProfile->csrPersona != VOS_STA_MODE) |
| 4895 | { |
| 4896 | return eANI_BOOLEAN_FALSE; |
| 4897 | } |
| 4898 | } |
| 4899 | } |
| 4900 | |
Madan Mohan Koyyalamudi | 9ce36ec | 2012-10-15 16:03:17 -0700 | [diff] [blame] | 4901 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled && |
Madan Mohan Koyyalamudi | 393a434 | 2012-10-15 16:07:09 -0700 | [diff] [blame] | 4902 | (!csrIsConcurrentSessionRunning(pMac))); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4903 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4904 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 4905 | //Returns whether "FW based BG scan" is currently enabled...or not |
| 4906 | tANI_BOOLEAN csrRoamIsRoamOffloadScanEnabled(tpAniSirGlobal pMac) |
| 4907 | { |
| 4908 | return (pMac->roam.configParam.isRoamOffloadScanEnabled); |
| 4909 | } |
| 4910 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4911 | #endif |
| 4912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4913 | //Return true means the command can be release, else not |
| 4914 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 4915 | eCsrRoamCompleteResult Result, void *Context ) |
| 4916 | { |
| 4917 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
| 4918 | tSirBssDescription *pSirBssDesc = NULL; |
| 4919 | tSirMacAddr BroadcastMac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 4920 | tCsrScanResult *pScanResult = NULL; |
| 4921 | tCsrRoamInfo roamInfo; |
| 4922 | sme_QosAssocInfo assocInfo; |
| 4923 | sme_QosCsrEventIndType ind_qos;//indication for QoS module in SME |
| 4924 | tANI_U8 acm_mask = 0; //HDD needs the ACM mask in the assoc rsp callback |
| 4925 | tDot11fBeaconIEs *pIes = NULL; |
| 4926 | tANI_U32 sessionId = pCommand->sessionId; |
| 4927 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4928 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4929 | eRoamCmdStatus roamStatus; |
| 4930 | eCsrRoamResult roamResult; |
| 4931 | eHalStatus status; |
| 4932 | tANI_U32 key_timeout_interval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4933 | tSirSmeStartBssRsp *pSmeStartBssRsp = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4934 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4935 | if(!pSession) |
| 4936 | { |
| 4937 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4938 | return eANI_BOOLEAN_FALSE; |
| 4939 | } |
| 4940 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4941 | smsLog( pMac, LOG1, FL("Processing ROAM results...")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4942 | switch( Result ) |
| 4943 | { |
| 4944 | case eCsrJoinSuccess: |
| 4945 | // reset the IDLE timer |
| 4946 | // !! |
| 4947 | // !! fall through to the next CASE statement here is intentional !! |
| 4948 | // !! |
| 4949 | case eCsrReassocSuccess: |
| 4950 | if(eCsrReassocSuccess == Result) |
| 4951 | { |
| 4952 | ind_qos = SME_QOS_CSR_REASSOC_COMPLETE; |
| 4953 | } |
| 4954 | else |
| 4955 | { |
| 4956 | ind_qos = SME_QOS_CSR_ASSOC_COMPLETE; |
| 4957 | } |
| 4958 | // Success Join Response from LIM. Tell NDIS we are connected and save the |
| 4959 | // Connected state... |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4960 | smsLog(pMac, LOGW, FL("receives association indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4961 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 4962 | //always free the memory here |
| 4963 | if(pSession->pWpaRsnRspIE) |
| 4964 | { |
| 4965 | pSession->nWpaRsnRspIeLength = 0; |
| 4966 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE); |
| 4967 | pSession->pWpaRsnRspIE = NULL; |
| 4968 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4969 | #ifdef FEATURE_WLAN_WAPI |
| 4970 | if(pSession->pWapiRspIE) |
| 4971 | { |
| 4972 | pSession->nWapiRspIeLength = 0; |
| 4973 | palFreeMemory(pMac->hHdd, pSession->pWapiRspIE); |
| 4974 | pSession->pWapiRspIE = NULL; |
| 4975 | } |
| 4976 | #endif /* FEATURE_WLAN_WAPI */ |
| 4977 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 4978 | //Reset counter so no join retry is needed. |
| 4979 | pSession->maxRetryCount = 0; |
| 4980 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 4981 | #endif |
| 4982 | /* This creates problem since we have not saved the connected profile. |
| 4983 | So moving this after saving the profile |
| 4984 | */ |
| 4985 | //csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED ); |
| 4986 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 4987 | { |
| 4988 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
| 4989 | } |
| 4990 | else |
| 4991 | { |
| 4992 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED; |
| 4993 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4994 | //Use the last connected bssdesc for reassoc-ing to the same AP. |
| 4995 | //NOTE: What to do when reassoc to a different AP??? |
| 4996 | if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) || |
| 4997 | (eCsrSmeIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ) |
| 4998 | { |
| 4999 | pSirBssDesc = pSession->pConnectBssDesc; |
| 5000 | if(pSirBssDesc) |
| 5001 | { |
| 5002 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 5003 | } |
| 5004 | } |
| 5005 | else |
| 5006 | { |
| 5007 | |
| 5008 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5009 | { |
| 5010 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 5011 | if(pScanResult != NULL) |
| 5012 | { |
| 5013 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5014 | //this can be NULL |
| 5015 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 5016 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 5017 | } |
| 5018 | } |
| 5019 | } |
| 5020 | if( pSirBssDesc ) |
| 5021 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5022 | roamInfo.staId = HAL_STA_INVALID_IDX; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5023 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 5024 | //Save WPA/RSN IE |
| 5025 | csrRoamSaveSecurityRspIE(pMac, sessionId, pProfile->negotiatedAuthType, pSirBssDesc, pIes); |
| 5026 | #ifdef FEATURE_WLAN_CCX |
| 5027 | roamInfo.isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
| 5028 | #endif |
| 5029 | |
| 5030 | // csrRoamStateChange also affects sub-state. Hence, csrRoamStateChange happens first and then |
| 5031 | // substate change. |
| 5032 | // Moving even save profile above so that below mentioned conditon is also met. |
| 5033 | // JEZ100225: Moved to after saving the profile. Fix needed in main/latest |
| 5034 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5035 | // Make sure the Set Context is issued before link indication to NDIS. After link indication is |
| 5036 | // made to NDIS, frames could start flowing. If we have not set context with LIM, the frames |
| 5037 | // will be dropped for the security context may not be set properly. |
| 5038 | // |
| 5039 | // this was causing issues in the 2c_wlan_wep WHQL test when the SetContext was issued after the link |
| 5040 | // indication. (Link Indication happens in the profFSMSetConnectedInfra call). |
| 5041 | // |
| 5042 | // this reordering was done on titan_prod_usb branch and is being replicated here. |
| 5043 | // |
| 5044 | |
| 5045 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && |
| 5046 | !pProfile->bWPSAssociation) |
| 5047 | { |
| 5048 | // Issue the set Context request to LIM to establish the Unicast STA context |
| 5049 | if( !HAL_STATUS_SUCCESS( csrRoamIssueSetContextReq( pMac, sessionId, |
| 5050 | pProfile->negotiatedUCEncryptionType, |
| 5051 | pSirBssDesc, &(pSirBssDesc->bssId), |
| 5052 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ) ) ) // NO keys... these key parameters don't matter. |
| 5053 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5054 | smsLog( pMac, LOGE, FL(" Set context for unicast fail") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5055 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 5056 | } |
| 5057 | // Issue the set Context request to LIM to establish the Broadcast STA context |
| 5058 | csrRoamIssueSetContextReq( pMac, sessionId, pProfile->negotiatedMCEncryptionType, |
| 5059 | pSirBssDesc, &BroadcastMac, |
| 5060 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5061 | } |
| 5062 | else |
| 5063 | { |
| 5064 | //Need to wait for supplicant authtication |
| 5065 | roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5066 | //Set the subestate to WaitForKey in case authentiation is needed |
| 5067 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId ); |
| 5068 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5069 | if(pProfile->bWPSAssociation) |
| 5070 | { |
| 5071 | key_timeout_interval = CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD; |
| 5072 | } |
| 5073 | else |
| 5074 | { |
| 5075 | key_timeout_interval = CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD; |
| 5076 | } |
| 5077 | |
| 5078 | //Save sessionId in case of timeout |
| 5079 | pMac->roam.WaitForKeyTimerInfo.sessionId = (tANI_U8)sessionId; |
| 5080 | //This time should be long enough for the rest of the process plus setting key |
| 5081 | if(!HAL_STATUS_SUCCESS( csrRoamStartWaitForKeyTimer( pMac, key_timeout_interval ) ) ) |
| 5082 | { |
| 5083 | //Reset our state so nothting is blocked. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5084 | smsLog( pMac, LOGE, FL(" Failed to start pre-auth timer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5085 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 5086 | } |
| 5087 | } |
| 5088 | |
| 5089 | assocInfo.pBssDesc = pSirBssDesc; //could be NULL |
| 5090 | assocInfo.pProfile = pProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5091 | if(Context) |
| 5092 | { |
| 5093 | tSirSmeJoinRsp *pJoinRsp = (tSirSmeJoinRsp *)Context; |
| 5094 | tANI_U32 len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5095 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5096 | len = pJoinRsp->assocReqLength + pJoinRsp->assocRspLength + pJoinRsp->beaconLength; |
| 5097 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5098 | len += pJoinRsp->parsedRicRspLen; |
| 5099 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 5100 | #ifdef FEATURE_WLAN_CCX |
| 5101 | len += pJoinRsp->tspecIeLen; |
| 5102 | #endif |
| 5103 | if(len) |
| 5104 | { |
| 5105 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 5106 | (void **)&pSession->connectedInfo.pbFrames, len))) |
| 5107 | { |
| 5108 | if(HAL_STATUS_SUCCESS( palCopyMemory(pMac->hHdd, |
| 5109 | pSession->connectedInfo.pbFrames, pJoinRsp->frames, len) )) |
| 5110 | { |
| 5111 | pSession->connectedInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 5112 | pSession->connectedInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 5113 | pSession->connectedInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 5114 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5115 | pSession->connectedInfo.nRICRspLength = pJoinRsp->parsedRicRspLen; |
| 5116 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 5117 | #ifdef FEATURE_WLAN_CCX |
| 5118 | pSession->connectedInfo.nTspecIeLength = pJoinRsp->tspecIeLen; |
| 5119 | #endif |
| 5120 | roamInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 5121 | roamInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 5122 | roamInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 5123 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5124 | } |
| 5125 | else |
| 5126 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5127 | smsLog(pMac, LOGE, "%s: Copying of memory failed for %d bytes !!!", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5128 | __func__, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5129 | palFreeMemory( pMac->hHdd, pSession->connectedInfo.pbFrames ); |
| 5130 | pSession->connectedInfo.pbFrames = NULL; |
| 5131 | } |
| 5132 | } |
| 5133 | } |
| 5134 | if(pCommand->u.roamCmd.fReassoc) |
| 5135 | { |
| 5136 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 5137 | } |
| 5138 | pSession->connectedInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 5139 | roamInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 5140 | roamInfo.ucastSig = ( tANI_U8 )pJoinRsp->ucastSig; |
| 5141 | roamInfo.bcastSig = ( tANI_U8 )pJoinRsp->bcastSig; |
| 5142 | } |
| 5143 | else |
| 5144 | { |
| 5145 | if(pCommand->u.roamCmd.fReassoc) |
| 5146 | { |
| 5147 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 5148 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5149 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5150 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5151 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5152 | } |
| 5153 | } |
| 5154 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5155 | // Indicate SME-QOS with reassoc success event, only after |
| 5156 | // copying the frames |
| 5157 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, ind_qos, &assocInfo); |
| 5158 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5159 | roamInfo.pBssDesc = pSirBssDesc; |
| 5160 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5161 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5162 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5163 | acm_mask = sme_QosGetACMMask(pMac, pSirBssDesc, NULL); |
| 5164 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 5165 | pSession->connectedProfile.acm_mask = acm_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5166 | //start UAPSD if uapsd_mask is not 0 because HDD will configure for trigger frame |
| 5167 | //It may be better to let QoS do this???? |
| 5168 | if( pSession->connectedProfile.modifyProfileFields.uapsd_mask ) |
| 5169 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5170 | smsLog(pMac, LOGE, " uapsd_mask (0x%X) set, request UAPSD now", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5171 | pSession->connectedProfile.modifyProfileFields.uapsd_mask); |
| 5172 | pmcStartUapsd( pMac, NULL, NULL ); |
| 5173 | } |
Gopichand Nakkala | dacbcb5 | 2013-04-18 16:41:54 +0530 | [diff] [blame] | 5174 | pSession->connectedProfile.dot11Mode = pSession->bssParams.uCfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5175 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5176 | if( pSession->bRefAssocStartCnt > 0 ) |
| 5177 | { |
| 5178 | pSession->bRefAssocStartCnt--; |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5179 | //Remove this code once SLM_Sessionization is supported |
| 5180 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5181 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5182 | { |
| 5183 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5184 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5185 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5186 | } |
| 5187 | |
| 5188 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_NONE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5189 | // reset the PMKID candidate list |
| 5190 | csrResetPMKIDCandidateList( pMac, sessionId ); |
| 5191 | //Update TL's AC weight base on the current EDCA parameters |
| 5192 | //These parameters may change in the course of the connection, that sictuation |
| 5193 | //is not taken care here. This change is mainly to address a WIFI WMM test where |
| 5194 | //BE has a equal or higher TX priority than VI. |
| 5195 | //We only do this for infra link |
| 5196 | if( csrIsConnStateConnectedInfra(pMac, sessionId ) && pIes ) |
| 5197 | { |
| 5198 | csrCheckAndUpdateACWeight(pMac, pIes); |
| 5199 | } |
| 5200 | #ifdef FEATURE_WLAN_WAPI |
| 5201 | // reset the BKID candidate list |
| 5202 | csrResetBKIDCandidateList( pMac, sessionId ); |
| 5203 | #endif /* FEATURE_WLAN_WAPI */ |
| 5204 | } |
| 5205 | else |
| 5206 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5207 | smsLog(pMac, LOGW, " Roam command doesn't have a BSS desc"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5208 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5209 | csrScanCancelIdleScan(pMac); |
| 5210 | //Not to signal link up because keys are yet to be set. |
| 5211 | //The linkup function will overwrite the sub-state that we need to keep at this point. |
| 5212 | if( !CSR_IS_WAIT_FOR_KEY(pMac, sessionId) ) |
| 5213 | { |
| 5214 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 5215 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5216 | //Check if BMPS is required and start the BMPS retry timer. Timer period is large |
| 5217 | //enough to let security and DHCP handshake succeed before entry into BMPS |
| 5218 | if (pmcShouldBmpsTimerRun(pMac)) |
| 5219 | { |
| 5220 | if (pmcStartTrafficTimer(pMac, BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP) |
| 5221 | != eHAL_STATUS_SUCCESS) |
| 5222 | { |
| 5223 | smsLog(pMac, LOGP, FL("Cannot start BMPS Retry timer")); |
| 5224 | } |
| 5225 | smsLog(pMac, LOG2, FL("BMPS Retry Timer already running or started")); |
| 5226 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5227 | break; |
| 5228 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5229 | case eCsrStartBssSuccess: |
| 5230 | // on the StartBss Response, LIM is returning the Bss Description that we |
| 5231 | // are beaconing. Add this Bss Description to our scan results and |
| 5232 | // chain the Profile to this Bss Description. On a Start BSS, there was no |
| 5233 | // detected Bss description (no partner) so we issued the Start Bss to |
| 5234 | // start the Ibss without any Bss description. Lim was kind enough to return |
| 5235 | // the Bss Description that we start beaconing for the newly started Ibss. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5236 | smsLog(pMac, LOG2, FL("receives start BSS ok indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5237 | status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5238 | pSmeStartBssRsp = (tSirSmeStartBssRsp *)Context; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5239 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5240 | if( CSR_IS_IBSS( pProfile ) ) |
| 5241 | { |
| 5242 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 5243 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5244 | else if (CSR_IS_INFRA_AP(pProfile)) |
| 5245 | { |
| 5246 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 5247 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5248 | else |
| 5249 | { |
| 5250 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 5251 | } |
| 5252 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 5253 | { |
| 5254 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5255 | pSirBssDesc = &pSmeStartBssRsp->bssDescription; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5256 | if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs( pMac, pSirBssDesc, &pIes )) ) |
| 5257 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5258 | smsLog(pMac, LOG2, FL("cannot parse IBSS IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5259 | roamInfo.pBssDesc = pSirBssDesc; |
| 5260 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5261 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5262 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_START_FAILED ); |
| 5263 | break; |
| 5264 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5265 | if (!CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5266 | { |
| 5267 | pScanResult = csrScanAppendBssDescription( pMac, pSirBssDesc, pIes ); |
| 5268 | } |
| 5269 | csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
| 5270 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5271 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5272 | if(pSirBssDesc) |
| 5273 | { |
| 5274 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 5275 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 5276 | } |
| 5277 | //We are doen with the IEs so free it |
| 5278 | palFreeMemory(pMac->hHdd, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5279 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5280 | { |
| 5281 | vos_log_ibss_pkt_type *pIbssLog; |
| 5282 | tANI_U32 bi; |
| 5283 | |
| 5284 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5285 | if(pIbssLog) |
| 5286 | { |
| 5287 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 5288 | { |
| 5289 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5290 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_RSP; |
| 5291 | } |
| 5292 | else |
| 5293 | { |
| 5294 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_RSP; |
| 5295 | } |
| 5296 | if(pSirBssDesc) |
| 5297 | { |
| 5298 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pSirBssDesc->bssId, 6); |
| 5299 | pIbssLog->operatingChannel = pSirBssDesc->channelId; |
| 5300 | } |
| 5301 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 5302 | { |
| 5303 | //***U8 is not enough for beacon interval |
| 5304 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 5305 | } |
| 5306 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5307 | } |
| 5308 | } |
| 5309 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5310 | //Only set context for non-WDS_STA. We don't even need it for WDS_AP. But since the encryption |
| 5311 | //is WPA2-PSK so it won't matter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5312 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && !CSR_IS_INFRA_AP( pSession->pCurRoamProfile )) |
| 5313 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5314 | // Issue the set Context request to LIM to establish the Broadcast STA context for the Ibss. |
| 5315 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 5316 | pProfile->negotiatedMCEncryptionType, |
| 5317 | pSirBssDesc, &BroadcastMac, |
| 5318 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5319 | } |
| 5320 | } |
| 5321 | else |
| 5322 | { |
| 5323 | //Keep the state to eCSR_ROAMING_STATE_JOINING |
| 5324 | //Need to send join_req. |
| 5325 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5326 | { |
| 5327 | if((pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link))) |
| 5328 | { |
| 5329 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5330 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 5331 | // Set the roaming substate to 'join attempt'... |
| 5332 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 5333 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5334 | } |
| 5335 | } |
| 5336 | else |
| 5337 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5338 | smsLog( pMac, LOGE, " StartBSS for WDS station with no BssDesc" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5339 | VOS_ASSERT( 0 ); |
| 5340 | } |
| 5341 | } |
| 5342 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5343 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5344 | //trigger the connection start indication in Vista |
| 5345 | if( !CSR_IS_JOIN_TO_IBSS( pProfile ) ) |
| 5346 | { |
| 5347 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5348 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5349 | if( CSR_IS_WDS( pProfile ) ) |
| 5350 | { |
| 5351 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5352 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5353 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5354 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5355 | { |
| 5356 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5357 | roamResult = eCSR_ROAM_RESULT_INFRA_STARTED; |
| 5358 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5359 | |
| 5360 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5361 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5362 | //trigger the connection start indication in Vista |
| 5363 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5364 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5365 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5366 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 5367 | { |
| 5368 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5369 | roamInfo.pBssDesc = pSirBssDesc; |
| 5370 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5371 | roamInfo.staId = (tANI_U8)pSmeStartBssRsp->staId; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5372 | vos_mem_copy (roamInfo.bssid, pSirBssDesc->bssId, sizeof(tCsrBssid)); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5373 | //Remove this code once SLM_Sessionization is supported |
| 5374 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5375 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5376 | ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5377 | { |
| 5378 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5379 | } |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5380 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5381 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5382 | } |
| 5383 | |
| 5384 | csrScanCancelIdleScan(pMac); |
| 5385 | //Only use this timer for ibss. BAP has its own timer for WDS |
| 5386 | if( CSR_IS_IBSS( pProfile) && CSR_INVALID_SCANRESULT_HANDLE != pCommand->u.roamCmd.hBSSList) |
| 5387 | { |
| 5388 | //start the join IBSS timer |
| 5389 | csrRoamStartIbssJoinTimer(pMac, sessionId, CSR_IBSS_JOIN_TIMEOUT_PERIOD); //interval |
| 5390 | pSession->ibss_join_pending = TRUE; |
| 5391 | } |
| 5392 | if( HAL_STATUS_SUCCESS( status ) ) |
| 5393 | { |
| 5394 | //Already sent join_req for the WDS station |
| 5395 | fReleaseCommand = eANI_BOOLEAN_FALSE; |
| 5396 | } |
| 5397 | else if( CSR_IS_WDS_STA( pProfile ) ) |
| 5398 | { |
| 5399 | //need to send stop BSS because we fail to send join_req |
| 5400 | csrRoamIssueDisassociateCmd( pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 5401 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5402 | eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_STOPPED ); |
| 5403 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5404 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5405 | case eCsrStartBssFailure: |
| 5406 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5407 | { |
| 5408 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5409 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5410 | if(pIbssLog) |
| 5411 | { |
| 5412 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 5413 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5414 | } |
| 5415 | } |
| 5416 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5417 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5418 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5419 | if( CSR_IS_WDS( pProfile ) ) |
| 5420 | { |
| 5421 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5422 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5423 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5424 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5425 | { |
| 5426 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5427 | roamResult = eCSR_ROAM_RESULT_INFRA_START_FAILED; |
| 5428 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5429 | if(Context) |
| 5430 | { |
| 5431 | pSirBssDesc = (tSirBssDescription *)Context; |
| 5432 | } |
| 5433 | else |
| 5434 | { |
| 5435 | pSirBssDesc = NULL; |
| 5436 | } |
| 5437 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5438 | roamInfo.pBssDesc = pSirBssDesc; |
| 5439 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5440 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5441 | csrSetDefaultDot11Mode( pMac ); |
| 5442 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5443 | case eCsrSilentlyStopRoaming: |
| 5444 | // We are here because we try to start the same IBSS |
| 5445 | //No message to PE |
| 5446 | // return the roaming state to Joined. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5447 | smsLog(pMac, LOGW, FL("receives silently roaming indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5448 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
| 5449 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 5450 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5451 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5452 | if( roamInfo.pBssDesc ) |
| 5453 | { |
| 5454 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid)); |
| 5455 | } |
| 5456 | //Since there is no change in the current state, simply pass back no result otherwise |
| 5457 | //HDD may be mistakenly mark to disconnected state. |
| 5458 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5459 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5460 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5461 | case eCsrSilentlyStopRoamingSaveState: |
| 5462 | //We are here because we try to connect to the same AP |
| 5463 | //No message to PE |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5464 | smsLog(pMac, LOGW, FL("receives silently stop roaming indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5465 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 5466 | |
| 5467 | //to aviod resetting the substate to NONE |
| 5468 | pMac->roam.curState[sessionId] = eCSR_ROAMING_STATE_JOINED; |
| 5469 | //No need to change substate to wai_for_key because there is no state change |
| 5470 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5471 | if( roamInfo.pBssDesc ) |
| 5472 | { |
| 5473 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid)); |
| 5474 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5475 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5476 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5477 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5478 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5479 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5480 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5481 | roamInfo.staId = pSession->connectedInfo.staId; |
| 5482 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5483 | VOS_ASSERT( roamInfo.staId != 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5484 | pSession->bRefAssocStartCnt--; |
| 5485 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5486 | eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5487 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_ASSOCIATED, eANI_BOOLEAN_TRUE); |
| 5488 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5489 | case eCsrReassocFailure: |
| 5490 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5491 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_REASSOC_FAILURE, NULL); |
| 5492 | #endif |
| 5493 | case eCsrJoinWdsFailure: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5494 | smsLog(pMac, LOGW, FL("failed to join WDS")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5495 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5496 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5497 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5498 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5499 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5500 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5501 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5502 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5503 | eCSR_ROAM_WDS_IND, |
| 5504 | eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED); |
| 5505 | //Need to issue stop_bss |
| 5506 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5507 | case eCsrJoinFailure: |
| 5508 | case eCsrNothingToJoin: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5509 | case eCsrJoinFailureDueToConcurrency: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5510 | default: |
| 5511 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5512 | smsLog(pMac, LOGW, FL("receives no association indication")); |
| 5513 | smsLog(pMac, LOG1, FL("Assoc ref count %d"), |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 5514 | pSession->bRefAssocStartCnt); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5515 | if( CSR_IS_INFRASTRUCTURE( &pSession->connectedProfile ) || |
| 5516 | CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, sessionId ) ) |
| 5517 | { |
| 5518 | //do not free for the other profiles as we need to send down stop BSS later |
| 5519 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5520 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5521 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5522 | csrSetDefaultDot11Mode( pMac ); |
| 5523 | } |
| 5524 | |
| 5525 | switch( pCommand->u.roamCmd.roamReason ) |
| 5526 | { |
| 5527 | // If this transition is because of an 802.11 OID, then we transition |
| 5528 | // back to INIT state so we sit waiting for more OIDs to be issued and |
| 5529 | // we don't start the IDLE timer. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5530 | case eCsrSmeIssuedFTReassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5531 | case eCsrSmeIssuedAssocToSimilarAP: |
| 5532 | case eCsrHddIssued: |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 5533 | case eCsrSmeIssuedDisassocForHandoff: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5534 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5535 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5536 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5537 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5538 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 5539 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSession->joinFailStatusCode.bssId, sizeof(tCsrBssid)); |
| 5540 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5541 | /* Defeaturize this later if needed */ |
| 5542 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5543 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 5544 | if (csrRoamIsHandoffInProgress(pMac)) |
| 5545 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5546 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 5547 | csrNeighborRoamIndicateConnect(pMac, (tANI_U8)sessionId, VOS_STATUS_E_FAILURE); |
| 5548 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5549 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5550 | if(pSession->bRefAssocStartCnt > 0) |
| 5551 | { |
| 5552 | pSession->bRefAssocStartCnt--; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5553 | if(eCsrJoinFailureDueToConcurrency == Result) |
| 5554 | { |
| 5555 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5556 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5557 | eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL); |
| 5558 | } |
| 5559 | else |
| 5560 | { |
| 5561 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5562 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5563 | eCSR_ROAM_RESULT_FAILURE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5564 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5565 | } |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5566 | else |
| 5567 | { |
| 5568 | /* bRefAssocStartCnt is not incremented when |
| 5569 | * eRoamState == eCsrStopRoamingDueToConcurrency |
| 5570 | * in csrRoamJoinNextBss API. so handle this in |
| 5571 | * else case by sending assoc failure |
| 5572 | */ |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 5573 | csrRoamCallCallback(pMac, sessionId, &roamInfo, |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5574 | pCommand->u.scanCmd.roamId, |
| 5575 | eCSR_ROAM_ASSOCIATION_FAILURE, |
| 5576 | eCSR_ROAM_RESULT_FAILURE); |
| 5577 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5578 | smsLog(pMac, LOG1, FL(" roam(reason %d) failed"), pCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5579 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5580 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5581 | #endif |
| 5582 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5583 | csrScanStartIdleScan(pMac); |
| 5584 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5585 | //For WDS STA. To fix the issue where the WDS AP side may be too busy by |
| 5586 | //BT activity and not able to recevie WLAN traffic. Retry the join |
| 5587 | if( CSR_IS_WDS_STA(pProfile) ) |
| 5588 | { |
| 5589 | csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD); |
| 5590 | } |
| 5591 | #endif |
| 5592 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5593 | case eCsrHddIssuedReassocToSameAP: |
| 5594 | case eCsrSmeIssuedReassocToSameAP: |
| 5595 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5596 | |
| 5597 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5598 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5599 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5600 | #endif |
| 5601 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5602 | csrScanStartIdleScan(pMac); |
| 5603 | break; |
| 5604 | case eCsrForcedDisassoc: |
| 5605 | case eCsrForcedDeauth: |
| 5606 | case eCsrSmeIssuedIbssJoinFailure: |
| 5607 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5608 | |
| 5609 | if(eCsrSmeIssuedIbssJoinFailure == pCommand->u.roamCmd.roamReason) |
| 5610 | { |
| 5611 | // Notify HDD that IBSS join failed |
| 5612 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 5613 | } |
| 5614 | else |
| 5615 | { |
| 5616 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5617 | pCommand->u.roamCmd.roamId, |
| 5618 | eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5619 | } |
| 5620 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5621 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5622 | #endif |
| 5623 | csrRoamLinkDown(pMac, sessionId); |
| 5624 | csrScanStartIdleScan(pMac); |
| 5625 | break; |
| 5626 | case eCsrForcedIbssLeave: |
| 5627 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5628 | pCommand->u.roamCmd.roamId, |
| 5629 | eCSR_ROAM_IBSS_LEAVE, |
| 5630 | eCSR_ROAM_RESULT_IBSS_STOP); |
| 5631 | break; |
| 5632 | case eCsrForcedDisassocMICFailure: |
| 5633 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5634 | |
| 5635 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_MIC_FAILURE); |
| 5636 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5637 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 5638 | #endif |
| 5639 | csrScanStartIdleScan(pMac); |
| 5640 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5641 | case eCsrStopBss: |
| 5642 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5643 | pCommand->u.roamCmd.roamId, |
| 5644 | eCSR_ROAM_INFRA_IND, |
| 5645 | eCSR_ROAM_RESULT_INFRA_STOPPED); |
| 5646 | break; |
| 5647 | case eCsrForcedDisassocSta: |
| 5648 | case eCsrForcedDeauthSta: |
| 5649 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId); |
| 5650 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 5651 | { |
| 5652 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5653 | if (!pSession) |
| 5654 | break; |
| 5655 | |
| 5656 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 5657 | { |
| 5658 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5659 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, |
| 5660 | pCommand->u.roamCmd.peerMac, sizeof(tSirMacAddr)); |
| 5661 | roamInfo.reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 5662 | roamInfo.statusCode = eSIR_SME_SUCCESS; |
| 5663 | status = csrRoamCallCallback(pMac, sessionId, |
| 5664 | &roamInfo, pCommand->u.roamCmd.roamId, |
| 5665 | eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 5666 | } |
| 5667 | } |
| 5668 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5669 | case eCsrLostLink1: |
| 5670 | // if lost link roam1 failed, then issue lost link Scan2 ... |
| 5671 | csrScanRequestLostLink2(pMac, sessionId); |
| 5672 | break; |
| 5673 | case eCsrLostLink2: |
| 5674 | // if lost link roam2 failed, then issue lost link scan3 ... |
| 5675 | csrScanRequestLostLink3(pMac, sessionId); |
| 5676 | break; |
| 5677 | case eCsrLostLink3: |
| 5678 | default: |
| 5679 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5680 | |
| 5681 | //We are done with one round of lostlink roaming here |
| 5682 | csrScanHandleFailedLostlink3(pMac, sessionId); |
| 5683 | break; |
| 5684 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5685 | break; |
| 5686 | } |
| 5687 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5688 | return ( fReleaseCommand ); |
| 5689 | } |
| 5690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5691 | eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext) |
| 5692 | { |
| 5693 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5694 | return (status); |
| 5695 | } |
| 5696 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5697 | eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile) |
| 5698 | { |
| 5699 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5700 | tANI_U32 size = 0; |
| 5701 | |
| 5702 | do |
| 5703 | { |
| 5704 | palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile)); |
| 5705 | if(pSrcProfile->BSSIDs.numOfBSSIDs) |
| 5706 | { |
| 5707 | size = sizeof(tCsrBssid) * pSrcProfile->BSSIDs.numOfBSSIDs; |
| 5708 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, size); |
| 5709 | if(!HAL_STATUS_SUCCESS(status)) |
| 5710 | { |
| 5711 | break; |
| 5712 | } |
| 5713 | pDstProfile->BSSIDs.numOfBSSIDs = pSrcProfile->BSSIDs.numOfBSSIDs; |
| 5714 | palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->BSSIDs.bssid, size); |
| 5715 | } |
| 5716 | if(pSrcProfile->SSIDs.numOfSSIDs) |
| 5717 | { |
| 5718 | size = sizeof(tCsrSSIDInfo) * pSrcProfile->SSIDs.numOfSSIDs; |
| 5719 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, size); |
| 5720 | if(!HAL_STATUS_SUCCESS(status)) |
| 5721 | { |
| 5722 | break; |
| 5723 | } |
| 5724 | pDstProfile->SSIDs.numOfSSIDs = pSrcProfile->SSIDs.numOfSSIDs; |
| 5725 | palCopyMemory(pMac->hHdd, pDstProfile->SSIDs.SSIDList, pSrcProfile->SSIDs.SSIDList, size); |
| 5726 | } |
| 5727 | if(pSrcProfile->nWPAReqIELength) |
| 5728 | { |
| 5729 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength); |
| 5730 | if(!HAL_STATUS_SUCCESS(status)) |
| 5731 | { |
| 5732 | break; |
| 5733 | } |
| 5734 | pDstProfile->nWPAReqIELength = pSrcProfile->nWPAReqIELength; |
| 5735 | palCopyMemory(pMac->hHdd, pDstProfile->pWPAReqIE, pSrcProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength); |
| 5736 | } |
| 5737 | if(pSrcProfile->nRSNReqIELength) |
| 5738 | { |
| 5739 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength); |
| 5740 | if(!HAL_STATUS_SUCCESS(status)) |
| 5741 | { |
| 5742 | break; |
| 5743 | } |
| 5744 | pDstProfile->nRSNReqIELength = pSrcProfile->nRSNReqIELength; |
| 5745 | palCopyMemory(pMac->hHdd, pDstProfile->pRSNReqIE, pSrcProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength); |
| 5746 | } |
| 5747 | #ifdef FEATURE_WLAN_WAPI |
| 5748 | if(pSrcProfile->nWAPIReqIELength) |
| 5749 | { |
| 5750 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength); |
| 5751 | if(!HAL_STATUS_SUCCESS(status)) |
| 5752 | { |
| 5753 | break; |
| 5754 | } |
| 5755 | pDstProfile->nWAPIReqIELength = pSrcProfile->nWAPIReqIELength; |
| 5756 | palCopyMemory(pMac->hHdd, pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength); |
| 5757 | } |
| 5758 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5759 | if(pSrcProfile->nAddIEScanLength) |
| 5760 | { |
| 5761 | status = palAllocateMemory(pMac->hHdd, |
| 5762 | (void **)&pDstProfile->pAddIEScan, pSrcProfile->nAddIEScanLength); |
| 5763 | if(!HAL_STATUS_SUCCESS(status)) |
| 5764 | { |
| 5765 | break; |
| 5766 | } |
| 5767 | pDstProfile->nAddIEScanLength = pSrcProfile->nAddIEScanLength; |
| 5768 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEScan, pSrcProfile->pAddIEScan, |
| 5769 | pSrcProfile->nAddIEScanLength); |
| 5770 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5771 | if(pSrcProfile->nAddIEAssocLength) |
| 5772 | { |
| 5773 | status = palAllocateMemory(pMac->hHdd, |
| 5774 | (void **)&pDstProfile->pAddIEAssoc, pSrcProfile->nAddIEAssocLength); |
| 5775 | if(!HAL_STATUS_SUCCESS(status)) |
| 5776 | { |
| 5777 | break; |
| 5778 | } |
| 5779 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
| 5780 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 5781 | pSrcProfile->nAddIEAssocLength); |
| 5782 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5783 | if(pSrcProfile->ChannelInfo.ChannelList) |
| 5784 | { |
| 5785 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); |
| 5786 | if(!HAL_STATUS_SUCCESS(status)) |
| 5787 | { |
| 5788 | break; |
| 5789 | } |
| 5790 | pDstProfile->ChannelInfo.numOfChannels = pSrcProfile->ChannelInfo.numOfChannels; |
| 5791 | palCopyMemory(pMac->hHdd, pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); |
| 5792 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5793 | pDstProfile->AuthType = pSrcProfile->AuthType; |
| 5794 | pDstProfile->EncryptionType = pSrcProfile->EncryptionType; |
| 5795 | pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType; |
| 5796 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->negotiatedUCEncryptionType; |
| 5797 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->negotiatedMCEncryptionType; |
| 5798 | pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5799 | #ifdef WLAN_FEATURE_11W |
| 5800 | pDstProfile->MFPEnabled = pSrcProfile->MFPEnabled; |
| 5801 | pDstProfile->MFPRequired = pSrcProfile->MFPRequired; |
| 5802 | pDstProfile->MFPCapable = pSrcProfile->MFPCapable; |
| 5803 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5804 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 5805 | pDstProfile->phyMode = pSrcProfile->phyMode; |
| 5806 | pDstProfile->csrPersona = pSrcProfile->csrPersona; |
| 5807 | |
| 5808 | #ifdef FEATURE_WLAN_WAPI |
| 5809 | if(csrIsProfileWapi(pSrcProfile)) |
| 5810 | { |
| 5811 | if(pDstProfile->phyMode & eCSR_DOT11_MODE_11n) |
| 5812 | { |
| 5813 | pDstProfile->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 5814 | } |
| 5815 | } |
| 5816 | #endif /* FEATURE_WLAN_WAPI */ |
| 5817 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 5818 | /*Save the WPS info*/ |
| 5819 | pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation; |
| 5820 | pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5821 | pDstProfile->beaconInterval = pSrcProfile->beaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5822 | pDstProfile->privacy = pSrcProfile->privacy; |
| 5823 | pDstProfile->fwdWPSPBCProbeReq = pSrcProfile->fwdWPSPBCProbeReq; |
| 5824 | pDstProfile->csr80211AuthType = pSrcProfile->csr80211AuthType; |
| 5825 | pDstProfile->dtimPeriod = pSrcProfile->dtimPeriod; |
| 5826 | pDstProfile->ApUapsdEnable = pSrcProfile->ApUapsdEnable; |
| 5827 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->SSIDs.SSIDList[0].ssidHidden; |
| 5828 | pDstProfile->protEnabled = pSrcProfile->protEnabled; |
| 5829 | pDstProfile->obssProtEnabled = pSrcProfile->obssProtEnabled; |
| 5830 | pDstProfile->cfg_protection = pSrcProfile->cfg_protection; |
| 5831 | pDstProfile->wps_state = pSrcProfile->wps_state; |
| 5832 | pDstProfile->ieee80211d = pSrcProfile->ieee80211d; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5833 | palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5834 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5835 | if (pSrcProfile->MDID.mdiePresent) |
| 5836 | { |
| 5837 | pDstProfile->MDID.mdiePresent = 1; |
| 5838 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 5839 | } |
| 5840 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5841 | }while(0); |
| 5842 | |
| 5843 | if(!HAL_STATUS_SUCCESS(status)) |
| 5844 | { |
| 5845 | csrReleaseProfile(pMac, pDstProfile); |
| 5846 | pDstProfile = NULL; |
| 5847 | } |
| 5848 | |
| 5849 | return (status); |
| 5850 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5851 | eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile ) |
| 5852 | { |
| 5853 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5854 | tCsrRoamConnectedProfile *pSrcProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 5855 | do |
| 5856 | { |
| 5857 | palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile)); |
| 5858 | if(pSrcProfile->bssid) |
| 5859 | { |
| 5860 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 5861 | if(!HAL_STATUS_SUCCESS(status)) |
| 5862 | { |
| 5863 | break; |
| 5864 | } |
| 5865 | pDstProfile->BSSIDs.numOfBSSIDs = 1; |
| 5866 | palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->bssid, sizeof(tCsrBssid)); |
| 5867 | } |
| 5868 | if(pSrcProfile->SSID.ssId) |
| 5869 | { |
| 5870 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, sizeof(tCsrSSIDInfo)); |
| 5871 | if(!HAL_STATUS_SUCCESS(status)) |
| 5872 | { |
| 5873 | break; |
| 5874 | } |
| 5875 | pDstProfile->SSIDs.numOfSSIDs = 1; |
| 5876 | pDstProfile->SSIDs.SSIDList[0].handoffPermitted = pSrcProfile->handoffPermitted; |
| 5877 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->ssidHidden; |
| 5878 | palCopyMemory(pMac->hHdd, &pDstProfile->SSIDs.SSIDList[0].SSID, &pSrcProfile->SSID, sizeof(tSirMacSSid)); |
| 5879 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 5880 | if(pSrcProfile->nAddIEAssocLength) |
| 5881 | { |
| 5882 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pAddIEAssoc, pSrcProfile->nAddIEAssocLength); |
| 5883 | if(!HAL_STATUS_SUCCESS(status)) |
| 5884 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5885 | smsLog( pMac, LOGE, FL(" failed to allocate memory for additional IEs ") ); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 5886 | break; |
| 5887 | } |
| 5888 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
| 5889 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 5890 | pSrcProfile->nAddIEAssocLength); |
| 5891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5892 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, 1); |
| 5893 | if(!HAL_STATUS_SUCCESS(status)) |
| 5894 | { |
| 5895 | break; |
| 5896 | } |
| 5897 | pDstProfile->ChannelInfo.numOfChannels = 1; |
| 5898 | pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5899 | pDstProfile->AuthType.numEntries = 1; |
| 5900 | pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType; |
| 5901 | pDstProfile->negotiatedAuthType = pSrcProfile->AuthType; |
| 5902 | pDstProfile->EncryptionType.numEntries = 1; |
| 5903 | pDstProfile->EncryptionType.encryptionType[0] = pSrcProfile->EncryptionType; |
| 5904 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->EncryptionType; |
| 5905 | pDstProfile->mcEncryptionType.numEntries = 1; |
| 5906 | pDstProfile->mcEncryptionType.encryptionType[0] = pSrcProfile->mcEncryptionType; |
| 5907 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->mcEncryptionType; |
| 5908 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 5909 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 5910 | palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys)); |
| 5911 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5912 | if (pSrcProfile->MDID.mdiePresent) |
| 5913 | { |
| 5914 | pDstProfile->MDID.mdiePresent = 1; |
| 5915 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 5916 | } |
| 5917 | #endif |
| 5918 | |
| 5919 | }while(0); |
| 5920 | |
| 5921 | if(!HAL_STATUS_SUCCESS(status)) |
| 5922 | { |
| 5923 | csrReleaseProfile(pMac, pDstProfile); |
| 5924 | pDstProfile = NULL; |
| 5925 | } |
| 5926 | |
| 5927 | return (status); |
| 5928 | } |
| 5929 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5931 | tScanResultHandle hBSSList, |
| 5932 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate, |
| 5933 | tANI_BOOLEAN fClearScan) |
| 5934 | { |
| 5935 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5936 | tSmeCmd *pCommand; |
| 5937 | |
| 5938 | pCommand = csrGetCommandBuffer(pMac); |
| 5939 | if(NULL == pCommand) |
| 5940 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5941 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5942 | status = eHAL_STATUS_RESOURCES; |
| 5943 | } |
| 5944 | else |
| 5945 | { |
| 5946 | if( fClearScan ) |
| 5947 | { |
| 5948 | csrScanCancelIdleScan(pMac); |
| 5949 | csrScanAbortMacScanNotForConnect(pMac); |
| 5950 | } |
| 5951 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 5952 | if(NULL == pProfile) |
| 5953 | { |
| 5954 | //We can roam now |
| 5955 | //Since pProfile is NULL, we need to build our own profile, set everything to default |
| 5956 | //We can only support open and no encryption |
| 5957 | pCommand->u.roamCmd.roamProfile.AuthType.numEntries = 1; |
| 5958 | pCommand->u.roamCmd.roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5959 | pCommand->u.roamCmd.roamProfile.EncryptionType.numEntries = 1; |
| 5960 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 5961 | pCommand->u.roamCmd.roamProfile.csrPersona = VOS_STA_MODE; |
| 5962 | } |
| 5963 | else |
| 5964 | { |
| 5965 | //make a copy of the profile |
| 5966 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 5967 | if(HAL_STATUS_SUCCESS(status)) |
| 5968 | { |
| 5969 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 5970 | } |
| 5971 | } |
| 5972 | pCommand->command = eSmeCommandRoam; |
| 5973 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5974 | pCommand->u.roamCmd.hBSSList = hBSSList; |
| 5975 | pCommand->u.roamCmd.roamId = roamId; |
| 5976 | pCommand->u.roamCmd.roamReason = reason; |
| 5977 | //We need to free the BssList when the command is done |
| 5978 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_TRUE; |
| 5979 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5980 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 5981 | FL("CSR PERSONA=%d"), |
| 5982 | pCommand->u.roamCmd.roamProfile.csrPersona); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5983 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 5984 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5985 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5986 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5987 | csrReleaseCommandRoam( pMac, pCommand ); |
| 5988 | } |
| 5989 | } |
| 5990 | |
| 5991 | return (status); |
| 5992 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5993 | eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5994 | tCsrRoamModifyProfileFields *pMmodProfileFields, |
| 5995 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 5996 | { |
| 5997 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5998 | tSmeCmd *pCommand; |
| 5999 | |
| 6000 | pCommand = csrGetCommandBuffer(pMac); |
| 6001 | if(NULL == pCommand) |
| 6002 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6003 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6004 | status = eHAL_STATUS_RESOURCES; |
| 6005 | } |
| 6006 | else |
| 6007 | { |
| 6008 | csrScanCancelIdleScan(pMac); |
| 6009 | csrScanAbortMacScanNotForConnect(pMac); |
| 6010 | if(pProfile) |
| 6011 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6012 | //This is likely trying to reassoc to different profile |
| 6013 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 6014 | //make a copy of the profile |
| 6015 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 6016 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6017 | } |
| 6018 | else |
| 6019 | { |
| 6020 | status = csrRoamCopyConnectedProfile(pMac, sessionId, &pCommand->u.roamCmd.roamProfile); |
| 6021 | //how to update WPA/WPA2 info in roamProfile?? |
| 6022 | pCommand->u.roamCmd.roamProfile.uapsd_mask = pMmodProfileFields->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6023 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6024 | if(HAL_STATUS_SUCCESS(status)) |
| 6025 | { |
| 6026 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 6027 | } |
| 6028 | pCommand->command = eSmeCommandRoam; |
| 6029 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6030 | pCommand->u.roamCmd.roamId = roamId; |
| 6031 | pCommand->u.roamCmd.roamReason = reason; |
| 6032 | //We need to free the BssList when the command is done |
| 6033 | //For reassoc there is no BSS list, so the boolean set to false |
| 6034 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 6035 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 6036 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6037 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 6038 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6039 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6040 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6041 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 6042 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6043 | } |
| 6044 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6045 | return (status); |
| 6046 | } |
| 6047 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6048 | eHalStatus csrRoamEnqueuePreauth(tpAniSirGlobal pMac, tANI_U32 sessionId, tpSirBssDescription pBssDescription, |
| 6049 | eCsrRoamReason reason, tANI_BOOLEAN fImmediate) |
| 6050 | // , eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 6051 | { |
| 6052 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6053 | tSmeCmd *pCommand; |
| 6054 | |
| 6055 | pCommand = csrGetCommandBuffer(pMac); |
| 6056 | if(NULL == pCommand) |
| 6057 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6058 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6059 | status = eHAL_STATUS_RESOURCES; |
| 6060 | } |
| 6061 | else |
| 6062 | { |
| 6063 | if(pBssDescription) |
| 6064 | { |
| 6065 | //copy over the parameters we need later |
| 6066 | pCommand->command = eSmeCommandRoam; |
| 6067 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6068 | pCommand->u.roamCmd.roamReason = reason; |
| 6069 | //this is the important parameter |
| 6070 | //in this case we are using this field for the "next" BSS |
| 6071 | pCommand->u.roamCmd.pLastRoamBss = pBssDescription; |
| 6072 | status = csrQueueSmeCommand(pMac, pCommand, fImmediate); |
| 6073 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6074 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6075 | smsLog( pMac, LOGE, FL(" fail to enqueue preauth command, status = %d"), status ); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6076 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 6077 | } |
| 6078 | } |
| 6079 | else |
| 6080 | { |
| 6081 | //Return failure |
| 6082 | status = eHAL_STATUS_RESOURCES; |
| 6083 | } |
| 6084 | } |
| 6085 | return (status); |
| 6086 | } |
| 6087 | |
| 6088 | eHalStatus csrRoamDequeuePreauth(tpAniSirGlobal pMac) |
| 6089 | { |
| 6090 | tListElem *pEntry; |
| 6091 | tSmeCmd *pCommand; |
| 6092 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 6093 | if ( pEntry ) |
| 6094 | { |
| 6095 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 6096 | if ( (eSmeCommandRoam == pCommand->command) && |
| 6097 | (eCsrPerformPreauth == pCommand->u.roamCmd.roamReason)) |
| 6098 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6099 | smsLog( pMac, LOG1, FL("DQ-Command = %d, Reason = %d"), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6100 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 6101 | if (csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK )) { |
| 6102 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 6103 | } |
| 6104 | } else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6105 | smsLog( pMac, LOGE, FL("Command = %d, Reason = %d "), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6106 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 6107 | } |
| 6108 | } |
| 6109 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6110 | smsLog( pMac, LOGE, FL("pEntry NULL for eWNI_SME_FT_PRE_AUTH_RSP")); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6111 | } |
| 6112 | smeProcessPendingQueue( pMac ); |
| 6113 | return eHAL_STATUS_SUCCESS; |
| 6114 | } |
| 6115 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6116 | eHalStatus csrRoamConnectWithBSSList(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6117 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 6118 | { |
| 6119 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6120 | tScanResultHandle hBSSList; |
| 6121 | tANI_U32 roamId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6122 | status = csrScanCopyResultList(pMac, hBssListIn, &hBSSList); |
| 6123 | if(HAL_STATUS_SUCCESS(status)) |
| 6124 | { |
| 6125 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6126 | if(pRoamId) |
| 6127 | { |
| 6128 | *pRoamId = roamId; |
| 6129 | } |
| 6130 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6131 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6132 | if(!HAL_STATUS_SUCCESS(status)) |
| 6133 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6134 | smsLog(pMac, LOGE, FL("failed to start a join process")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6135 | csrScanResultPurge(pMac, hBSSList); |
| 6136 | } |
| 6137 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6138 | return (status); |
| 6139 | } |
| 6140 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6141 | eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6142 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 6143 | { |
| 6144 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6145 | tScanResultHandle hBSSList; |
| 6146 | tCsrScanResultFilter *pScanFilter; |
| 6147 | tANI_U32 roamId = 0; |
| 6148 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_FALSE; |
| 6149 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6150 | if (NULL == pProfile) |
| 6151 | { |
| 6152 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6153 | return eHAL_STATUS_FAILURE; |
| 6154 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6155 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6156 | pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6157 | if( CSR_IS_WDS( pProfile ) && |
| 6158 | !HAL_STATUS_SUCCESS( status = csrIsBTAMPAllowed( pMac, pProfile->operationChannel ) ) ) |
| 6159 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6160 | smsLog(pMac, LOGE, FL("Request for BT AMP connection failed, channel requested is different than infra = %d"), |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6161 | pProfile->operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6162 | return status; |
| 6163 | } |
| 6164 | csrRoamCancelRoaming(pMac, sessionId); |
| 6165 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6166 | csrScanCancelIdleScan(pMac); |
| 6167 | //Only abort the scan if it is not used for other roam/connect purpose |
| 6168 | csrScanAbortMacScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6169 | if (!vos_concurrent_sessions_running() && (VOS_STA_SAP_MODE == pProfile->csrPersona))//In case of AP mode we do not want idle mode scan |
| 6170 | { |
| 6171 | csrScanDisable(pMac); |
| 6172 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6173 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6174 | //Check whether ssid changes |
| 6175 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6176 | { |
| 6177 | if(pProfile->SSIDs.numOfSSIDs && !csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6178 | { |
| 6179 | csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6180 | } |
| 6181 | } |
| 6182 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6183 | pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; |
| 6184 | #endif |
| 6185 | if(CSR_INVALID_SCANRESULT_HANDLE != hBssListIn) |
| 6186 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6187 | smsLog(pMac, LOG1, FL("is called with BSSList")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6188 | status = csrRoamConnectWithBSSList(pMac, sessionId, pProfile, hBssListIn, pRoamId); |
| 6189 | if(pRoamId) |
| 6190 | { |
| 6191 | roamId = *pRoamId; |
| 6192 | } |
| 6193 | if(!HAL_STATUS_SUCCESS(status)) |
| 6194 | { |
| 6195 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6196 | } |
| 6197 | } |
| 6198 | else |
| 6199 | { |
| 6200 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6201 | if(HAL_STATUS_SUCCESS(status)) |
| 6202 | { |
| 6203 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6204 | //Try to connect to any BSS |
| 6205 | if(NULL == pProfile) |
| 6206 | { |
| 6207 | //No encryption |
| 6208 | pScanFilter->EncryptionType.numEntries = 1; |
| 6209 | pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 6210 | }//we don't have a profile |
| 6211 | else |
| 6212 | { |
| 6213 | //Here is the profile we need to connect to |
| 6214 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6215 | }//We have a profile |
| 6216 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6217 | if(pRoamId) |
| 6218 | { |
| 6219 | *pRoamId = roamId; |
| 6220 | } |
| 6221 | |
| 6222 | if(HAL_STATUS_SUCCESS(status)) |
| 6223 | { |
| 6224 | /*Save the WPS info*/ |
| 6225 | if(NULL != pProfile) |
| 6226 | { |
| 6227 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
| 6228 | } |
| 6229 | else |
| 6230 | { |
| 6231 | pScanFilter->bWPSAssociation = 0; |
| 6232 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6233 | do |
| 6234 | { |
| 6235 | if( (pProfile && CSR_IS_WDS_AP( pProfile ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6236 | || (pProfile && CSR_IS_INFRA_AP ( pProfile )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6237 | ) |
| 6238 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6239 | //This can be started right away |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6240 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6241 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6242 | if(!HAL_STATUS_SUCCESS(status)) |
| 6243 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6244 | smsLog(pMac, LOGE, FL(" CSR failed to issue start BSS command with status = 0x%08X"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6245 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6246 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6247 | else |
| 6248 | { |
| 6249 | smsLog(pMac, LOG1, FL("Connect request to proceed for AMP/SoftAP mode")); |
| 6250 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6251 | break; |
| 6252 | } |
| 6253 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6254 | smsLog(pMac, LOG1, "************ csrScanGetResult Status ********* %d", status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6255 | if(HAL_STATUS_SUCCESS(status)) |
| 6256 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6257 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6258 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6259 | if(!HAL_STATUS_SUCCESS(status)) |
| 6260 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6261 | smsLog(pMac, LOGE, FL(" CSR failed to issue connect command with status = 0x%08X"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6262 | csrScanResultPurge(pMac, hBSSList); |
| 6263 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6264 | } |
| 6265 | }//Have scan result |
| 6266 | else if(NULL != pProfile) |
| 6267 | { |
| 6268 | //Check whether it is for start ibss |
| 6269 | if(CSR_IS_START_IBSS(pProfile)) |
| 6270 | { |
| 6271 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6272 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6273 | if(!HAL_STATUS_SUCCESS(status)) |
| 6274 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6275 | smsLog(pMac, LOGE, " CSR failed to issue startIBSS command with status = 0x%08X", status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6276 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6277 | } |
| 6278 | } |
| 6279 | else |
| 6280 | { |
| 6281 | //scan for this SSID |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 6282 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6283 | if(!HAL_STATUS_SUCCESS(status)) |
| 6284 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6285 | smsLog(pMac, LOGE, FL(" CSR failed to issue SSID scan command with status = 0x%08X"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6286 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6287 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6288 | else |
| 6289 | { |
| 6290 | smsLog(pMac, LOG1, FL("SSID scan requested for Infra connect req")); |
| 6291 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6292 | } |
| 6293 | } |
| 6294 | else |
| 6295 | { |
| 6296 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6297 | } |
| 6298 | } while (0); |
| 6299 | if(NULL != pProfile) |
| 6300 | { |
| 6301 | //we need to free memory for filter if profile exists |
| 6302 | csrFreeScanFilter(pMac, pScanFilter); |
| 6303 | } |
| 6304 | }//Got the scan filter from profile |
| 6305 | |
| 6306 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 6307 | }//allocated memory for pScanFilter |
| 6308 | }//No Bsslist coming in |
| 6309 | //tell the caller if we fail to trigger a join request |
| 6310 | if( fCallCallback ) |
| 6311 | { |
| 6312 | csrRoamCallCallback(pMac, sessionId, NULL, roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6313 | } |
| 6314 | |
| 6315 | return (status); |
| 6316 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6317 | eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6318 | tCsrRoamModifyProfileFields modProfileFields, |
| 6319 | tANI_U32 *pRoamId) |
| 6320 | { |
| 6321 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6322 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_TRUE; |
| 6323 | tANI_U32 roamId = 0; |
| 6324 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6325 | if (NULL == pProfile) |
| 6326 | { |
| 6327 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6328 | return eHAL_STATUS_FAILURE; |
| 6329 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6330 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d"), pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6331 | csrRoamCancelRoaming(pMac, sessionId); |
| 6332 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6333 | csrScanCancelIdleScan(pMac); |
| 6334 | csrScanAbortMacScanNotForConnect(pMac); |
| 6335 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssuedReassocToSameAP); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6336 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6337 | { |
| 6338 | if(pProfile) |
| 6339 | { |
| 6340 | if(pProfile->SSIDs.numOfSSIDs && |
| 6341 | csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6342 | { |
| 6343 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6344 | } |
| 6345 | else |
| 6346 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6347 | smsLog(pMac, LOG1, FL("Not connected to the same SSID asked in the profile")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6348 | } |
| 6349 | } |
| 6350 | else if(!palEqualMemory(pMac->hHdd, &modProfileFields, |
| 6351 | &pSession->connectedProfile.modifyProfileFields, |
| 6352 | sizeof(tCsrRoamModifyProfileFields))) |
| 6353 | { |
| 6354 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6355 | } |
| 6356 | else |
| 6357 | { |
| 6358 | smsLog(pMac, LOG1, FL("Either the profile is NULL or none of the fields " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6359 | "in tCsrRoamModifyProfileFields got modified")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6360 | } |
| 6361 | } |
| 6362 | else |
| 6363 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6364 | smsLog(pMac, LOG1, FL("Not connected! No need to reassoc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6365 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6366 | if(!fCallCallback) |
| 6367 | { |
| 6368 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6369 | if(pRoamId) |
| 6370 | { |
| 6371 | *pRoamId = roamId; |
| 6372 | } |
| 6373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6374 | status = csrRoamIssueReassoc(pMac, sessionId, pProfile, &modProfileFields, |
| 6375 | eCsrHddIssuedReassocToSameAP, roamId, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6376 | } |
| 6377 | else |
| 6378 | { |
| 6379 | status = csrRoamCallCallback(pMac, sessionId, NULL, roamId, |
| 6380 | eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6381 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6382 | return status; |
| 6383 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6384 | eHalStatus csrRoamJoinLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6385 | { |
| 6386 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6387 | tScanResultHandle hBSSList = NULL; |
| 6388 | tCsrScanResultFilter *pScanFilter = NULL; |
| 6389 | tANI_U32 roamId; |
| 6390 | tCsrRoamProfile *pProfile = NULL; |
| 6391 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6392 | |
| 6393 | if(!pSession) |
| 6394 | { |
| 6395 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6396 | return eHAL_STATUS_FAILURE; |
| 6397 | } |
| 6398 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6399 | do |
| 6400 | { |
| 6401 | if(pSession->pCurRoamProfile) |
| 6402 | { |
| 6403 | csrScanCancelIdleScan(pMac); |
| 6404 | csrScanAbortMacScanNotForConnect(pMac); |
| 6405 | //We have to make a copy of pCurRoamProfile because it will be free inside csrRoamIssueConnect |
| 6406 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile, sizeof(tCsrRoamProfile)); |
| 6407 | if(!HAL_STATUS_SUCCESS(status)) |
| 6408 | break; |
| 6409 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile)); |
| 6410 | status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile); |
| 6411 | if(!HAL_STATUS_SUCCESS(status)) |
| 6412 | break; |
| 6413 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6414 | if(!HAL_STATUS_SUCCESS(status)) |
| 6415 | { |
| 6416 | break; |
| 6417 | } |
| 6418 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6419 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6420 | if(!HAL_STATUS_SUCCESS(status)) |
| 6421 | { |
| 6422 | break; |
| 6423 | } |
| 6424 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6425 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 6426 | if(HAL_STATUS_SUCCESS(status)) |
| 6427 | { |
| 6428 | //we want to put the last connected BSS to the very beginning, if possible |
| 6429 | csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList); |
| 6430 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6431 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6432 | if(!HAL_STATUS_SUCCESS(status)) |
| 6433 | { |
| 6434 | csrScanResultPurge(pMac, hBSSList); |
| 6435 | break; |
| 6436 | } |
| 6437 | } |
| 6438 | else |
| 6439 | { |
| 6440 | //Do a scan on this profile |
| 6441 | //scan for this SSID only in case the AP suppresses SSID |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 6442 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6443 | if(!HAL_STATUS_SUCCESS(status)) |
| 6444 | { |
| 6445 | break; |
| 6446 | } |
| 6447 | } |
| 6448 | }//We have a profile |
| 6449 | else |
| 6450 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6451 | smsLog(pMac, LOGW, FL("cannot find a roaming profile")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6452 | break; |
| 6453 | } |
| 6454 | }while(0); |
| 6455 | if(pScanFilter) |
| 6456 | { |
| 6457 | csrFreeScanFilter(pMac, pScanFilter); |
| 6458 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 6459 | } |
| 6460 | if(NULL != pProfile) |
| 6461 | { |
| 6462 | csrReleaseProfile(pMac, pProfile); |
| 6463 | palFreeMemory(pMac->hHdd, pProfile); |
| 6464 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6465 | return (status); |
| 6466 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6467 | eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6468 | { |
| 6469 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6470 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6471 | { |
| 6472 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6473 | if(HAL_STATUS_SUCCESS(status)) |
| 6474 | { |
| 6475 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6476 | } |
| 6477 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6478 | return (status); |
| 6479 | } |
| 6480 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6481 | eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6482 | { |
| 6483 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6484 | smsLog(pMac, LOGW, FL("is called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6485 | csrRoamCancelRoaming(pMac, sessionId); |
| 6486 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6487 | if(csrIsConnStateDisconnected(pMac, sessionId)) |
| 6488 | { |
| 6489 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6490 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6491 | return (status); |
| 6492 | } |
| 6493 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6494 | eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure ) |
| 6495 | { |
| 6496 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6497 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
| 6498 | eCsrRoamSubState NewSubstate; |
| 6499 | tANI_U32 sessionId = pCommand->sessionId; |
| 6500 | |
| 6501 | // change state to 'Roaming'... |
| 6502 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 6503 | |
| 6504 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 6505 | { |
| 6506 | // If we are in an IBSS, then stop the IBSS... |
| 6507 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6508 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6509 | } |
| 6510 | else if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6511 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6512 | smsLog(pMac, LOG1, FL(" restore AC weights (%d-%d-%d-%d)"), pMac->roam.ucACWeights[0], pMac->roam.ucACWeights[1], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6513 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 6514 | //Restore AC weight in case we change it |
| 6515 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 6516 | // in Infrasturcture, we need to disassociate from the Infrastructure network... |
| 6517 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED; |
| 6518 | if(eCsrSmeIssuedDisassocForHandoff == pCommand->u.roamCmd.roamReason) |
| 6519 | { |
| 6520 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF; |
| 6521 | } |
| 6522 | if( fDisassoc ) |
| 6523 | { |
| 6524 | status = csrRoamIssueDisassociate( pMac, sessionId, NewSubstate, fMICFailure ); |
| 6525 | } |
| 6526 | else |
| 6527 | { |
| 6528 | status = csrRoamIssueDeauth( pMac, sessionId, eCSR_ROAM_SUBSTATE_DEAUTH_REQ ); |
| 6529 | } |
| 6530 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6531 | } |
| 6532 | else if ( csrIsConnStateWds( pMac, sessionId ) ) |
| 6533 | { |
| 6534 | if( CSR_IS_WDS_AP( &pMac->roam.roamSession[sessionId].connectedProfile ) ) |
| 6535 | { |
| 6536 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6537 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6538 | } |
| 6539 | //This has to be WDS station |
| 6540 | else if( csrIsConnStateConnectedWds( pMac, sessionId ) ) //This has to be WDS station |
| 6541 | { |
| 6542 | |
| 6543 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 6544 | if( fDisassoc ) |
| 6545 | { |
| 6546 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 6547 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, fMICFailure ); |
| 6548 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6549 | } |
| 6550 | } |
| 6551 | } else { |
| 6552 | // we got a dis-assoc request while not connected to any peer |
| 6553 | // just complete the command |
| 6554 | fComplete = eANI_BOOLEAN_TRUE; |
| 6555 | status = eHAL_STATUS_FAILURE; |
| 6556 | } |
| 6557 | if(fComplete) |
| 6558 | { |
| 6559 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6560 | } |
| 6561 | |
| 6562 | if(HAL_STATUS_SUCCESS(status)) |
| 6563 | { |
| 6564 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6565 | { |
| 6566 | //Set the state to disconnect here |
| 6567 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 6568 | } |
| 6569 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6570 | else |
| 6571 | { |
| 6572 | smsLog(pMac, LOGW, FL(" failed with status %d"), status); |
| 6573 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6574 | return (status); |
| 6575 | } |
| 6576 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6577 | /* This is been removed from latest code base */ |
| 6578 | /* |
| 6579 | static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 6580 | { |
| 6581 | eHalStatus status; |
| 6582 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6583 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING ); |
| 6584 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6585 | return ( status ); |
| 6586 | } |
| 6587 | */ |
| 6588 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6589 | eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason ) |
| 6590 | { |
| 6591 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6592 | tSmeCmd *pCommand; |
| 6593 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6594 | do |
| 6595 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6596 | smsLog( pMac, LOG1, FL(" reason = %d"), reason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6597 | pCommand = csrGetCommandBuffer( pMac ); |
| 6598 | if ( !pCommand ) |
| 6599 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6600 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6601 | status = eHAL_STATUS_RESOURCES; |
| 6602 | break; |
| 6603 | } |
| 6604 | //Change the substate in case it is wait-for-key |
| 6605 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 6606 | { |
| 6607 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6608 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 6609 | } |
| 6610 | pCommand->command = eSmeCommandRoam; |
| 6611 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6612 | switch ( reason ) |
| 6613 | { |
| 6614 | case eCSR_DISCONNECT_REASON_MIC_ERROR: |
| 6615 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocMICFailure; |
| 6616 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6617 | case eCSR_DISCONNECT_REASON_DEAUTH: |
| 6618 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauth; |
| 6619 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6620 | case eCSR_DISCONNECT_REASON_HANDOFF: |
| 6621 | fHighPriority = eANI_BOOLEAN_TRUE; |
| 6622 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff; |
| 6623 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6624 | case eCSR_DISCONNECT_REASON_UNSPECIFIED: |
| 6625 | case eCSR_DISCONNECT_REASON_DISASSOC: |
| 6626 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 6627 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6628 | case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE: |
| 6629 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedIbssJoinFailure; |
| 6630 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6631 | case eCSR_DISCONNECT_REASON_IBSS_LEAVE: |
| 6632 | pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave; |
| 6633 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6634 | default: |
| 6635 | break; |
| 6636 | } |
| 6637 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6638 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6639 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6640 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6641 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6642 | } |
| 6643 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6644 | return( status ); |
| 6645 | } |
| 6646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6647 | eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority ) |
| 6648 | { |
| 6649 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6650 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6651 | pCommand = csrGetCommandBuffer( pMac ); |
| 6652 | if ( NULL != pCommand ) |
| 6653 | { |
| 6654 | //Change the substate in case it is wait-for-key |
| 6655 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 6656 | { |
| 6657 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6658 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 6659 | } |
| 6660 | pCommand->command = eSmeCommandRoam; |
| 6661 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6662 | pCommand->u.roamCmd.roamReason = eCsrStopBss; |
| 6663 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6664 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6665 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6666 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6667 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6668 | } |
| 6669 | } |
| 6670 | else |
| 6671 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6672 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6673 | status = eHAL_STATUS_RESOURCES; |
| 6674 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6675 | return ( status ); |
| 6676 | } |
| 6677 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6678 | eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 6679 | { |
| 6680 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6681 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6682 | |
| 6683 | if(!pSession) |
| 6684 | { |
| 6685 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6686 | return eHAL_STATUS_FAILURE; |
| 6687 | } |
| 6688 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6689 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6690 | //Stop te retry |
| 6691 | pSession->maxRetryCount = 0; |
| 6692 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 6693 | #endif |
| 6694 | //Not to call cancel roaming here |
| 6695 | //Only issue disconnect when necessary |
| 6696 | if(csrIsConnStateConnected(pMac, sessionId) || csrIsBssTypeIBSS(pSession->connectedProfile.BSSType) |
| 6697 | || csrIsBssTypeWDS(pSession->connectedProfile.BSSType) |
| 6698 | || csrIsRoamCommandWaitingForSession(pMac, sessionId) ) |
| 6699 | |
| 6700 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6701 | smsLog(pMac, LOG2, FL("called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6702 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, reason); |
| 6703 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6704 | return (status); |
| 6705 | } |
| 6706 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6707 | eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 6708 | { |
| 6709 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6710 | |
| 6711 | if(!pSession) |
| 6712 | { |
| 6713 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6714 | return eHAL_STATUS_FAILURE; |
| 6715 | } |
| 6716 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6717 | csrRoamCancelRoaming(pMac, sessionId); |
| 6718 | pSession->ibss_join_pending = FALSE; |
| 6719 | csrRoamStopIbssJoinTimer(pMac, sessionId); |
| 6720 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrForcedDisassoc); |
| 6721 | |
| 6722 | return (csrRoamDisconnectInternal(pMac, sessionId, reason)); |
| 6723 | } |
| 6724 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6725 | eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6726 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes) |
| 6727 | { |
| 6728 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6729 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 6730 | tANI_U8 index; |
| 6731 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 6732 | tCsrRoamConnectedProfile *pConnectProfile = &pSession->connectedProfile; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6733 | |
| 6734 | if(!pSession) |
| 6735 | { |
| 6736 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6737 | return eHAL_STATUS_FAILURE; |
| 6738 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6739 | |
| 6740 | palZeroMemory(pMac->hHdd, &pSession->connectedProfile, sizeof(tCsrRoamConnectedProfile)); |
| 6741 | pConnectProfile->AuthType = pProfile->negotiatedAuthType; |
| 6742 | pConnectProfile->AuthInfo = pProfile->AuthType; |
| 6743 | pConnectProfile->CBMode = pProfile->CBMode; //*** this may not be valid |
| 6744 | pConnectProfile->EncryptionType = pProfile->negotiatedUCEncryptionType; |
| 6745 | pConnectProfile->EncryptionInfo = pProfile->EncryptionType; |
| 6746 | pConnectProfile->mcEncryptionType = pProfile->negotiatedMCEncryptionType; |
| 6747 | pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType; |
| 6748 | pConnectProfile->BSSType = pProfile->BSSType; |
| 6749 | pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask; |
| 6750 | pConnectProfile->operationChannel = pSirBssDesc->channelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6751 | pConnectProfile->beaconInterval = pSirBssDesc->beaconInterval; |
| 6752 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6753 | palCopyMemory(pMac->hHdd, &pConnectProfile->Keys, &pProfile->Keys, sizeof(tCsrKeys)); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6754 | /* saving the addional IE`s like Hot spot indication element and extended capabilities */ |
| 6755 | if(pProfile->nAddIEAssocLength) |
| 6756 | { |
| 6757 | status = palAllocateMemory(pMac->hHdd, |
| 6758 | (void **)&pConnectProfile->pAddIEAssoc, pProfile->nAddIEAssocLength); |
| 6759 | if(!HAL_STATUS_SUCCESS(status)) |
| 6760 | { |
| 6761 | smsLog(pMac, LOGE, FL("Failed to allocate memory for additional IEs")) ; |
| 6762 | return eHAL_STATUS_FAILURE; |
| 6763 | } |
| 6764 | pConnectProfile->nAddIEAssocLength = pProfile->nAddIEAssocLength; |
| 6765 | palCopyMemory(pMac->hHdd, pConnectProfile->pAddIEAssoc, pProfile->pAddIEAssoc, |
| 6766 | pProfile->nAddIEAssocLength); |
| 6767 | } |
| 6768 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6769 | //Save bssid |
| 6770 | csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid); |
| 6771 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6772 | if (pSirBssDesc->mdiePresent) |
| 6773 | { |
| 6774 | pConnectProfile->MDID.mdiePresent = 1; |
| 6775 | pConnectProfile->MDID.mobilityDomain = (pSirBssDesc->mdie[1] << 8) | (pSirBssDesc->mdie[0]); |
| 6776 | } |
| 6777 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | d48e327 | 2013-04-12 14:21:07 -0700 | [diff] [blame] | 6778 | if( NULL == pIesTemp ) |
| 6779 | { |
| 6780 | status = csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp); |
| 6781 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6782 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6783 | if ((csrIsProfileCCX(pProfile) || |
| 6784 | ((pIesTemp->CCXVersion.present) |
| 6785 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 6786 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 6787 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 6788 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6789 | #ifdef WLAN_FEATURE_11W |
| 6790 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 6791 | #endif |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 6792 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6793 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6794 | { |
| 6795 | pConnectProfile->isCCXAssoc = 1; |
| 6796 | } |
| 6797 | #endif |
| 6798 | //save ssid |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6799 | if(HAL_STATUS_SUCCESS(status)) |
| 6800 | { |
| 6801 | if(pIesTemp->SSID.present) |
| 6802 | { |
| 6803 | pConnectProfile->SSID.length = pIesTemp->SSID.num_ssid; |
| 6804 | palCopyMemory(pMac->hHdd, pConnectProfile->SSID.ssId, |
| 6805 | pIesTemp->SSID.ssid, pIesTemp->SSID.num_ssid); |
| 6806 | } |
| 6807 | |
| 6808 | //Save the bss desc |
| 6809 | status = csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 6810 | |
| 6811 | if( CSR_IS_QOS_BSS(pIesTemp) || pIesTemp->HTCaps.present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6812 | { |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 6813 | //Some HT AP's dont send WMM IE so in that case we assume all HT Ap's are Qos Enabled AP's |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6814 | pConnectProfile->qap = TRUE; |
| 6815 | } |
| 6816 | else |
| 6817 | { |
| 6818 | pConnectProfile->qap = FALSE; |
| 6819 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6820 | if ( NULL == pIes ) |
| 6821 | { |
| 6822 | //Free memory if it allocated locally |
| 6823 | palFreeMemory(pMac->hHdd, pIesTemp); |
| 6824 | } |
| 6825 | } |
| 6826 | //Save Qos connection |
| 6827 | pConnectProfile->qosConnection = pMac->roam.roamSession[sessionId].fWMMConnection; |
| 6828 | |
| 6829 | if(!HAL_STATUS_SUCCESS(status)) |
| 6830 | { |
| 6831 | csrFreeConnectBssDesc(pMac, sessionId); |
| 6832 | } |
| 6833 | for(index = 0; index < pProfile->SSIDs.numOfSSIDs; index++) |
| 6834 | { |
| 6835 | if((pProfile->SSIDs.SSIDList[index].SSID.length == pConnectProfile->SSID.length) && |
| 6836 | palEqualMemory(pMac->hHdd, pProfile->SSIDs.SSIDList[index].SSID.ssId, |
| 6837 | pConnectProfile->SSID.ssId, pConnectProfile->SSID.length)) |
| 6838 | { |
| 6839 | pConnectProfile->handoffPermitted = pProfile->SSIDs.SSIDList[index].handoffPermitted; |
| 6840 | break; |
| 6841 | } |
| 6842 | pConnectProfile->handoffPermitted = FALSE; |
| 6843 | } |
| 6844 | |
| 6845 | return (status); |
| 6846 | } |
| 6847 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6848 | static void csrRoamJoinRspProcessor( tpAniSirGlobal pMac, tSirSmeJoinRsp *pSmeJoinRsp ) |
| 6849 | { |
| 6850 | tListElem *pEntry = NULL; |
| 6851 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6852 | //The head of the active list is the request we sent |
| 6853 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6854 | if(pEntry) |
| 6855 | { |
| 6856 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6857 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6858 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 6859 | { |
| 6860 | if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason) |
| 6861 | { |
| 6862 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6863 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 6864 | #endif |
| 6865 | } |
| 6866 | csrRoamComplete( pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp ); |
| 6867 | } |
| 6868 | else |
| 6869 | { |
| 6870 | tANI_U32 roamId = 0; |
| 6871 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6872 | if(!pSession) |
| 6873 | { |
| 6874 | smsLog(pMac, LOGE, FL(" session %d not found "), pSmeJoinRsp->sessionId); |
| 6875 | return; |
| 6876 | } |
| 6877 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6878 | |
| 6879 | //The head of the active list is the request we sent |
| 6880 | //Try to get back the same profile and roam again |
| 6881 | if(pCommand) |
| 6882 | { |
| 6883 | roamId = pCommand->u.roamCmd.roamId; |
| 6884 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6885 | pSession->joinFailStatusCode.statusCode = pSmeJoinRsp->statusCode; |
| 6886 | pSession->joinFailStatusCode.reasonCode = pSmeJoinRsp->protStatusCode; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6887 | smsLog( pMac, LOGW, "SmeJoinReq failed with statusCode= 0x%08lX [%d]", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6888 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 6889 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 6890 | if (csrRoamIsHandoffInProgress(pMac)) |
| 6891 | { |
| 6892 | csrRoamCallCallback(pMac, pSmeJoinRsp->sessionId, NULL, roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 6893 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 6894 | csrNeighborRoamIndicateConnect(pMac, pSmeJoinRsp->sessionId, VOS_STATUS_E_FAILURE); |
| 6895 | } |
| 6896 | #endif |
| 6897 | if (pCommand) |
| 6898 | { |
| 6899 | if(CSR_IS_WDS_STA( &pCommand->u.roamCmd.roamProfile )) |
| 6900 | { |
| 6901 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 6902 | pSession->connectedProfile.BSSType = eCSR_BSS_TYPE_WDS_STA; |
| 6903 | csrRoamReissueRoamCommand(pMac); |
| 6904 | } |
| 6905 | else if( CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) ) |
| 6906 | { |
| 6907 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6908 | } |
| 6909 | else |
| 6910 | { |
| 6911 | csrRoam(pMac, pCommand); |
| 6912 | } |
| 6913 | } |
| 6914 | else |
| 6915 | { |
| 6916 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6917 | } |
| 6918 | } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */ |
| 6919 | } |
| 6920 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6921 | eHalStatus csrRoamIssueJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 6922 | tDot11fBeaconIEs *pIes, |
| 6923 | tCsrRoamProfile *pProfile, tANI_U32 roamId ) |
| 6924 | { |
| 6925 | eHalStatus status; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6926 | smsLog( pMac, LOG1, "Attempting to Join Bssid= %02x-%02x-%02x-%02x-%02x-%02x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6927 | pSirBssDesc->bssId[ 0 ],pSirBssDesc->bssId[ 1 ],pSirBssDesc->bssId[ 2 ], |
| 6928 | pSirBssDesc->bssId[ 3 ],pSirBssDesc->bssId[ 4 ],pSirBssDesc->bssId[ 5 ] ); |
| 6929 | |
| 6930 | // Set the roaming substate to 'join attempt'... |
| 6931 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6932 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 6933 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6934 | return (status); |
| 6935 | } |
| 6936 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6937 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 6938 | tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile) |
| 6939 | { |
| 6940 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6941 | // Set the roaming substate to 'join attempt'... |
| 6942 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId ); |
| 6943 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6944 | smsLog(pMac, LOGE, FL(" calling csrSendJoinReqMsg (eWNI_SME_REASSOC_REQ)")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6945 | |
| 6946 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 6947 | return csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_REASSOC_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6948 | } |
| 6949 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6950 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac) |
| 6951 | { |
| 6952 | tListElem *pEntry; |
| 6953 | tSmeCmd *pCommand; |
| 6954 | tCsrRoamInfo roamInfo; |
| 6955 | tANI_U32 sessionId; |
| 6956 | tCsrRoamSession *pSession; |
| 6957 | |
| 6958 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6959 | if(pEntry) |
| 6960 | { |
| 6961 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6962 | if ( eSmeCommandRoam == pCommand->command ) |
| 6963 | { |
| 6964 | sessionId = pCommand->sessionId; |
| 6965 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6966 | |
| 6967 | if(!pSession) |
| 6968 | { |
| 6969 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6970 | return; |
| 6971 | } |
| 6972 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6973 | if( pCommand->u.roamCmd.fStopWds ) |
| 6974 | { |
| 6975 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 6976 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 6977 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 6978 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6979 | if (CSR_IS_WDS(&pSession->connectedProfile)){ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6980 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 6981 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 6982 | eCSR_ROAM_WDS_IND, |
| 6983 | eCSR_ROAM_RESULT_WDS_DISASSOCIATED); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6984 | }else if (CSR_IS_INFRA_AP(&pSession->connectedProfile)){ |
| 6985 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 6986 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 6987 | eCSR_ROAM_INFRA_IND, |
| 6988 | eCSR_ROAM_RESULT_INFRA_DISASSOCIATED); |
| 6989 | } |
| 6990 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6991 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6992 | if( !HAL_STATUS_SUCCESS( csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ) ) ) |
| 6993 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6994 | smsLog(pMac, LOGE, " Failed to reissue stop_bss command for WDS after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6995 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6996 | } |
| 6997 | } |
| 6998 | else if(eCsrStopRoaming == csrRoamJoinNextBss(pMac, pCommand, eANI_BOOLEAN_TRUE)) |
| 6999 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7000 | smsLog(pMac, LOGW, " Failed to reissue join command after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7001 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7002 | } |
| 7003 | } |
| 7004 | else |
| 7005 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7006 | smsLog(pMac, LOGW, " Command is not roaming after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7007 | } |
| 7008 | } |
| 7009 | else |
| 7010 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7011 | smsLog(pMac, LOGE, " Disassoc rsp cannot continue because no command is available"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7012 | } |
| 7013 | } |
| 7014 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7015 | tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 7016 | { |
| 7017 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7018 | tListElem *pEntry; |
| 7019 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7020 | //alwasy lock active list before locking pending list |
| 7021 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7022 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7023 | if(pEntry) |
| 7024 | { |
| 7025 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7026 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7027 | { |
| 7028 | fRet = eANI_BOOLEAN_TRUE; |
| 7029 | } |
| 7030 | } |
| 7031 | if(eANI_BOOLEAN_FALSE == fRet) |
| 7032 | { |
| 7033 | csrLLLock(&pMac->sme.smeCmdPendingList); |
| 7034 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK); |
| 7035 | while(pEntry) |
| 7036 | { |
| 7037 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7038 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7039 | { |
| 7040 | fRet = eANI_BOOLEAN_TRUE; |
| 7041 | break; |
| 7042 | } |
| 7043 | pEntry = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK); |
| 7044 | } |
| 7045 | csrLLUnlock(&pMac->sme.smeCmdPendingList); |
| 7046 | } |
| 7047 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7048 | return (fRet); |
| 7049 | } |
| 7050 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7051 | tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac) |
| 7052 | { |
| 7053 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7054 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7055 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 7056 | { |
| 7057 | if( CSR_IS_SESSION_VALID( pMac, i ) && ( fRet = csrIsRoamCommandWaitingForSession( pMac, i ) ) ) |
| 7058 | { |
| 7059 | break; |
| 7060 | } |
| 7061 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7062 | return ( fRet ); |
| 7063 | } |
| 7064 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7065 | tANI_BOOLEAN csrIsCommandWaiting(tpAniSirGlobal pMac) |
| 7066 | { |
| 7067 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7068 | //alwasy lock active list before locking pending list |
| 7069 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7070 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7071 | if(eANI_BOOLEAN_FALSE == fRet) |
| 7072 | { |
| 7073 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK); |
| 7074 | } |
| 7075 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7076 | return (fRet); |
| 7077 | } |
| 7078 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7079 | tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac ) |
| 7080 | { |
| 7081 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7082 | tListElem *pEntry; |
| 7083 | tCsrCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7084 | //alwasy lock active list before locking pending list |
| 7085 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7086 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7087 | if( pEntry ) |
| 7088 | { |
| 7089 | pCommand = GET_BASE_ADDR(pEntry, tCsrCmd, Link); |
| 7090 | if( ( eCsrRoamCommandScan == pCommand->command ) && |
| 7091 | ( ( eCsrScanForSsid == pCommand->u.scanCmd.reason ) || |
| 7092 | ( eCsrScanForCapsChange == pCommand->u.scanCmd.reason ) || |
| 7093 | ( eCsrScanP2PFindPeer == pCommand->u.scanCmd.reason ) ) ) |
| 7094 | { |
| 7095 | fRet = eANI_BOOLEAN_TRUE; |
| 7096 | } |
| 7097 | } |
| 7098 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7099 | return (fRet); |
| 7100 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7101 | eHalStatus csrRoamIssueReassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 7102 | { |
| 7103 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7104 | tSmeCmd *pCommand = NULL; |
| 7105 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_TRUE; |
| 7106 | tANI_BOOLEAN fRemoveCmd = FALSE; |
| 7107 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7108 | // Delete the old assoc command. All is setup for reassoc to be serialized |
| 7109 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 7110 | if ( pEntry ) |
| 7111 | { |
| 7112 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 7113 | if ( !pCommand ) |
| 7114 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7115 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7116 | return eHAL_STATUS_RESOURCES; |
| 7117 | } |
| 7118 | if ( eSmeCommandRoam == pCommand->command ) |
| 7119 | { |
| 7120 | if (pCommand->u.roamCmd.roamReason == eCsrSmeIssuedAssocToSimilarAP) |
| 7121 | { |
| 7122 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 7123 | } |
| 7124 | else |
| 7125 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7126 | smsLog( pMac, LOGE, FL(" Unexpected active roam command present ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7127 | } |
| 7128 | if (fRemoveCmd == FALSE) |
| 7129 | { |
| 7130 | // Implies we did not get the serialized assoc command we |
| 7131 | // were expecting |
| 7132 | pCommand = NULL; |
| 7133 | } |
| 7134 | } |
| 7135 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7136 | if(NULL == pCommand) |
| 7137 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7138 | smsLog( pMac, LOGE, FL(" fail to get command buffer as expected based on previous connect roam command") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7139 | return eHAL_STATUS_RESOURCES; |
| 7140 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7141 | do |
| 7142 | { |
| 7143 | //Change the substate in case it is wait-for-key |
| 7144 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7145 | { |
| 7146 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7147 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 7148 | } |
| 7149 | pCommand->command = eSmeCommandRoam; |
| 7150 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7151 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedFTReassoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7152 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 7153 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7154 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7155 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7156 | csrReleaseCommandRoam( pMac, pCommand ); |
| 7157 | } |
| 7158 | } while( 0 ); |
| 7159 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7160 | return( status ); |
| 7161 | } |
| 7162 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ) |
| 7163 | { |
| 7164 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7165 | tCsrScanResult *pScanResult = NULL; |
| 7166 | tSirBssDescription *pBssDesc = NULL; |
| 7167 | tSmeCmd *pCommand = NULL; |
| 7168 | tANI_U32 sessionId; |
| 7169 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7170 | if(NULL == pEntry) |
| 7171 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7172 | smsLog(pMac, LOGW, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7173 | return; |
| 7174 | } |
| 7175 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7176 | sessionId = pCommand->sessionId; |
| 7177 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7178 | |
| 7179 | if(!pSession) |
| 7180 | { |
| 7181 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7182 | return; |
| 7183 | } |
| 7184 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7185 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 7186 | { |
| 7187 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7188 | smsLog(pMac, LOGW, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7189 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 7190 | } |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 7191 | /* If the roaming has stopped, not to continue the roaming command*/ |
| 7192 | else if ( !CSR_IS_ROAMING(pSession) && CSR_IS_ROAMING_COMMAND(pCommand) ) |
| 7193 | { |
| 7194 | //No need to complete roaming here as it already completes |
| 7195 | smsLog(pMac, LOGW, FL(" Roam command (reason %d) aborted due to roaming completed\n"), |
| 7196 | pCommand->u.roamCmd.roamReason); |
| 7197 | csrSetAbortRoamingCommand( pMac, pCommand ); |
| 7198 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 7199 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7200 | else |
| 7201 | { |
| 7202 | if ( CCM_IS_RESULT_SUCCESS(result) ) |
| 7203 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7204 | smsLog(pMac, LOG2, "Cfg sequence complete"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7205 | // Successfully set the configuration parameters for the new Bss. Attempt to |
| 7206 | // join the roaming Bss. |
| 7207 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 7208 | { |
| 7209 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 7210 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 7211 | } |
| 7212 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) || |
| 7213 | CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7214 | || CSR_IS_INFRA_AP(&pCommand->u.roamCmd.roamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7215 | ) |
| 7216 | { |
| 7217 | if(!HAL_STATUS_SUCCESS(csrRoamIssueStartBss( pMac, sessionId, |
| 7218 | &pSession->bssParams, &pCommand->u.roamCmd.roamProfile, |
| 7219 | pBssDesc, pCommand->u.roamCmd.roamId ))) |
| 7220 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7221 | smsLog(pMac, LOGW, " CSR start BSS failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7222 | //We need to complete the command |
| 7223 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7224 | } |
| 7225 | } |
| 7226 | else |
| 7227 | { |
| 7228 | if (!pCommand->u.roamCmd.pRoamBssEntry) |
| 7229 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7230 | smsLog(pMac, LOGW, " pRoamBssEntry is NULL"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7231 | //We need to complete the command |
| 7232 | csrRoamComplete(pMac, eCsrJoinFailure, NULL); |
| 7233 | return; |
| 7234 | } |
| 7235 | // If we are roaming TO an Infrastructure BSS... |
| 7236 | VOS_ASSERT(pScanResult != NULL); |
| 7237 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7238 | { |
| 7239 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7240 | if(pIesLocal || (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 7241 | { |
| 7242 | // ..and currently in an Infrastructure connection.... |
| 7243 | if( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 7244 | { |
| 7245 | // ...and the SSIDs are equal, then we Reassoc. |
| 7246 | if ( csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, |
| 7247 | pIesLocal ) ) |
| 7248 | // ..and currently in an infrastructure connection |
| 7249 | { |
| 7250 | // then issue a Reassoc. |
| 7251 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
| 7252 | csrRoamIssueReassociate( pMac, sessionId, pBssDesc, pIesLocal, |
| 7253 | &pCommand->u.roamCmd.roamProfile ); |
| 7254 | } |
| 7255 | else |
| 7256 | { |
| 7257 | |
| 7258 | // otherwise, we have to issue a new Join request to LIM because we disassociated from the |
| 7259 | // previously associated AP. |
| 7260 | if(!HAL_STATUS_SUCCESS(csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7261 | pIesLocal, |
| 7262 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ))) |
| 7263 | { |
| 7264 | //try something else |
| 7265 | csrRoam( pMac, pCommand ); |
| 7266 | } |
| 7267 | } |
| 7268 | } |
| 7269 | else |
| 7270 | { |
| 7271 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7272 | |
| 7273 | /* We need to come with other way to figure out that this is because of HO in BMP |
| 7274 | The below API will be only available for Android as it uses a different HO algorithm */ |
| 7275 | /* Reassoc request will be used only for CCX and 11r handoff whereas other legacy roaming should |
| 7276 | * use join request */ |
| 7277 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7278 | if (csrRoamIsHandoffInProgress(pMac) && |
| 7279 | csrRoamIs11rAssoc(pMac)) |
| 7280 | { |
| 7281 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 7282 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 7283 | } |
| 7284 | else |
| 7285 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7286 | #ifdef FEATURE_WLAN_CCX |
| 7287 | if (csrRoamIsHandoffInProgress(pMac) && |
| 7288 | csrRoamIsCCXAssoc(pMac)) |
| 7289 | { |
| 7290 | // Now serialize the reassoc command. |
| 7291 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7292 | } |
| 7293 | else |
| 7294 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7295 | #ifdef FEATURE_WLAN_LFR |
| 7296 | if (csrRoamIsHandoffInProgress(pMac) && |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 7297 | csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7298 | { |
| 7299 | // Now serialize the reassoc command. |
| 7300 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7301 | } |
| 7302 | else |
| 7303 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7304 | // else we are not connected and attempting to Join. Issue the |
| 7305 | // Join request. |
| 7306 | { |
| 7307 | status = csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7308 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), |
| 7309 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ); |
| 7310 | } |
| 7311 | if(!HAL_STATUS_SUCCESS(status)) |
| 7312 | { |
| 7313 | //try something else |
| 7314 | csrRoam( pMac, pCommand ); |
| 7315 | } |
| 7316 | } |
| 7317 | if( !pScanResult->Result.pvIes ) |
| 7318 | { |
| 7319 | //Locally allocated |
| 7320 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 7321 | } |
| 7322 | } |
| 7323 | }//if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7324 | else |
| 7325 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7326 | smsLog(pMac, LOGW, FL(" found BSSType mismatching the one in BSS description")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7327 | } |
| 7328 | }//else |
| 7329 | }//if ( WNI_CFG_SUCCESS == result ) |
| 7330 | else |
| 7331 | { |
| 7332 | // In the event the configuration failed, for infra let the roam processor |
| 7333 | //attempt to join something else... |
| 7334 | if( pCommand->u.roamCmd.pRoamBssEntry && CSR_IS_INFRASTRUCTURE( &pCommand->u.roamCmd.roamProfile ) ) |
| 7335 | { |
| 7336 | csrRoam(pMac, pCommand); |
| 7337 | } |
| 7338 | else |
| 7339 | { |
| 7340 | //We need to complete the command |
| 7341 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) ) |
| 7342 | { |
| 7343 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7344 | } |
| 7345 | else |
| 7346 | { |
| 7347 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7348 | } |
| 7349 | } |
| 7350 | } |
| 7351 | }//we have active entry |
| 7352 | } |
| 7353 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7354 | static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp ) |
| 7355 | { |
| 7356 | //No one is sending eWNI_SME_AUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7357 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7358 | if ( eSIR_SME_SUCCESS == pSmeAuthRsp->statusCode ) |
| 7359 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7360 | smsLog( pMac, LOGW, "CSR SmeAuthReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7361 | // Successfully authenticated with a new Bss. Attempt to stop the current Bss and |
| 7362 | // join the new one... |
| 7363 | /***pBssDesc = profGetRoamingBssDesc( pAdapter, &pHddProfile ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7364 | roamStopNetwork( pAdapter, &pBssDesc->SirBssDescription );***/ |
| 7365 | } |
| 7366 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7367 | smsLog( pMac, LOGW, "CSR SmeAuthReq failed with statusCode= 0x%08lX [%d]", pSmeAuthRsp->statusCode, pSmeAuthRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7368 | /***profHandleLostLinkAfterReset(pAdapter); |
| 7369 | // In the event the authenticate fails, let the roam processor attempt to join something else... |
| 7370 | roamRoam( pAdapter );***/ |
| 7371 | } |
| 7372 | } |
| 7373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7374 | static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSmeJoinRsp pSmeJoinRsp ) |
| 7375 | { |
| 7376 | eCsrRoamCompleteResult result; |
| 7377 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 7378 | tCsrRoamInfo roamInfo; |
| 7379 | tANI_U32 roamId = 0; |
| 7380 | |
| 7381 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 7382 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7383 | smsLog( pMac, LOGW, "CSR SmeReassocReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7384 | result = eCsrReassocSuccess; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7385 | /* Defeaturize this part later if needed */ |
| 7386 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7387 | /* Since the neighbor roam algorithm uses reassoc req for handoff instead of join, |
| 7388 | * we need the response contents while processing the result in csrRoamProcessResults() */ |
| 7389 | if (csrRoamIsHandoffInProgress(pMac)) |
| 7390 | { |
| 7391 | /* Need to dig more on indicating events to SME QoS module */ |
| 7392 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 7393 | csrRoamComplete( pMac, result, pSmeJoinRsp); |
| 7394 | } |
| 7395 | else |
| 7396 | #endif |
| 7397 | { |
| 7398 | csrRoamComplete( pMac, result, NULL ); |
| 7399 | } |
| 7400 | } |
| 7401 | /* Should we handle this similar to handling the join failure? Is it ok |
| 7402 | * to call csrRoamComplete() with state as CsrJoinFailure */ |
| 7403 | else |
| 7404 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7405 | smsLog( pMac, LOGW, "CSR SmeReassocReq failed with statusCode= 0x%08lX [%d]", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7406 | result = eCsrReassocFailure; |
| 7407 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7408 | if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) || |
| 7409 | (eSIR_SME_FT_REASSOC_FAILURE == pSmeJoinRsp->statusCode)) |
| 7410 | { |
| 7411 | // Inform HDD to turn off FT flag in HDD |
| 7412 | if (pNeighborRoamInfo) |
| 7413 | { |
| 7414 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7415 | csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, |
| 7416 | &roamInfo, roamId, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
Madan Mohan Koyyalamudi | 5777216 | 2012-10-18 19:46:14 -0700 | [diff] [blame] | 7417 | /* |
| 7418 | * Since the above callback sends a disconnect |
| 7419 | * to HDD, we should clean-up our state |
| 7420 | * machine as well to be in sync with the upper |
| 7421 | * layers. There is no need to send a disassoc |
| 7422 | * since: 1) we will never reassoc to the current |
| 7423 | * AP in LFR, and 2) there is no need to issue a |
| 7424 | * disassoc to the AP with which we were trying |
| 7425 | * to reassoc. |
| 7426 | */ |
| 7427 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7428 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7429 | } |
| 7430 | } |
| 7431 | #endif |
| 7432 | // In the event that the Reassociation fails, then we need to Disassociate the current association and keep |
| 7433 | // roaming. Note that we will attempt to Join the AP instead of a Reassoc since we may have attempted a |
| 7434 | // 'Reassoc to self', which AP's that don't support Reassoc will force a Disassoc. |
| 7435 | //The disassoc rsp message will remove the command from active list |
| 7436 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, pSmeJoinRsp->sessionId, |
| 7437 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE ))) |
| 7438 | { |
| 7439 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7440 | } |
| 7441 | } |
| 7442 | } |
| 7443 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7444 | static void csrRoamRoamingStateStopBssRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSmeRsp) |
| 7445 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7446 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7447 | { |
| 7448 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7449 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 7450 | if(pIbssLog) |
| 7451 | { |
| 7452 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_RSP; |
| 7453 | if(eSIR_SME_SUCCESS != pSmeRsp->statusCode) |
| 7454 | { |
| 7455 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 7456 | } |
| 7457 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 7458 | } |
| 7459 | } |
| 7460 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7461 | pMac->roam.roamSession[pSmeRsp->sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7462 | if(CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, pSmeRsp->sessionId)) |
| 7463 | { |
| 7464 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7465 | } |
| 7466 | else if(CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId)) |
| 7467 | { |
| 7468 | csrRoamReissueRoamCommand(pMac); |
| 7469 | } |
| 7470 | } |
| 7471 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7472 | void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeRsp ) |
| 7473 | { |
| 7474 | tSirResultCodes statusCode; |
| 7475 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7476 | tScanResultHandle hBSSList; |
| 7477 | tANI_BOOLEAN fCallCallback, fRemoveCmd; |
| 7478 | eHalStatus status; |
| 7479 | tCsrRoamInfo roamInfo; |
| 7480 | tCsrScanResultFilter *pScanFilter = NULL; |
| 7481 | tANI_U32 roamId = 0; |
| 7482 | tCsrRoamProfile *pCurRoamProfile = NULL; |
| 7483 | tListElem *pEntry = NULL; |
| 7484 | tSmeCmd *pCommand = NULL; |
| 7485 | #endif |
| 7486 | tANI_U32 sessionId; |
| 7487 | tCsrRoamSession *pSession; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7489 | tSirSmeDisassocRsp SmeDisassocRsp; |
| 7490 | |
| 7491 | csrSerDesUnpackDiassocRsp((tANI_U8 *)pSmeRsp, &SmeDisassocRsp); |
| 7492 | sessionId = SmeDisassocRsp.sessionId; |
| 7493 | statusCode = SmeDisassocRsp.statusCode; |
| 7494 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7495 | smsLog( pMac, LOG2, "csrRoamRoamingStateDisassocRspProcessor sessionId %d", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7496 | |
| 7497 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 7498 | { |
| 7499 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7500 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7501 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7502 | |
| 7503 | if(!pSession) |
| 7504 | { |
| 7505 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7506 | return; |
| 7507 | } |
| 7508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7509 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) ) |
| 7510 | { |
| 7511 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7512 | } |
| 7513 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, sessionId ) || |
| 7514 | CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, sessionId ) ) |
| 7515 | { |
| 7516 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7517 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7518 | smsLog( pMac, LOG2, "CSR SmeDisassocReq force disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7519 | //A callback to HDD will be issued from csrRoamComplete so no need to do anything here |
| 7520 | } |
| 7521 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7522 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7523 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId ) ) |
| 7524 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7525 | smsLog( pMac, LOGE, "CSR SmeDisassocReq due to HO on session %d", sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7526 | #if defined (WLAN_FEATURE_NEIGHBOR_ROAMING) |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7527 | /* |
| 7528 | * First ensure if the roam profile is in the scan cache. |
| 7529 | * If not, post a reassoc failure and disconnect. |
| 7530 | */ |
| 7531 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 7532 | if(HAL_STATUS_SUCCESS(status)) |
| 7533 | { |
| 7534 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 7535 | status = csrRoamPrepareFilterFromProfile(pMac, |
| 7536 | &pMac->roam.neighborRoamInfo.csrNeighborRoamProfile, pScanFilter); |
| 7537 | if(!HAL_STATUS_SUCCESS(status)) |
| 7538 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7539 | smsLog(pMac, LOGE, "%s: failed to prepare scan filter with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7540 | __func__, status); |
| 7541 | goto POST_ROAM_FAILURE; |
| 7542 | } |
| 7543 | else |
| 7544 | { |
| 7545 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 7546 | if (!HAL_STATUS_SUCCESS(status)) |
| 7547 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7548 | smsLog( pMac, LOGE,"%s: csrScanGetResult failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7549 | __func__, status); |
| 7550 | goto POST_ROAM_FAILURE; |
| 7551 | } |
| 7552 | } |
| 7553 | } |
| 7554 | else |
| 7555 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7556 | smsLog( pMac, LOGE,"%s: alloc for pScanFilter failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7557 | __func__, status); |
| 7558 | goto POST_ROAM_FAILURE; |
| 7559 | } |
| 7560 | |
| 7561 | /* |
| 7562 | * After ensuring that the roam profile is in the scan result list, |
| 7563 | * dequeue the command from the active list. |
| 7564 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7565 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 7566 | if ( pEntry ) |
| 7567 | { |
| 7568 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7569 | /* If the head of the queue is Active and it is a ROAM command, remove |
| 7570 | * and put this on the Free queue. |
| 7571 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7572 | if ( eSmeCommandRoam == pCommand->command ) |
| 7573 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7574 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7575 | /* |
| 7576 | * we need to process the result first before removing it from active list |
| 7577 | * because state changes still happening insides roamQProcessRoamResults so |
| 7578 | * no other roam command should be issued. |
| 7579 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7580 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 7581 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 7582 | { |
| 7583 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 7584 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 7585 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7586 | if( fRemoveCmd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7587 | csrReleaseCommandRoam( pMac, pCommand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7588 | else |
| 7589 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7590 | smsLog( pMac, LOGE, "%s: fail to remove cmd reason %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7591 | __func__, pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7592 | } |
| 7593 | } |
| 7594 | else |
| 7595 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7596 | smsLog( pMac, LOGE, "%s: roam command not active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7597 | } |
| 7598 | } |
| 7599 | else |
| 7600 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7601 | smsLog( pMac, LOGE, "%s: NO commands are active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7602 | } |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7603 | |
| 7604 | /* Notify HDD about handoff and provide the BSSID too */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7605 | roamInfo.reasonCode = eCsrRoamReasonBetterAP; |
| 7606 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7607 | palCopyMemory(pMac->hHdd, roamInfo.bssid, |
| 7608 | pMac->roam.neighborRoamInfo.csrNeighborRoamProfile.BSSIDs.bssid, |
| 7609 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7610 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7611 | csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, |
| 7612 | eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7613 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7614 | /* Copy the connected profile to apply the same for this connection as well */ |
| 7615 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 7616 | (void **)&pCurRoamProfile, sizeof(tCsrRoamProfile)))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7617 | { |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7618 | palZeroMemory(pMac->hHdd, pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 7619 | csrRoamCopyProfile(pMac, pCurRoamProfile, pSession->pCurRoamProfile); |
| 7620 | //make sure to put it at the head of the cmd queue |
| 7621 | status = csrRoamIssueConnect(pMac, sessionId, pCurRoamProfile, |
| 7622 | hBSSList, eCsrSmeIssuedAssocToSimilarAP, |
| 7623 | roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE); |
| 7624 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7625 | if(!HAL_STATUS_SUCCESS(status)) |
| 7626 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7627 | smsLog( pMac, LOGE,"%s: csrRoamIssueConnect failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7628 | __func__, status); |
| 7629 | fCallCallback = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7630 | } |
| 7631 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7632 | /* Notify sub-modules like QoS etc. that handoff happening */ |
| 7633 | sme_QosCsrEventInd(pMac, sessionId, SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 7634 | csrReleaseProfile(pMac, pCurRoamProfile); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7635 | palFreeMemory(pMac->hHdd, pCurRoamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7636 | csrFreeScanFilter(pMac, pScanFilter); |
| 7637 | palFreeMemory( pMac->hHdd, pScanFilter ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7638 | return; |
| 7639 | } |
| 7640 | |
| 7641 | POST_ROAM_FAILURE: |
| 7642 | if (pScanFilter) |
| 7643 | { |
| 7644 | csrFreeScanFilter(pMac, pScanFilter); |
| 7645 | palFreeMemory( pMac->hHdd, pScanFilter ); |
| 7646 | } |
| 7647 | if (pCurRoamProfile) |
| 7648 | palFreeMemory(pMac->hHdd, pCurRoamProfile); |
| 7649 | |
| 7650 | /* Inform the upper layers that the reassoc failed */ |
| 7651 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7652 | csrRoamCallCallback(pMac, sessionId, |
| 7653 | &roamInfo, 0, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
| 7654 | |
| 7655 | /* |
| 7656 | * Issue a disassoc request so that PE/LIM uses this to clean-up the FT session. |
| 7657 | * Upon success, we would re-enter this routine after receiving the disassoc |
| 7658 | * response and will fall into the reassoc fail sub-state. And, eventually |
| 7659 | * call csrRoamComplete which would remove the roam command from SME active |
| 7660 | * queue. |
| 7661 | */ |
| 7662 | if (!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate(pMac, sessionId, |
| 7663 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE))) |
| 7664 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7665 | smsLog( pMac, LOGE,"%s: csrRoamIssueDisassociate failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7666 | __func__, status); |
| 7667 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7668 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7669 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7670 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7671 | } //else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) ) |
| 7672 | else if ( CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, sessionId ) ) |
| 7673 | { |
| 7674 | // Disassoc due to Reassoc failure falls into this codepath.... |
| 7675 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7676 | } |
| 7677 | else |
| 7678 | { |
| 7679 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7680 | { |
| 7681 | // Successfully disassociated from the 'old' Bss... |
| 7682 | // |
| 7683 | // We get Disassociate response in three conditions. |
| 7684 | // - First is the case where we are disasociating from an Infra Bss to start an IBSS. |
| 7685 | // - Second is the when we are disassociating from an Infra Bss to join an IBSS or a new |
| 7686 | // Infrastructure network. |
| 7687 | // - Third is where we are doing an Infra to Infra roam between networks with different |
| 7688 | // SSIDs. In all cases, we set the new Bss configuration here and attempt to join |
| 7689 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7690 | smsLog( pMac, LOG2, "CSR SmeDisassocReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7691 | } |
| 7692 | else |
| 7693 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7694 | smsLog( pMac, LOGE, "SmeDisassocReq failed with statusCode= 0x%08lX", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7695 | } |
| 7696 | //We are not done yet. Get the data and continue roaming |
| 7697 | csrRoamReissueRoamCommand(pMac); |
| 7698 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7699 | } |
| 7700 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7701 | static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp ) |
| 7702 | { |
| 7703 | tSirResultCodes statusCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7704 | //No one is sending eWNI_SME_DEAUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7705 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7706 | statusCode = csrGetDeAuthRspStatusCode( pSmeRsp ); |
| 7707 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 7708 | { |
| 7709 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7710 | } |
| 7711 | else |
| 7712 | { |
| 7713 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7714 | { |
| 7715 | // Successfully deauth from the 'old' Bss... |
| 7716 | // |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7717 | smsLog( pMac, LOG2, "CSR SmeDeauthReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7718 | } |
| 7719 | else |
| 7720 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7721 | smsLog( pMac, LOGW, "SmeDeauthReq failed with statusCode= 0x%08lX", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7722 | } |
| 7723 | //We are not done yet. Get the data and continue roaming |
| 7724 | csrRoamReissueRoamCommand(pMac); |
| 7725 | } |
| 7726 | } |
| 7727 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7728 | static void csrRoamRoamingStateStartBssRspProcessor( tpAniSirGlobal pMac, tSirSmeStartBssRsp *pSmeStartBssRsp ) |
| 7729 | { |
| 7730 | eCsrRoamCompleteResult result; |
| 7731 | |
| 7732 | if ( eSIR_SME_SUCCESS == pSmeStartBssRsp->statusCode ) |
| 7733 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7734 | smsLog( pMac, LOGW, "SmeStartBssReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7735 | result = eCsrStartBssSuccess; |
| 7736 | } |
| 7737 | else |
| 7738 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7739 | smsLog( pMac, LOGW, "SmeStartBssReq failed with statusCode= 0x%08lX", pSmeStartBssRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7740 | //Let csrRoamComplete decide what to do |
| 7741 | result = eCsrStartBssFailure; |
| 7742 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7743 | csrRoamComplete( pMac, result, pSmeStartBssRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7744 | } |
| 7745 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7746 | /* |
| 7747 | We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of strucutres. |
| 7748 | It depends on how the message is constructed. If the message is sent by limSendSmeRsp, |
| 7749 | the pMsgBuf is only a generic response and can only be used as pointer to tSirSmeRsp. |
| 7750 | For the messages where sender allocates memory for specific structures, then it can be |
| 7751 | cast accordingly. |
| 7752 | */ |
| 7753 | void csrRoamingStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 7754 | { |
| 7755 | tSirSmeRsp *pSmeRsp; |
| 7756 | tSmeIbssPeerInd *pIbssPeerInd; |
| 7757 | tCsrRoamInfo roamInfo; |
| 7758 | // TODO Session Id need to be acquired in this function |
| 7759 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7760 | pSmeRsp = (tSirSmeRsp *)pMsgBuf; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7761 | smsLog( pMac, LOG2, "Message %d[0x%04X] received in substate %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7762 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 7763 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7764 | pSmeRsp->messageType = (pSmeRsp->messageType); |
| 7765 | pSmeRsp->length = (pSmeRsp->length); |
| 7766 | pSmeRsp->statusCode = (pSmeRsp->statusCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7767 | switch (pSmeRsp->messageType) |
| 7768 | { |
| 7769 | |
| 7770 | case eWNI_SME_JOIN_RSP: // in Roaming state, process the Join response message... |
| 7771 | if (CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, pSmeRsp->sessionId)) |
| 7772 | { |
| 7773 | //We sent a JOIN_REQ |
| 7774 | csrRoamJoinRspProcessor( pMac, (tSirSmeJoinRsp *)pSmeRsp ); |
| 7775 | } |
| 7776 | break; |
| 7777 | |
| 7778 | case eWNI_SME_AUTH_RSP: // or the Authenticate response message... |
| 7779 | if (CSR_IS_ROAM_SUBSTATE_AUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 7780 | { |
| 7781 | //We sent a AUTH_REQ |
| 7782 | csrRoamRoamingStateAuthRspProcessor( pMac, (tSirSmeAuthRsp *)pSmeRsp ); |
| 7783 | } |
| 7784 | break; |
| 7785 | |
| 7786 | case eWNI_SME_REASSOC_RSP: // or the Reassociation response message... |
| 7787 | if (CSR_IS_ROAM_SUBSTATE_REASSOC_REQ( pMac, pSmeRsp->sessionId) ) |
| 7788 | { |
| 7789 | csrRoamRoamingStateReassocRspProcessor( pMac, (tpSirSmeJoinRsp )pSmeRsp ); |
| 7790 | } |
| 7791 | break; |
| 7792 | |
| 7793 | case eWNI_SME_STOP_BSS_RSP: // or the Stop Bss response message... |
| 7794 | { |
| 7795 | csrRoamRoamingStateStopBssRspProcessor(pMac, pSmeRsp); |
| 7796 | } |
| 7797 | break; |
| 7798 | |
| 7799 | case eWNI_SME_DISASSOC_RSP: // or the Disassociate response message... |
| 7800 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, pSmeRsp->sessionId ) || |
| 7801 | CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, pSmeRsp->sessionId ) || |
| 7802 | CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, pSmeRsp->sessionId ) || |
| 7803 | CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, pSmeRsp->sessionId ) || |
| 7804 | CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId ) || |
| 7805 | //HO |
| 7806 | CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, pSmeRsp->sessionId ) ) |
| 7807 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7808 | smsLog(pMac, LOG1, FL("eWNI_SME_DISASSOC_RSP subState = %d"), pMac->roam.curSubState[pSmeRsp->sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7809 | csrRoamRoamingStateDisassocRspProcessor( pMac, (tSirSmeDisassocRsp *)pSmeRsp ); |
| 7810 | } |
| 7811 | break; |
| 7812 | |
| 7813 | case eWNI_SME_DEAUTH_RSP: // or the Deauthentication response message... |
| 7814 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId ) ) |
| 7815 | { |
| 7816 | csrRoamRoamingStateDeauthRspProcessor( pMac, (tSirSmeDeauthRsp *)pSmeRsp ); |
| 7817 | } |
| 7818 | break; |
| 7819 | |
| 7820 | case eWNI_SME_START_BSS_RSP: // or the Start BSS response message... |
| 7821 | if (CSR_IS_ROAM_SUBSTATE_START_BSS_REQ( pMac, pSmeRsp->sessionId ) ) |
| 7822 | { |
| 7823 | csrRoamRoamingStateStartBssRspProcessor( pMac, (tSirSmeStartBssRsp *)pSmeRsp ); |
| 7824 | } |
| 7825 | break; |
| 7826 | |
| 7827 | case WNI_CFG_SET_CNF: // process the Config Confirm messages when we are in 'Config' substate... |
| 7828 | if ( CSR_IS_ROAM_SUBSTATE_CONFIG( pMac, pSmeRsp->sessionId ) ) |
| 7829 | { |
| 7830 | csrRoamingStateConfigCnfProcessor( pMac, ((tCsrCfgSetRsp *)pSmeRsp)->respStatus ); |
| 7831 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7832 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7833 | //In case CSR issues STOP_BSS, we need to tell HDD about peer departed becasue PE is removing them |
| 7834 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 7835 | pIbssPeerInd = (tSmeIbssPeerInd*)pSmeRsp; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7836 | smsLog(pMac, LOGE, "CSR: Peer departed notification from LIM in joining state"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7837 | palZeroMemory( pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo) ); |
| 7838 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 7839 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 7840 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 7841 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 7842 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 7843 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 7844 | eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 7845 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7846 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7847 | smsLog( pMac, LOG1, "Unexpected message type = %d[0x%X] received in substate %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7848 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 7849 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
| 7850 | |
| 7851 | //If we are connected, check the link status change |
| 7852 | if(!csrIsConnStateDisconnected(pMac, sessionId)) |
| 7853 | { |
| 7854 | csrRoamCheckForLinkStatusChange( pMac, pSmeRsp ); |
| 7855 | } |
| 7856 | break; |
| 7857 | } |
| 7858 | } |
| 7859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7860 | void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 7861 | { |
| 7862 | tSirSmeRsp *pSirMsg = (tSirSmeRsp *)pMsgBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7863 | switch (pSirMsg->messageType) |
| 7864 | { |
| 7865 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7866 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7867 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 7868 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7869 | case eWNI_SME_UPPER_LAYER_ASSOC_CNF: |
| 7870 | { |
| 7871 | tCsrRoamSession *pSession; |
| 7872 | tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf; |
| 7873 | tCsrRoamInfo roamInfo; |
| 7874 | tCsrRoamInfo *pRoamInfo = NULL; |
| 7875 | tANI_U32 sessionId; |
| 7876 | eHalStatus status; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7877 | smsLog( pMac, LOG1, FL("ASSOCIATION confirmation can be given to upper layer ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7878 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 7879 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7880 | pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf; |
| 7881 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId ); |
| 7882 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7883 | |
| 7884 | if(!pSession) |
| 7885 | { |
| 7886 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7887 | return; |
| 7888 | } |
| 7889 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7890 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 7891 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7892 | pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid; |
| 7893 | pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length; |
| 7894 | pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7895 | pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length; |
| 7896 | pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7897 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, sizeof(tSirMacAddr)); |
| 7898 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7899 | pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7900 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) ) |
| 7901 | { |
| 7902 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED; |
| 7903 | pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq; |
| 7904 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 7905 | } |
| 7906 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 7907 | { |
| 7908 | vos_sleep( 100 ); |
| 7909 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta |
| 7910 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
| 7911 | } |
| 7912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7913 | } |
| 7914 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7915 | default: |
| 7916 | csrRoamCheckForLinkStatusChange( pMac, pSirMsg ); |
| 7917 | break; |
| 7918 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7919 | } |
| 7920 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7921 | eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, |
| 7922 | tSirBssDescription *pBssDescription, |
| 7923 | tSirMacAddr *bssId, tANI_BOOLEAN addKey, |
| 7924 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 7925 | tANI_U8 keyId, tANI_U16 keyLength, |
| 7926 | tANI_U8 *pKey, tANI_U8 paeRole ) |
| 7927 | { |
| 7928 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7929 | tAniEdType edType; |
| 7930 | |
| 7931 | if(eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType) |
| 7932 | { |
| 7933 | EncryptType = eCSR_ENCRYPT_TYPE_NONE; //*** |
| 7934 | } |
| 7935 | |
| 7936 | edType = csrTranslateEncryptTypeToEdType( EncryptType ); |
| 7937 | |
| 7938 | // Allow 0 keys to be set for the non-WPA encrypt types... For WPA encrypt types, the num keys must be non-zero |
| 7939 | // or LIM will reject the set context (assumes the SET_CONTEXT does not occur until the keys are distrubuted). |
| 7940 | if ( CSR_IS_ENC_TYPE_STATIC( EncryptType ) || |
| 7941 | addKey ) |
| 7942 | { |
| 7943 | tCsrRoamSetKey setKey; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7944 | setKey.encType = EncryptType; |
| 7945 | setKey.keyDirection = aniKeyDirection; //Tx, Rx or Tx-and-Rx |
| 7946 | palCopyMemory( pMac->hHdd, &setKey.peerMac, bssId, sizeof(tCsrBssid) ); |
| 7947 | setKey.paeRole = paeRole; //0 for supplicant |
| 7948 | setKey.keyId = keyId; // Kye index |
| 7949 | setKey.keyLength = keyLength; |
| 7950 | if( keyLength ) |
| 7951 | { |
| 7952 | palCopyMemory( pMac->hHdd, setKey.Key, pKey, keyLength ); |
| 7953 | } |
| 7954 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, &setKey, 0 ); |
| 7955 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7956 | return (status); |
| 7957 | } |
| 7958 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7959 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 7960 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 7961 | { |
| 7962 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 7963 | tSmeCmd *pCommand = NULL; |
| 7964 | #ifdef FEATURE_WLAN_CCX |
| 7965 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7966 | #endif /* FEATURE_WLAN_CCX */ |
| 7967 | |
| 7968 | do |
| 7969 | { |
| 7970 | pCommand = csrGetCommandBuffer(pMac); |
| 7971 | if(NULL == pCommand) |
| 7972 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7973 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7974 | status = eHAL_STATUS_RESOURCES; |
| 7975 | break; |
| 7976 | } |
| 7977 | pCommand->command = eSmeCommandSetKey; |
| 7978 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7979 | // validate the key length, Adjust if too long... |
| 7980 | // for static WEP the keys are not set thru' SetContextReq |
| 7981 | if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || |
| 7982 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ) ) |
| 7983 | { |
| 7984 | //KeyLength maybe 0 for static WEP |
| 7985 | if( pSetKey->keyLength ) |
| 7986 | { |
| 7987 | if ( pSetKey->keyLength < CSR_WEP40_KEY_LEN ) |
| 7988 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7989 | smsLog( pMac, LOGW, "Invalid WEP40 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7990 | break; |
| 7991 | } |
| 7992 | |
| 7993 | pCommand->u.setKeyCmd.keyLength = CSR_WEP40_KEY_LEN; |
| 7994 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP40_KEY_LEN ); |
| 7995 | } |
| 7996 | } |
| 7997 | else if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || |
| 7998 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ) ) |
| 7999 | { |
| 8000 | //KeyLength maybe 0 for static WEP |
| 8001 | if( pSetKey->keyLength ) |
| 8002 | { |
| 8003 | if ( pSetKey->keyLength < CSR_WEP104_KEY_LEN ) |
| 8004 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8005 | smsLog( pMac, LOGW, "Invalid WEP104 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8006 | break; |
| 8007 | } |
| 8008 | |
| 8009 | pCommand->u.setKeyCmd.keyLength = CSR_WEP104_KEY_LEN; |
| 8010 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP104_KEY_LEN ); |
| 8011 | } |
| 8012 | } |
| 8013 | else if ( eCSR_ENCRYPT_TYPE_TKIP == pSetKey->encType ) |
| 8014 | { |
| 8015 | if ( pSetKey->keyLength < CSR_TKIP_KEY_LEN ) |
| 8016 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8017 | smsLog( pMac, LOGW, "Invalid TKIP keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8018 | break; |
| 8019 | } |
| 8020 | pCommand->u.setKeyCmd.keyLength = CSR_TKIP_KEY_LEN; |
| 8021 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_TKIP_KEY_LEN ); |
| 8022 | } |
| 8023 | else if ( eCSR_ENCRYPT_TYPE_AES == pSetKey->encType ) |
| 8024 | { |
| 8025 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 8026 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8027 | smsLog( pMac, LOGW, "Invalid AES/CCMP keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8028 | break; |
| 8029 | } |
| 8030 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
| 8031 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN ); |
| 8032 | } |
| 8033 | #ifdef FEATURE_WLAN_WAPI |
| 8034 | else if ( eCSR_ENCRYPT_TYPE_WPI == pSetKey->encType ) |
| 8035 | { |
| 8036 | if ( pSetKey->keyLength < CSR_WAPI_KEY_LEN ) |
| 8037 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8038 | smsLog( pMac, LOGW, "Invalid WAPI keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8039 | break; |
| 8040 | } |
| 8041 | pCommand->u.setKeyCmd.keyLength = CSR_WAPI_KEY_LEN; |
| 8042 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WAPI_KEY_LEN ); |
| 8043 | } |
| 8044 | #endif /* FEATURE_WLAN_WAPI */ |
| 8045 | #ifdef FEATURE_WLAN_CCX |
| 8046 | else if ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 8047 | { |
| 8048 | if ( pSetKey->keyLength < CSR_KRK_KEY_LEN ) |
| 8049 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8050 | smsLog( pMac, LOGW, "Invalid KRK keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8051 | break; |
| 8052 | } |
| 8053 | palCopyMemory( pMac->hHdd, pSession->ccxCckmInfo.krk, pSetKey->Key, CSR_KRK_KEY_LEN ); |
| 8054 | pSession->ccxCckmInfo.reassoc_req_num=1; |
| 8055 | pSession->ccxCckmInfo.krk_plumbed = eANI_BOOLEAN_TRUE; |
| 8056 | status = eHAL_STATUS_SUCCESS; |
| 8057 | break; |
| 8058 | } |
| 8059 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8060 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8061 | #ifdef WLAN_FEATURE_11W |
| 8062 | //Check for 11w BIP |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8063 | else if (eCSR_ENCRYPT_TYPE_AES_CMAC == pSetKey->encType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8064 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8065 | if (pSetKey->keyLength < CSR_AES_KEY_LEN) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8066 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8067 | smsLog(pMac, LOGW, "Invalid AES/CCMP keylength [= %d] in SetContext call", pSetKey->keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8068 | break; |
| 8069 | } |
| 8070 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8071 | palCopyMemory(pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8072 | } |
| 8073 | #endif |
| 8074 | status = eHAL_STATUS_SUCCESS; |
| 8075 | pCommand->u.setKeyCmd.roamId = roamId; |
| 8076 | pCommand->u.setKeyCmd.encType = pSetKey->encType; |
| 8077 | pCommand->u.setKeyCmd.keyDirection = pSetKey->keyDirection; //Tx, Rx or Tx-and-Rx |
| 8078 | palCopyMemory( pMac->hHdd, &pCommand->u.setKeyCmd.peerMac, &pSetKey->peerMac, sizeof(tCsrBssid) ); |
| 8079 | pCommand->u.setKeyCmd.paeRole = pSetKey->paeRole; //0 for supplicant |
| 8080 | pCommand->u.setKeyCmd.keyId = pSetKey->keyId; |
| 8081 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.keyRsc, pSetKey->keyRsc, CSR_MAX_RSC_LEN ); |
| 8082 | //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 |
| 8083 | |
| 8084 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 8085 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8086 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8087 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8088 | } |
| 8089 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8090 | // Free the command if there has been a failure, or it is a |
| 8091 | // "local" operation like the set CCX CCKM KRK key. |
Jeff Johnson | 74b3ec5 | 2013-04-03 13:45:51 -0700 | [diff] [blame] | 8092 | if ( ( NULL != pCommand ) && |
| 8093 | ( (!HAL_STATUS_SUCCESS( status ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8094 | #ifdef FEATURE_WLAN_CCX |
| 8095 | || ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 8096 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 74b3ec5 | 2013-04-03 13:45:51 -0700 | [diff] [blame] | 8097 | ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8098 | { |
| 8099 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 8100 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8101 | return( status ); |
| 8102 | } |
| 8103 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8104 | eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8105 | tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId ) |
| 8106 | { |
| 8107 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 8108 | tSmeCmd *pCommand = NULL; |
| 8109 | tANI_BOOLEAN fImediate = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8110 | do |
| 8111 | { |
| 8112 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8113 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8114 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8115 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8116 | break; |
| 8117 | } |
| 8118 | pCommand = csrGetCommandBuffer(pMac); |
| 8119 | if(NULL == pCommand) |
| 8120 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8121 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8122 | status = eHAL_STATUS_RESOURCES; |
| 8123 | break; |
| 8124 | } |
| 8125 | pCommand->command = eSmeCommandRemoveKey; |
| 8126 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8127 | pCommand->u.removeKeyCmd.roamId = roamId; |
| 8128 | pCommand->u.removeKeyCmd.encType = pRemoveKey->encType; |
| 8129 | palCopyMemory( pMac->hHdd, &pCommand->u.removeKeyCmd.peerMac, &pRemoveKey->peerMac, sizeof(tSirMacAddr) ); |
| 8130 | pCommand->u.removeKeyCmd.keyId = pRemoveKey->keyId; |
| 8131 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8132 | { |
| 8133 | //in this case, put it to the end of the Q incase there is a set key pending. |
| 8134 | fImediate = eANI_BOOLEAN_FALSE; |
| 8135 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8136 | smsLog( pMac, LOGE, FL("keyType=%d, keyId=%d, PeerMac=%02x, %02x, %02x, %02x, %02x, %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8137 | pRemoveKey->encType, pRemoveKey->keyId, |
| 8138 | pCommand->u.removeKeyCmd.peerMac[0], |
| 8139 | pCommand->u.removeKeyCmd.peerMac[1], |
| 8140 | pCommand->u.removeKeyCmd.peerMac[2], |
| 8141 | pCommand->u.removeKeyCmd.peerMac[3], |
| 8142 | pCommand->u.removeKeyCmd.peerMac[4], |
| 8143 | pCommand->u.removeKeyCmd.peerMac[5]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8144 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 8145 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8146 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8147 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8148 | break; |
| 8149 | } |
| 8150 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8151 | if( !HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand ) ) |
| 8152 | { |
| 8153 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 8154 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8155 | return (status ); |
| 8156 | } |
| 8157 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8158 | eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8159 | { |
| 8160 | eHalStatus status; |
| 8161 | tANI_U8 numKeys = ( pCommand->u.setKeyCmd.keyLength ) ? 1 : 0; |
| 8162 | tAniEdType edType = csrTranslateEncryptTypeToEdType( pCommand->u.setKeyCmd.encType ); |
| 8163 | tANI_BOOLEAN fUnicast = ( pCommand->u.setKeyCmd.peerMac[0] == 0xFF ) ? eANI_BOOLEAN_FALSE : eANI_BOOLEAN_TRUE; |
| 8164 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8165 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8166 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8167 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8168 | if(eCSR_ENCRYPT_TYPE_NONE != edType) |
| 8169 | { |
| 8170 | palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8171 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 8172 | { |
| 8173 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ; |
| 8174 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 8175 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8176 | } |
| 8177 | else |
| 8178 | { |
| 8179 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_REQ; |
| 8180 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 8181 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8182 | } |
| 8183 | palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 8184 | if(CSR_IS_ENC_TYPE_STATIC(edType)) |
| 8185 | { |
| 8186 | tANI_U32 defKeyId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8187 | //It has to be static WEP here |
| 8188 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, &defKeyId))) |
| 8189 | { |
| 8190 | setKeyEvent.keyId = (v_U8_t)defKeyId; |
| 8191 | } |
| 8192 | } |
| 8193 | else |
| 8194 | { |
| 8195 | setKeyEvent.keyId = pCommand->u.setKeyCmd.keyId; |
| 8196 | } |
| 8197 | setKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8198 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8199 | } |
| 8200 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8201 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8202 | { |
| 8203 | status = csrSendMBSetContextReqMsg( pMac, sessionId, |
| 8204 | ( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac, |
| 8205 | numKeys, edType, fUnicast, pCommand->u.setKeyCmd.keyDirection, |
| 8206 | pCommand->u.setKeyCmd.keyId, pCommand->u.setKeyCmd.keyLength, |
| 8207 | pCommand->u.setKeyCmd.Key, pCommand->u.setKeyCmd.paeRole, |
| 8208 | pCommand->u.setKeyCmd.keyRsc); |
| 8209 | } |
| 8210 | else |
| 8211 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8212 | smsLog( pMac, LOGW, FL(" cannot process not connected") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8213 | //Set this status so the error handling take care of the case. |
| 8214 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8215 | } |
| 8216 | if( !HAL_STATUS_SUCCESS(status) ) |
| 8217 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8218 | smsLog( pMac, LOGE, FL(" error status %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8219 | 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] | 8220 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8221 | if(eCSR_ENCRYPT_TYPE_NONE != edType) |
| 8222 | { |
| 8223 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 8224 | { |
| 8225 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 8226 | } |
| 8227 | else |
| 8228 | { |
| 8229 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 8230 | } |
| 8231 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 8232 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8233 | } |
| 8234 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8235 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8236 | return ( status ); |
| 8237 | } |
| 8238 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8239 | eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8240 | { |
| 8241 | eHalStatus status; |
| 8242 | tpSirSmeRemoveKeyReq pMsg = NULL; |
| 8243 | tANI_U16 wMsgLen = sizeof(tSirSmeRemoveKeyReq); |
| 8244 | tANI_U8 *p; |
| 8245 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8246 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8247 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8248 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8249 | palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8250 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_REQ; |
| 8251 | removeKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8252 | removeKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8253 | palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 8254 | removeKeyEvent.keyId = pCommand->u.removeKeyCmd.keyId; |
| 8255 | removeKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8256 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8257 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8258 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8259 | { |
| 8260 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, wMsgLen ); |
| 8261 | } |
| 8262 | else |
| 8263 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8264 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8265 | //Set the error status so error handling kicks in below |
| 8266 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8267 | } |
| 8268 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8269 | { |
| 8270 | palZeroMemory(pMac->hHdd, pMsg, wMsgLen); |
| 8271 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REMOVEKEY_REQ); |
| 8272 | pMsg->length = pal_cpu_to_be16(wMsgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8273 | pMsg->sessionId = (tANI_U8)sessionId; |
| 8274 | pMsg->transactionId = 0; |
| 8275 | p = (tANI_U8 *)pMsg + sizeof(pMsg->messageType) + sizeof(pMsg->length) + |
| 8276 | sizeof(pMsg->sessionId) + sizeof(pMsg->transactionId); |
| 8277 | // bssId - copy from session Info |
| 8278 | palCopyMemory( pMac->hHdd, p, &pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 8279 | p += sizeof(tSirMacAddr); |
| 8280 | // peerMacAddr |
| 8281 | palCopyMemory( pMac->hHdd, p, pCommand->u.removeKeyCmd.peerMac, sizeof(tSirMacAddr) ); |
| 8282 | p += sizeof(tSirMacAddr); |
| 8283 | // edType |
| 8284 | *p = (tANI_U8)csrTranslateEncryptTypeToEdType( pCommand->u.removeKeyCmd.encType ); |
| 8285 | p++; |
| 8286 | // weptype |
| 8287 | if( ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pCommand->u.removeKeyCmd.encType ) || |
| 8288 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pCommand->u.removeKeyCmd.encType ) ) |
| 8289 | { |
| 8290 | *p = (tANI_U8)eSIR_WEP_STATIC; |
| 8291 | } |
| 8292 | else |
| 8293 | { |
| 8294 | *p = (tANI_U8)eSIR_WEP_DYNAMIC; |
| 8295 | } |
| 8296 | p++; |
| 8297 | //keyid |
| 8298 | *p = pCommand->u.removeKeyCmd.keyId; |
| 8299 | p++; |
| 8300 | *p = (pCommand->u.removeKeyCmd.peerMac[0] == 0xFF ) ? 0 : 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8301 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 8302 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8303 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8304 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8305 | smsLog( pMac, LOGE, FL(" error status "), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8306 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8307 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 8308 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8309 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8310 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8311 | csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.removeKeyCmd.roamId, eCSR_ROAM_REMOVE_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE); |
| 8312 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8313 | return ( status ); |
| 8314 | } |
| 8315 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8316 | eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 8317 | { |
| 8318 | eHalStatus status; |
| 8319 | |
| 8320 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8321 | { |
| 8322 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8323 | } |
| 8324 | else |
| 8325 | { |
| 8326 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, pSetKey, roamId ); |
| 8327 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8328 | return ( status ); |
| 8329 | } |
| 8330 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8331 | /* |
| 8332 | Prepare a filter base on a profile for parsing the scan results. |
| 8333 | Upon successful return, caller MUST call csrFreeScanFilter on |
| 8334 | pScanFilter when it is done with the filter. |
| 8335 | */ |
| 8336 | eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 8337 | tCsrScanResultFilter *pScanFilter) |
| 8338 | { |
| 8339 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8340 | tANI_U32 size = 0; |
| 8341 | tANI_U8 index = 0; |
| 8342 | |
| 8343 | do |
| 8344 | { |
| 8345 | if(pProfile->BSSIDs.numOfBSSIDs) |
| 8346 | { |
| 8347 | size = sizeof(tCsrBssid) * pProfile->BSSIDs.numOfBSSIDs; |
| 8348 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, size); |
| 8349 | if(!HAL_STATUS_SUCCESS(status)) |
| 8350 | { |
| 8351 | break; |
| 8352 | } |
| 8353 | pScanFilter->BSSIDs.numOfBSSIDs = pProfile->BSSIDs.numOfBSSIDs; |
| 8354 | palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, pProfile->BSSIDs.bssid, size); |
| 8355 | } |
| 8356 | if(pProfile->SSIDs.numOfSSIDs) |
| 8357 | { |
| 8358 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 8359 | { |
| 8360 | pScanFilter->SSIDs.numOfSSIDs = pProfile->SSIDs.numOfSSIDs; |
| 8361 | } |
| 8362 | else |
| 8363 | { |
| 8364 | //For WDS station |
| 8365 | //We always use index 1 for self SSID. Index 0 for peer's SSID that we want to join |
| 8366 | pScanFilter->SSIDs.numOfSSIDs = 1; |
| 8367 | } |
| 8368 | size = sizeof(tCsrSSIDInfo) * pProfile->SSIDs.numOfSSIDs; |
| 8369 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, size); |
| 8370 | if(!HAL_STATUS_SUCCESS(status)) |
| 8371 | { |
| 8372 | break; |
| 8373 | } |
| 8374 | palCopyMemory(pMac->hHdd, pScanFilter->SSIDs.SSIDList, pProfile->SSIDs.SSIDList, size); |
| 8375 | } |
| 8376 | if(!pProfile->ChannelInfo.ChannelList || (pProfile->ChannelInfo.ChannelList[0] == 0) ) |
| 8377 | { |
| 8378 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8379 | pScanFilter->ChannelInfo.ChannelList = NULL; |
| 8380 | } |
| 8381 | else if(pProfile->ChannelInfo.numOfChannels) |
| 8382 | { |
| 8383 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->ChannelInfo.ChannelList, sizeof(*pScanFilter->ChannelInfo.ChannelList) * pProfile->ChannelInfo.numOfChannels); |
| 8384 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8385 | if(HAL_STATUS_SUCCESS(status)) |
| 8386 | { |
| 8387 | for(index = 0; index < pProfile->ChannelInfo.numOfChannels; index++) |
| 8388 | { |
| 8389 | if(csrRoamIsChannelValid(pMac, pProfile->ChannelInfo.ChannelList[index])) |
| 8390 | { |
| 8391 | pScanFilter->ChannelInfo.ChannelList[pScanFilter->ChannelInfo.numOfChannels] |
| 8392 | = pProfile->ChannelInfo.ChannelList[index]; |
| 8393 | pScanFilter->ChannelInfo.numOfChannels++; |
| 8394 | } |
| 8395 | else |
| 8396 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8397 | smsLog(pMac, LOG1, FL("process a channel (%d) that is invalid"), pProfile->ChannelInfo.ChannelList[index]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8398 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8399 | } |
| 8400 | } |
| 8401 | else |
| 8402 | { |
| 8403 | break; |
| 8404 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8405 | } |
| 8406 | else |
| 8407 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8408 | smsLog(pMac, LOGW, FL("Channel list empty")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8409 | status = eHAL_STATUS_FAILURE; |
| 8410 | break; |
| 8411 | } |
| 8412 | pScanFilter->uapsd_mask = pProfile->uapsd_mask; |
| 8413 | pScanFilter->authType = pProfile->AuthType; |
| 8414 | pScanFilter->EncryptionType = pProfile->EncryptionType; |
| 8415 | pScanFilter->mcEncryptionType = pProfile->mcEncryptionType; |
| 8416 | pScanFilter->BSSType = pProfile->BSSType; |
| 8417 | pScanFilter->phyMode = pProfile->phyMode; |
| 8418 | #ifdef FEATURE_WLAN_WAPI |
| 8419 | //check if user asked for WAPI with 11n or auto mode, in that case modify |
| 8420 | //the phymode to 11g |
| 8421 | if(csrIsProfileWapi(pProfile)) |
| 8422 | { |
| 8423 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_11n) |
| 8424 | { |
| 8425 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 8426 | } |
| 8427 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_AUTO) |
| 8428 | { |
| 8429 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_AUTO; |
| 8430 | } |
| 8431 | if(!pScanFilter->phyMode) |
| 8432 | { |
| 8433 | pScanFilter->phyMode = eCSR_DOT11_MODE_11g; |
| 8434 | } |
| 8435 | } |
| 8436 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8437 | /*Save the WPS info*/ |
| 8438 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8439 | if( pProfile->countryCode[0] ) |
| 8440 | { |
| 8441 | //This causes the matching function to use countryCode as one of the criteria. |
| 8442 | palCopyMemory( pMac->hHdd, pScanFilter->countryCode, pProfile->countryCode, |
| 8443 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 8444 | } |
| 8445 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8446 | if (pProfile->MDID.mdiePresent) |
| 8447 | { |
| 8448 | pScanFilter->MDID.mdiePresent = 1; |
| 8449 | pScanFilter->MDID.mobilityDomain = pProfile->MDID.mobilityDomain; |
| 8450 | } |
| 8451 | #endif |
| 8452 | |
| 8453 | }while(0); |
| 8454 | |
| 8455 | if(!HAL_STATUS_SUCCESS(status)) |
| 8456 | { |
| 8457 | csrFreeScanFilter(pMac, pScanFilter); |
| 8458 | } |
| 8459 | |
| 8460 | return(status); |
| 8461 | } |
| 8462 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8463 | tANI_BOOLEAN csrRoamIssueWmStatusChange( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8464 | eCsrRoamWmStatusChangeTypes Type, tSirSmeRsp *pSmeRsp ) |
| 8465 | { |
| 8466 | tANI_BOOLEAN fCommandQueued = eANI_BOOLEAN_FALSE; |
| 8467 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8468 | do |
| 8469 | { |
| 8470 | // Validate the type is ok... |
| 8471 | if ( ( eCsrDisassociated != Type ) && ( eCsrDeauthenticated != Type ) ) break; |
| 8472 | pCommand = csrGetCommandBuffer( pMac ); |
| 8473 | if ( !pCommand ) |
| 8474 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8475 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8476 | break; |
| 8477 | } |
| 8478 | //Change the substate in case it is waiting for key |
| 8479 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8480 | { |
| 8481 | csrRoamStopWaitForKeyTimer( pMac ); |
| 8482 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 8483 | } |
| 8484 | pCommand->command = eSmeCommandWmStatusChange; |
| 8485 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8486 | pCommand->u.wmStatusChangeCmd.Type = Type; |
| 8487 | if ( eCsrDisassociated == Type ) |
| 8488 | { |
| 8489 | palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg, pSmeRsp, |
| 8490 | sizeof( pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg ) ); |
| 8491 | } |
| 8492 | else |
| 8493 | { |
| 8494 | palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg, pSmeRsp, |
| 8495 | sizeof( pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg ) ); |
| 8496 | } |
| 8497 | if( HAL_STATUS_SUCCESS( csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE) ) ) |
| 8498 | { |
| 8499 | fCommandQueued = eANI_BOOLEAN_TRUE; |
| 8500 | } |
| 8501 | else |
| 8502 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8503 | smsLog( pMac, LOGE, FL(" fail to send message ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8504 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 8505 | } |
| 8506 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8507 | /* AP has issued Dissac/Deauth, Set the operating mode value to configured value */ |
| 8508 | csrSetDefaultDot11Mode( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8509 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8510 | return( fCommandQueued ); |
| 8511 | } |
| 8512 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8513 | static void csrUpdateRssi(tpAniSirGlobal pMac, void* pMsg) |
| 8514 | { |
| 8515 | v_S7_t rssi = 0; |
| 8516 | tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq*)pMsg; |
| 8517 | if(pGetRssiReq) |
| 8518 | { |
| 8519 | if(NULL != pGetRssiReq->pVosContext) |
| 8520 | { |
| 8521 | WLANTL_GetRssi(pGetRssiReq->pVosContext, pGetRssiReq->staId, &rssi); |
| 8522 | } |
| 8523 | else |
| 8524 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8525 | smsLog( pMac, LOGE, FL("pGetRssiReq->pVosContext is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8526 | return; |
| 8527 | } |
| 8528 | |
| 8529 | if(NULL != pGetRssiReq->rssiCallback) |
| 8530 | { |
| 8531 | ((tCsrRssiCallback)(pGetRssiReq->rssiCallback))(rssi, pGetRssiReq->staId, pGetRssiReq->pDevContext); |
| 8532 | } |
| 8533 | else |
| 8534 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8535 | smsLog( pMac, LOGE, FL("pGetRssiReq->rssiCallback is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8536 | return; |
| 8537 | } |
| 8538 | } |
| 8539 | else |
| 8540 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8541 | smsLog( pMac, LOGE, FL("pGetRssiReq is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8542 | } |
| 8543 | return; |
| 8544 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8545 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 8546 | void csrRoamRssiRspProcessor(tpAniSirGlobal pMac, void* pMsg) |
| 8547 | { |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8548 | tAniGetRoamRssiRsp* pRoamRssiRsp = (tAniGetRoamRssiRsp*)pMsg; |
| 8549 | |
Jeff Johnson | 36d483b | 2013-04-08 11:08:53 -0700 | [diff] [blame] | 8550 | if (NULL != pRoamRssiRsp) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8551 | { |
Jeff Johnson | 36d483b | 2013-04-08 11:08:53 -0700 | [diff] [blame] | 8552 | /* Get roam Rssi request is backed up and passed back to the response, |
| 8553 | Extract the request message to fetch callback */ |
| 8554 | tpAniGetRssiReq reqBkp = (tAniGetRssiReq*)pRoamRssiRsp->rssiReq; |
| 8555 | v_S7_t rssi = pRoamRssiRsp->rssi; |
| 8556 | |
| 8557 | if ((NULL != reqBkp) && (NULL != reqBkp->rssiCallback)) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8558 | { |
| 8559 | ((tCsrRssiCallback)(reqBkp->rssiCallback))(rssi, pRoamRssiRsp->staId, reqBkp->pDevContext); |
| 8560 | reqBkp->rssiCallback = NULL; |
| 8561 | vos_mem_free(reqBkp); |
| 8562 | } |
| 8563 | else |
| 8564 | { |
| 8565 | smsLog( pMac, LOGE, FL("reqBkp->rssiCallback is NULL")); |
| 8566 | if (NULL != reqBkp) |
| 8567 | { |
| 8568 | vos_mem_free(reqBkp); |
| 8569 | } |
| 8570 | } |
| 8571 | } |
| 8572 | else |
| 8573 | { |
| 8574 | smsLog( pMac, LOGE, FL("pRoamRssiRsp is NULL")); |
| 8575 | } |
| 8576 | return; |
| 8577 | } |
| 8578 | #endif |
| 8579 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8580 | static void csrRoamRssiIndHdlr(tpAniSirGlobal pMac, void* pMsg) |
| 8581 | { |
| 8582 | WLANTL_TlIndicationReq *pTlRssiInd = (WLANTL_TlIndicationReq*)pMsg; |
| 8583 | if(pTlRssiInd) |
| 8584 | { |
| 8585 | if(NULL != pTlRssiInd->tlCallback) |
| 8586 | { |
| 8587 | ((WLANTL_RSSICrossThresholdCBType)(pTlRssiInd->tlCallback)) |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 8588 | (pTlRssiInd->pAdapter, pTlRssiInd->rssiNotification, pTlRssiInd->pUserCtxt, pTlRssiInd->avgRssi); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8589 | } |
| 8590 | else |
| 8591 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8592 | smsLog( pMac, LOGE, FL("pTlRssiInd->tlCallback is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8593 | } |
| 8594 | } |
| 8595 | else |
| 8596 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8597 | smsLog( pMac, LOGE, FL("pTlRssiInd is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8598 | } |
| 8599 | return; |
| 8600 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8601 | |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 8602 | eHalStatus csrSendResetApCapsChanged(tpAniSirGlobal pMac, tSirMacAddr *bssId) |
| 8603 | { |
| 8604 | tpSirResetAPCapsChange pMsg; |
| 8605 | tANI_U16 len; |
| 8606 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8607 | |
| 8608 | /* Create the message and send to lim */ |
| 8609 | len = sizeof(tSirResetAPCapsChange); |
| 8610 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len ); |
| 8611 | if (HAL_STATUS_SUCCESS(status)) |
| 8612 | { |
| 8613 | palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirResetAPCapsChange) ); |
| 8614 | pMsg->messageType = eWNI_SME_RESET_AP_CAPS_CHANGED; |
| 8615 | pMsg->length = len; |
| 8616 | palCopyMemory( pMac->hHdd, pMsg->bssId, bssId, sizeof(tSirMacAddr) ); |
| 8617 | smsLog( pMac, LOG1, FL("CSR reset caps change for Bssid= %02x-%02x-%02x-%02x-%02x-%02x"), |
| 8618 | pMsg->bssId[ 0 ], pMsg->bssId[ 1 ], pMsg->bssId[ 2 ], |
| 8619 | pMsg->bssId[ 3 ], pMsg->bssId[ 4 ], pMsg->bssId[ 5 ]); |
| 8620 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 8621 | } |
| 8622 | else |
| 8623 | { |
| 8624 | smsLog( pMac, LOGE, FL("Memory allocation failed\n")); |
| 8625 | } |
| 8626 | return status; |
| 8627 | } |
| 8628 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8629 | void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) |
| 8630 | { |
| 8631 | tSirSmeAssocInd *pAssocInd; |
| 8632 | tSirSmeDisassocInd *pDisassocInd; |
| 8633 | tSirSmeDeauthInd *pDeauthInd; |
| 8634 | tSirSmeWmStatusChangeNtf *pStatusChangeMsg; |
| 8635 | tSirSmeNewBssInfo *pNewBss; |
| 8636 | tSmeIbssPeerInd *pIbssPeerInd; |
| 8637 | tSirMacAddr Broadcastaddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 8638 | tSirSmeApNewCaps *pApNewCaps; |
| 8639 | eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; |
| 8640 | eRoamCmdStatus roamStatus = eCSR_ROAM_FAILED; |
| 8641 | tCsrRoamInfo *pRoamInfo = NULL; |
| 8642 | tCsrRoamInfo roamInfo; |
| 8643 | eHalStatus status; |
| 8644 | tANI_U32 sessionId = CSR_SESSION_ID_INVALID; |
| 8645 | tCsrRoamSession *pSession = NULL; |
| 8646 | tpSirSmeSwitchChannelInd pSwitchChnInd; |
| 8647 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 8648 | tSmeCmd pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8649 | pSirMsg->messageType = (pSirMsg->messageType); |
| 8650 | pSirMsg->length = (pSirMsg->length); |
| 8651 | pSirMsg->statusCode = (pSirMsg->statusCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8652 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8653 | switch( pSirMsg->messageType ) |
| 8654 | { |
| 8655 | case eWNI_SME_ASSOC_IND: |
| 8656 | { |
| 8657 | tCsrRoamSession *pSession; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8658 | smsLog( pMac, LOG1, FL("ASSOCIATION Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8659 | pAssocInd = (tSirSmeAssocInd *)pSirMsg; |
| 8660 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pAssocInd->bssId, &sessionId ); |
| 8661 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8662 | { |
| 8663 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8664 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8665 | if(!pSession) |
| 8666 | { |
| 8667 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8668 | return; |
| 8669 | } |
| 8670 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8671 | pRoamInfo = &roamInfo; |
| 8672 | |
| 8673 | // Required for indicating the frames to upper layer |
| 8674 | pRoamInfo->assocReqLength = pAssocInd->assocReqLength; |
| 8675 | pRoamInfo->assocReqPtr = pAssocInd->assocReqPtr; |
| 8676 | |
| 8677 | pRoamInfo->beaconPtr = pAssocInd->beaconPtr; |
| 8678 | pRoamInfo->beaconLength = pAssocInd->beaconLength; |
| 8679 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 8680 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8681 | |
| 8682 | pRoamInfo->staId = (tANI_U8)pAssocInd->staId; |
| 8683 | pRoamInfo->rsnIELen = (tANI_U8)pAssocInd->rsnIE.length; |
| 8684 | pRoamInfo->prsnIE = pAssocInd->rsnIE.rsnIEdata; |
| 8685 | |
| 8686 | pRoamInfo->addIELen = (tANI_U8)pAssocInd->addIE.length; |
| 8687 | pRoamInfo->paddIE = pAssocInd->addIE.addIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8688 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8689 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pAssocInd->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8690 | pRoamInfo->wmmEnabledSta = pAssocInd->wmmEnabledSta; |
| 8691 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8692 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8693 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile)) |
| 8694 | { |
| 8695 | if( CSR_IS_ENC_TYPE_STATIC( pSession->pCurRoamProfile->negotiatedUCEncryptionType )) |
| 8696 | { |
| 8697 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->pCurRoamProfile->negotiatedUCEncryptionType, |
| 8698 | pSession->pConnectBssDesc, |
| 8699 | &(pRoamInfo->peerMac), |
| 8700 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 8701 | pRoamInfo->fAuthRequired = FALSE; |
| 8702 | } |
| 8703 | else |
| 8704 | { |
| 8705 | pRoamInfo->fAuthRequired = TRUE; |
| 8706 | } |
| 8707 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND); |
| 8708 | if (!HAL_STATUS_SUCCESS(status)) |
| 8709 | pRoamInfo->statusCode = eSIR_SME_ASSOC_REFUSED;// Refused due to Mac filtering |
| 8710 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8711 | /* Send Association completion message to PE */ |
| 8712 | status = csrSendAssocCnfMsg( pMac, pAssocInd, status );//Sta |
| 8713 | |
| 8714 | /* send a message to CSR itself just to avoid the EAPOL frames going |
| 8715 | * OTA before association response */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8716 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 8717 | { |
| 8718 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 8719 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8720 | else if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) && (pRoamInfo->statusCode != eSIR_SME_ASSOC_REFUSED)) |
| 8721 | { |
| 8722 | pRoamInfo->fReassocReq = pAssocInd->reassocReq; |
| 8723 | //status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 8724 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 8725 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8726 | } |
| 8727 | } |
| 8728 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8729 | case eWNI_SME_DISASSOC_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8730 | smsLog( pMac, LOGE, FL("DISASSOCIATION Indication from MAC")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8731 | // Check if AP dis-associated us because of MIC failure. If so, |
| 8732 | // then we need to take action immediately and not wait till the |
| 8733 | // the WmStatusChange requests is pushed and processed |
| 8734 | pDisassocInd = (tSirSmeDisassocInd *)pSirMsg; |
| 8735 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDisassocInd->bssId, &sessionId ); |
| 8736 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8737 | { |
| 8738 | // If we are in neighbor preauth done state then on receiving |
| 8739 | // disassoc or deauth we dont roam instead we just disassoc |
| 8740 | // from current ap and then go to disconnected state |
| 8741 | // This happens for CCX and 11r FT connections ONLY. |
| 8742 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8743 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8744 | { |
| 8745 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8746 | } |
| 8747 | #endif |
| 8748 | #ifdef FEATURE_WLAN_CCX |
| 8749 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8750 | { |
| 8751 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8752 | } |
| 8753 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8754 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 8755 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8756 | { |
| 8757 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8758 | } |
| 8759 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8760 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8761 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8762 | if(!pSession) |
| 8763 | { |
| 8764 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8765 | return; |
| 8766 | } |
| 8767 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8768 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 8769 | { |
| 8770 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8771 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8772 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 8773 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 8774 | #endif |
| 8775 | csrRoamLinkDown(pMac, sessionId); |
| 8776 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDisassociated, pSirMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8777 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 8778 | { |
| 8779 | |
| 8780 | pRoamInfo = &roamInfo; |
| 8781 | |
| 8782 | pRoamInfo->statusCode = pDisassocInd->statusCode; |
| 8783 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8784 | |
| 8785 | pRoamInfo->staId = (tANI_U8)pDisassocInd->staId; |
| 8786 | |
| 8787 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8788 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDisassocInd->bssId, sizeof(tCsrBssid)); |
| 8789 | |
| 8790 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DISASSOC_IND); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 8791 | |
| 8792 | /* |
| 8793 | * STA/P2P client got disassociated so remove any pending deauth |
| 8794 | * commands in sme pending list |
| 8795 | */ |
| 8796 | pCommand.command = eSmeCommandRoam; |
| 8797 | pCommand.sessionId = (tANI_U8)sessionId; |
| 8798 | pCommand.u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 8799 | vos_mem_copy(pCommand.u.roamCmd.peerMac, pDisassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8800 | csrRoamRemoveDuplicateCommand(pMac, sessionId, &pCommand, eCsrForcedDeauthSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8801 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8802 | } |
| 8803 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8804 | case eWNI_SME_DEAUTH_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8805 | smsLog( pMac, LOG1, FL("DEAUTHENTICATION Indication from MAC")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8806 | pDeauthInd = (tpSirSmeDeauthInd)pSirMsg; |
| 8807 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDeauthInd->bssId, &sessionId ); |
| 8808 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8809 | { |
| 8810 | // If we are in neighbor preauth done state then on receiving |
| 8811 | // disassoc or deauth we dont roam instead we just disassoc |
| 8812 | // from current ap and then go to disconnected state |
| 8813 | // This happens for CCX and 11r FT connections ONLY. |
| 8814 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8815 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8816 | { |
| 8817 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8818 | } |
| 8819 | #endif |
| 8820 | #ifdef FEATURE_WLAN_CCX |
| 8821 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8822 | { |
| 8823 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8824 | } |
| 8825 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8826 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 8827 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8828 | { |
| 8829 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8830 | } |
| 8831 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8832 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8833 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8834 | if(!pSession) |
| 8835 | { |
| 8836 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8837 | return; |
| 8838 | } |
| 8839 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8840 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 8841 | { |
| 8842 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8843 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8844 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 8845 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 8846 | #endif |
| 8847 | csrRoamLinkDown(pMac, sessionId); |
| 8848 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDeauthenticated, pSirMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8849 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 8850 | { |
| 8851 | |
| 8852 | pRoamInfo = &roamInfo; |
| 8853 | |
| 8854 | pRoamInfo->statusCode = pDeauthInd->statusCode; |
| 8855 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8856 | |
| 8857 | pRoamInfo->staId = (tANI_U8)pDeauthInd->staId; |
| 8858 | |
| 8859 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8860 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDeauthInd->bssId, sizeof(tCsrBssid)); |
| 8861 | |
| 8862 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DEAUTH_IND); |
| 8863 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8864 | } |
| 8865 | break; |
| 8866 | |
| 8867 | case eWNI_SME_SWITCH_CHL_REQ: // in case of STA, the SWITCH_CHANNEL originates from its AP |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8868 | smsLog( pMac, LOGW, FL("eWNI_SME_SWITCH_CHL_REQ from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8869 | pSwitchChnInd = (tpSirSmeSwitchChannelInd)pSirMsg; |
| 8870 | //Update with the new channel id. |
| 8871 | //The channel id is hidden in the statusCode. |
| 8872 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pSwitchChnInd->bssId, &sessionId ); |
| 8873 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8874 | { |
| 8875 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8876 | if(!pSession) |
| 8877 | { |
| 8878 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8879 | return; |
| 8880 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8881 | pSession->connectedProfile.operationChannel = (tANI_U8)pSwitchChnInd->newChannelId; |
| 8882 | if(pSession->pConnectBssDesc) |
| 8883 | { |
| 8884 | pSession->pConnectBssDesc->channelId = (tANI_U8)pSwitchChnInd->newChannelId; |
| 8885 | } |
| 8886 | } |
| 8887 | break; |
| 8888 | |
| 8889 | case eWNI_SME_DEAUTH_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8890 | smsLog( pMac, LOGW, FL("eWNI_SME_DEAUTH_RSP from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8891 | { |
| 8892 | tSirSmeDeauthRsp* pDeauthRsp = (tSirSmeDeauthRsp *)pSirMsg; |
| 8893 | sessionId = pDeauthRsp->sessionId; |
| 8894 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 8895 | { |
| 8896 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8897 | if(!pSession) |
| 8898 | { |
| 8899 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8900 | return; |
| 8901 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8902 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 8903 | { |
| 8904 | pRoamInfo = &roamInfo; |
| 8905 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8906 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthRsp->peerMacAddr, sizeof(tSirMacAddr)); |
| 8907 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 8908 | pRoamInfo->statusCode = pDeauthRsp->statusCode; |
| 8909 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 8910 | } |
| 8911 | } |
| 8912 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8913 | break; |
| 8914 | |
| 8915 | case eWNI_SME_DISASSOC_RSP: |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 8916 | /* session id is invalid here so cant use it to access the array curSubstate as index */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8917 | smsLog( pMac, LOGW, FL("eWNI_SME_DISASSOC_RSP from SME ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8918 | { |
| 8919 | tSirSmeDisassocRsp *pDisassocRsp = (tSirSmeDisassocRsp *)pSirMsg; |
| 8920 | sessionId = pDisassocRsp->sessionId; |
| 8921 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 8922 | { |
| 8923 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8924 | if(!pSession) |
| 8925 | { |
| 8926 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8927 | return; |
| 8928 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8929 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 8930 | { |
| 8931 | pRoamInfo = &roamInfo; |
| 8932 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8933 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocRsp->peerMacAddr, sizeof(tSirMacAddr)); |
| 8934 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 8935 | pRoamInfo->statusCode = pDisassocRsp->statusCode; |
| 8936 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 8937 | } |
| 8938 | } |
| 8939 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8940 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8941 | case eWNI_SME_MIC_FAILURE_IND: |
| 8942 | { |
| 8943 | tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg; |
| 8944 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 8945 | eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8946 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8947 | { |
| 8948 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8949 | if(!pSession) |
| 8950 | { |
| 8951 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8952 | return; |
| 8953 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8954 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
| 8955 | palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8956 | secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR; |
| 8957 | secEvent.encryptionModeMulticast = |
| 8958 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8959 | secEvent.encryptionModeUnicast = |
| 8960 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8961 | secEvent.authMode = |
| 8962 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8963 | palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 8964 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 8965 | } |
| 8966 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8967 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pMicInd->bssId, &sessionId ); |
| 8968 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8969 | { |
| 8970 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 8971 | roamInfo.u.pMICFailureInfo = &pMicInd->info; |
| 8972 | pRoamInfo = &roamInfo; |
| 8973 | if(pMicInd->info.multicast) |
| 8974 | { |
| 8975 | result = eCSR_ROAM_RESULT_MIC_ERROR_GROUP; |
| 8976 | } |
| 8977 | else |
| 8978 | { |
| 8979 | result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
| 8980 | } |
| 8981 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_MIC_ERROR_IND, result); |
| 8982 | } |
| 8983 | } |
| 8984 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8985 | case eWNI_SME_WPS_PBC_PROBE_REQ_IND: |
| 8986 | { |
| 8987 | tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd)pSirMsg; |
| 8988 | tCsrRoamInfo roamInfo; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8989 | smsLog( pMac, LOG1, FL("WPS PBC Probe request Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8990 | |
| 8991 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pProbeReqInd->bssId, &sessionId ); |
| 8992 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8993 | { |
| 8994 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 8995 | roamInfo.u.pWPSPBCProbeReq = &pProbeReqInd->WPSPBCProbeReq; |
| 8996 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_WPS_PBC_PROBE_REQ_IND, |
| 8997 | eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND); |
| 8998 | } |
| 8999 | } |
| 9000 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9001 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9002 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 9003 | pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *)pSirMsg; |
| 9004 | switch( pStatusChangeMsg->statusChangeCode ) |
| 9005 | { |
| 9006 | case eSIR_SME_IBSS_ACTIVE: |
| 9007 | sessionId = csrFindIbssSession( pMac ); |
| 9008 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9009 | { |
| 9010 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9011 | if(!pSession) |
| 9012 | { |
| 9013 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9014 | return; |
| 9015 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9016 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED; |
| 9017 | if(pSession->pConnectBssDesc) |
| 9018 | { |
| 9019 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 9020 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 9021 | pRoamInfo = &roamInfo; |
| 9022 | } |
| 9023 | else |
| 9024 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9025 | smsLog(pMac, LOGE, " CSR eSIR_SME_IBSS_NEW_PEER connected BSS is empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9026 | } |
| 9027 | result = eCSR_ROAM_RESULT_IBSS_CONNECT; |
| 9028 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 9029 | } |
| 9030 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9031 | case eSIR_SME_IBSS_INACTIVE: |
| 9032 | sessionId = csrFindIbssSession( pMac ); |
| 9033 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9034 | { |
| 9035 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9036 | if(!pSession) |
| 9037 | { |
| 9038 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9039 | return; |
| 9040 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9041 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 9042 | result = eCSR_ROAM_RESULT_IBSS_INACTIVE; |
| 9043 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 9044 | } |
| 9045 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9046 | case eSIR_SME_JOINED_NEW_BSS: // IBSS coalescing. |
| 9047 | sessionId = csrFindIbssSession( pMac ); |
| 9048 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9049 | { |
| 9050 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9051 | if(!pSession) |
| 9052 | { |
| 9053 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9054 | return; |
| 9055 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9056 | // update the connection state information |
| 9057 | pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9058 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9059 | { |
| 9060 | vos_log_ibss_pkt_type *pIbssLog; |
| 9061 | tANI_U32 bi; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9062 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9063 | if(pIbssLog) |
| 9064 | { |
| 9065 | pIbssLog->eventId = WLAN_IBSS_EVENT_COALESCING; |
| 9066 | if(pNewBss) |
| 9067 | { |
| 9068 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pNewBss->bssId, 6); |
| 9069 | if(pNewBss->ssId.length) |
| 9070 | { |
| 9071 | palCopyMemory(pMac->hHdd, pIbssLog->ssid, pNewBss->ssId.ssId, pNewBss->ssId.length); |
| 9072 | } |
| 9073 | pIbssLog->operatingChannel = pNewBss->channelNumber; |
| 9074 | } |
| 9075 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 9076 | { |
| 9077 | //***U8 is not enough for beacon interval |
| 9078 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 9079 | } |
| 9080 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9081 | } |
| 9082 | } |
| 9083 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9084 | csrRoamUpdateConnectedProfileFromNewBss( pMac, sessionId, pNewBss ); |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9085 | |
| 9086 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 9087 | pSession->connectedProfile.EncryptionType )) |
| 9088 | { |
| 9089 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 9090 | pSession->connectedProfile.EncryptionType, |
| 9091 | pSession->pConnectBssDesc, |
| 9092 | &Broadcastaddr, |
| 9093 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); |
| 9094 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9095 | result = eCSR_ROAM_RESULT_IBSS_COALESCED; |
| 9096 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 9097 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pNewBss->bssId, sizeof(tCsrBssid)); |
| 9098 | pRoamInfo = &roamInfo; |
| 9099 | //This BSSID is th ereal BSSID, let's save it |
| 9100 | if(pSession->pConnectBssDesc) |
| 9101 | { |
| 9102 | palCopyMemory(pMac->hHdd, pSession->pConnectBssDesc->bssId, &pNewBss->bssId, sizeof(tCsrBssid)); |
| 9103 | } |
| 9104 | // Stop the join IBSS timer in case of join, for |
| 9105 | // genuine merge do nothing |
| 9106 | if(pSession->ibss_join_pending) |
| 9107 | { |
| 9108 | pSession->ibss_join_pending = FALSE; |
| 9109 | csrRoamStopIbssJoinTimer(pMac, sessionId); |
| 9110 | result = eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS; |
| 9111 | } |
| 9112 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9113 | smsLog(pMac, LOGW, "CSR: eSIR_SME_JOINED_NEW_BSS received from PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9114 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9115 | // detection by LIM that the capabilities of the associated AP have changed. |
| 9116 | case eSIR_SME_AP_CAPS_CHANGED: |
| 9117 | pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9118 | smsLog(pMac, LOGW, "CSR handling eSIR_SME_AP_CAPS_CHANGED"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9119 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pApNewCaps->bssId, &sessionId ); |
| 9120 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9121 | { |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9122 | if ((eCSR_ROAMING_STATE_JOINED == pMac->roam.curState[sessionId]) && |
| 9123 | ((eCSR_ROAM_SUBSTATE_JOINED_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9124 | (eCSR_ROAM_SUBSTATE_NONE == pMac->roam.curSubState[sessionId]) || |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9125 | (eCSR_ROAM_SUBSTATE_JOINED_NON_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
| 9126 | (eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC == pMac->roam.curSubState[sessionId])) |
| 9127 | ) |
| 9128 | { |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9129 | smsLog(pMac, LOGW, "Calling csrRoamDisconnectInternal"); |
| 9130 | csrRoamDisconnectInternal(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9131 | } |
| 9132 | else |
| 9133 | { |
| 9134 | smsLog(pMac, LOGW, |
| 9135 | "Skipping csrScanForCapabilityChange as " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9136 | "CSR is in state %d and sub-state %d", |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9137 | pMac->roam.curState[sessionId], |
| 9138 | pMac->roam.curSubState[sessionId]); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9139 | /* We ignore the caps change event if CSR is not in full connected state. |
| 9140 | * Send one event to PE to reset limSentCapsChangeNtf |
| 9141 | * Once limSentCapsChangeNtf set 0, lim can send sub sequent CAPS change event |
| 9142 | * otherwise lim cannot send any CAPS change events to SME */ |
| 9143 | csrSendResetApCapsChanged(pMac, &pApNewCaps->bssId); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9144 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9145 | } |
| 9146 | break; |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9147 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9148 | default: |
| 9149 | roamStatus = eCSR_ROAM_FAILED; |
| 9150 | result = eCSR_ROAM_RESULT_NONE; |
| 9151 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9152 | } // end switch on statusChangeCode |
| 9153 | if(eCSR_ROAM_RESULT_NONE != result) |
| 9154 | { |
| 9155 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, roamStatus, result); |
| 9156 | } |
| 9157 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9158 | case eWNI_SME_IBSS_NEW_PEER_IND: |
| 9159 | pIbssPeerInd = (tSmeIbssPeerInd *)pSirMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9160 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9161 | { |
| 9162 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9163 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9164 | if(pIbssLog) |
| 9165 | { |
| 9166 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_JOIN; |
| 9167 | palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
| 9168 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9169 | } |
| 9170 | } |
| 9171 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9172 | sessionId = csrFindIbssSession( pMac ); |
| 9173 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9174 | { |
| 9175 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9176 | |
| 9177 | if(!pSession) |
| 9178 | { |
| 9179 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9180 | return; |
| 9181 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9182 | // Issue the set Context request to LIM to establish the Unicast STA context for the new peer... |
| 9183 | if(pSession->pConnectBssDesc) |
| 9184 | { |
| 9185 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 9186 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 9187 | if(pIbssPeerInd->mesgLen > sizeof(tSmeIbssPeerInd)) |
| 9188 | { |
| 9189 | status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pbFrames, |
| 9190 | (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd))); |
| 9191 | if(HAL_STATUS_SUCCESS(status)) |
| 9192 | { |
| 9193 | roamInfo.nBeaconLength = (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd)); |
| 9194 | palCopyMemory(pMac->hHdd, roamInfo.pbFrames, ((tANI_U8 *)pIbssPeerInd) + sizeof(tSmeIbssPeerInd), |
| 9195 | roamInfo.nBeaconLength); |
| 9196 | } |
| 9197 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 9198 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 9199 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 9200 | status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pBssDesc, |
| 9201 | pSession->pConnectBssDesc->length); |
| 9202 | if(HAL_STATUS_SUCCESS(status)) |
| 9203 | { |
| 9204 | palCopyMemory(pMac->hHdd, roamInfo.pBssDesc, pSession->pConnectBssDesc, |
| 9205 | pSession->pConnectBssDesc->length); |
| 9206 | } |
| 9207 | if(HAL_STATUS_SUCCESS(status)) |
| 9208 | { |
| 9209 | pRoamInfo = &roamInfo; |
| 9210 | } |
| 9211 | else |
| 9212 | { |
| 9213 | if(roamInfo.pbFrames) |
| 9214 | { |
| 9215 | palFreeMemory(pMac->hHdd, roamInfo.pbFrames); |
| 9216 | } |
| 9217 | if(roamInfo.pBssDesc) |
| 9218 | { |
| 9219 | palFreeMemory(pMac->hHdd, roamInfo.pBssDesc); |
| 9220 | } |
| 9221 | } |
| 9222 | } |
| 9223 | else |
| 9224 | { |
| 9225 | pRoamInfo = &roamInfo; |
| 9226 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9227 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 9228 | pSession->connectedProfile.EncryptionType )) |
| 9229 | { |
| 9230 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 9231 | pSession->connectedProfile.EncryptionType, |
| 9232 | pSession->pConnectBssDesc, |
| 9233 | &(pIbssPeerInd->peerAddr), |
| 9234 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 9235 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9236 | } |
| 9237 | else |
| 9238 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9239 | smsLog(pMac, LOGW, " CSR eSIR_SME_IBSS_NEW_PEER connected BSS is empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9240 | } |
| 9241 | //send up the sec type for the new peer |
| 9242 | if (pRoamInfo) |
| 9243 | { |
| 9244 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9245 | } |
| 9246 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, |
| 9247 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_NEW_PEER); |
| 9248 | if(pRoamInfo) |
| 9249 | { |
| 9250 | if(roamInfo.pbFrames) |
| 9251 | { |
| 9252 | palFreeMemory(pMac->hHdd, roamInfo.pbFrames); |
| 9253 | } |
| 9254 | if(roamInfo.pBssDesc) |
| 9255 | { |
| 9256 | palFreeMemory(pMac->hHdd, roamInfo.pBssDesc); |
| 9257 | } |
| 9258 | } |
| 9259 | } |
| 9260 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9261 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 9262 | pIbssPeerInd = (tSmeIbssPeerInd*)pSirMsg; |
| 9263 | sessionId = csrFindIbssSession( pMac ); |
| 9264 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9265 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9266 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9267 | { |
| 9268 | vos_log_ibss_pkt_type *pIbssLog; |
| 9269 | |
| 9270 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9271 | if(pIbssLog) |
| 9272 | { |
| 9273 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_LEAVE; |
| 9274 | if(pIbssPeerInd) |
| 9275 | { |
| 9276 | palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
| 9277 | } |
| 9278 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9279 | } |
| 9280 | } |
| 9281 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9282 | smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9283 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 9284 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 9285 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 9286 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 9287 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 9288 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 9289 | } |
| 9290 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9291 | case eWNI_SME_SETCONTEXT_RSP: |
| 9292 | { |
| 9293 | tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *)pSirMsg; |
| 9294 | tListElem *pEntry; |
| 9295 | tSmeCmd *pCommand; |
| 9296 | |
| 9297 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9298 | if ( pEntry ) |
| 9299 | { |
| 9300 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9301 | if ( eSmeCommandSetKey == pCommand->command ) |
| 9302 | { |
| 9303 | sessionId = pCommand->sessionId; |
| 9304 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9305 | |
| 9306 | if(!pSession) |
| 9307 | { |
| 9308 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9309 | return; |
| 9310 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9311 | |
| 9312 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9313 | if(eCSR_ENCRYPT_TYPE_NONE != pSession->connectedProfile.EncryptionType) |
| 9314 | { |
| 9315 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
| 9316 | palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 9317 | if( pRsp->peerMacAddr[0] & 0x01 ) |
| 9318 | { |
| 9319 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 9320 | } |
| 9321 | else |
| 9322 | { |
| 9323 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 9324 | } |
| 9325 | setKeyEvent.encryptionModeMulticast = |
| 9326 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9327 | setKeyEvent.encryptionModeUnicast = |
| 9328 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9329 | palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 9330 | setKeyEvent.authMode = |
| 9331 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 9332 | if( eSIR_SUCCESS != pRsp->statusCode ) |
| 9333 | { |
| 9334 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 9335 | } |
| 9336 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 9337 | } |
| 9338 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9339 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 9340 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9341 | csrRoamStopWaitForKeyTimer( pMac ); |
| 9342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9343 | //We are done with authentication, whethere succeed or not |
| 9344 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9345 | //We do it here because this linkup function is not called after association |
| 9346 | //when a key needs to be set. |
| 9347 | if( csrIsConnStateConnectedInfra(pMac, sessionId) ) |
| 9348 | { |
| 9349 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 9350 | } |
| 9351 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9352 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9353 | { |
| 9354 | palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9355 | //Make sure we install the GTK before indicating to HDD as authenticated |
| 9356 | //This is to prevent broadcast packets go out after PTK and before GTK. |
| 9357 | if( palEqualMemory( pMac->hHdd, &Broadcastaddr, pRsp->peerMacAddr, |
| 9358 | sizeof(tSirMacAddr) ) ) |
| 9359 | { |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 9360 | #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE |
| 9361 | if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE) |
| 9362 | { |
| 9363 | tpSirSetActiveModeSetBncFilterReq pMsg; |
| 9364 | palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tSirSetActiveModeSetBncFilterReq)); |
| 9365 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_BCN_FILTER_REQ); |
| 9366 | pMsg->length = pal_cpu_to_be16(sizeof( tANI_U8)); |
| 9367 | pMsg->seesionId = sessionId; |
| 9368 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 9369 | } |
| 9370 | #endif |
| 9371 | result = eCSR_ROAM_RESULT_AUTHENTICATED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9372 | } |
| 9373 | else |
| 9374 | { |
| 9375 | result = eCSR_ROAM_RESULT_NONE; |
| 9376 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9377 | pRoamInfo = &roamInfo; |
| 9378 | } |
| 9379 | else |
| 9380 | { |
| 9381 | result = eCSR_ROAM_RESULT_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9382 | smsLog( pMac, LOGE, "CSR: Roam Completion setkey command failed(%d) PeerMac %02X-%02X-%02X-%02X-%02X-%02X...", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9383 | pRsp->statusCode, pRsp->peerMacAddr[0], pRsp->peerMacAddr[1], pRsp->peerMacAddr[2], |
| 9384 | pRsp->peerMacAddr[3], pRsp->peerMacAddr[4], pRsp->peerMacAddr[5] ); |
| 9385 | } |
| 9386 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 9387 | eCSR_ROAM_SET_KEY_COMPLETE, result); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9388 | // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS |
| 9389 | // can go ahead and initiate the TSPEC if any are pending |
| 9390 | 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] | 9391 | #ifdef FEATURE_WLAN_CCX |
| 9392 | //Send Adjacent AP repot to new AP. |
| 9393 | if (result == eCSR_ROAM_RESULT_AUTHENTICATED && |
| 9394 | pSession->isPrevApInfoValid && |
| 9395 | pSession->connectedProfile.isCCXAssoc) |
| 9396 | { |
| 9397 | #ifdef WLAN_FEATURE_VOWIFI |
| 9398 | csrCcxSendAdjacentApRepMsg(pMac, pSession); |
| 9399 | #endif |
| 9400 | pSession->isPrevApInfoValid = FALSE; |
| 9401 | } |
| 9402 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9403 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9404 | { |
| 9405 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 9406 | } |
| 9407 | } |
| 9408 | else |
| 9409 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9410 | smsLog( pMac, LOGE, "CSR: Roam Completion called but setkey command is not ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9411 | } |
| 9412 | } |
| 9413 | else |
| 9414 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9415 | smsLog( pMac, LOGE, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9416 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9417 | smeProcessPendingQueue( pMac ); |
| 9418 | } |
| 9419 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9420 | case eWNI_SME_REMOVEKEY_RSP: |
| 9421 | { |
| 9422 | tSirSmeRemoveKeyRsp *pRsp = (tSirSmeRemoveKeyRsp *)pSirMsg; |
| 9423 | tListElem *pEntry; |
| 9424 | tSmeCmd *pCommand; |
| 9425 | |
| 9426 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9427 | if ( pEntry ) |
| 9428 | { |
| 9429 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9430 | if ( eSmeCommandRemoveKey == pCommand->command ) |
| 9431 | { |
| 9432 | sessionId = pCommand->sessionId; |
| 9433 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9434 | |
| 9435 | if(!pSession) |
| 9436 | { |
| 9437 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9438 | return; |
| 9439 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9440 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9441 | { |
| 9442 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
| 9443 | palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 9444 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
| 9445 | removeKeyEvent.encryptionModeMulticast = |
| 9446 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9447 | removeKeyEvent.encryptionModeUnicast = |
| 9448 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9449 | palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 9450 | removeKeyEvent.authMode = |
| 9451 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 9452 | if( eSIR_SUCCESS != pRsp->statusCode ) |
| 9453 | { |
| 9454 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 9455 | } |
| 9456 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 9457 | } |
| 9458 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9459 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9460 | { |
| 9461 | palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) ); |
| 9462 | result = eCSR_ROAM_RESULT_NONE; |
| 9463 | pRoamInfo = &roamInfo; |
| 9464 | } |
| 9465 | else |
| 9466 | { |
| 9467 | result = eCSR_ROAM_RESULT_FAILURE; |
| 9468 | } |
| 9469 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 9470 | eCSR_ROAM_REMOVE_KEY_COMPLETE, result); |
| 9471 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9472 | { |
| 9473 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 9474 | } |
| 9475 | } |
| 9476 | else |
| 9477 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9478 | smsLog( pMac, LOGW, "CSR: Roam Completion called but setkey command is not ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9479 | } |
| 9480 | } |
| 9481 | else |
| 9482 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9483 | smsLog( pMac, LOGW, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9484 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9485 | smeProcessPendingQueue( pMac ); |
| 9486 | } |
| 9487 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9488 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9489 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9490 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 9491 | break; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9492 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 9493 | case eWNI_SME_GET_ROAM_RSSI_RSP: |
| 9494 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
| 9495 | csrRoamRssiRspProcessor( pMac, pSirMsg ); |
| 9496 | break; |
| 9497 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9498 | case eWNI_SME_GET_RSSI_REQ: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9499 | smsLog( pMac, LOG2, FL("GetRssiReq from self")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9500 | csrUpdateRssi( pMac, pSirMsg ); |
| 9501 | break; |
| 9502 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9503 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9504 | case eWNI_SME_FT_PRE_AUTH_RSP: |
| 9505 | csrRoamFTPreAuthRspProcessor( pMac, (tpSirFTPreAuthRsp)pSirMsg ); |
| 9506 | break; |
| 9507 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9508 | case eWNI_SME_MAX_ASSOC_EXCEEDED: |
| 9509 | pSmeMaxAssocInd = (tSmeMaxAssocInd*)pSirMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9510 | smsLog( pMac, LOG1, FL("send indication that max assoc have been reached and the new peer cannot be accepted")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9511 | sessionId = pSmeMaxAssocInd->sessionId; |
| 9512 | roamInfo.sessionId = sessionId; |
| 9513 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pSmeMaxAssocInd->peerMac, sizeof(tCsrBssid)); |
| 9514 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 9515 | eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED); |
| 9516 | break; |
| 9517 | |
| 9518 | case eWNI_SME_BTAMP_LOG_LINK_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9519 | smsLog( pMac, LOG1, FL("Establish logical link req from HCI serialized through MC thread")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9520 | btampEstablishLogLinkHdlr( pSirMsg ); |
| 9521 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9522 | case eWNI_SME_RSSI_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9523 | smsLog( pMac, LOG1, FL("RSSI indication from TL serialized through MC thread")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9524 | csrRoamRssiIndHdlr( pMac, pSirMsg ); |
| 9525 | break; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 9526 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 9527 | case eWNI_SME_CANDIDATE_FOUND_IND: |
| 9528 | smsLog( pMac, LOG2, FL("Candidate found indication from PE")); |
| 9529 | csrNeighborRoamCandidateFoundIndHdlr( pMac, pSirMsg ); |
| 9530 | break; |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 9531 | case eWNI_SME_HANDOFF_REQ: |
| 9532 | smsLog( pMac, LOG2, FL("Handoff Req from self")); |
| 9533 | csrNeighborRoamHandoffReqHdlr( pMac, pSirMsg ); |
| 9534 | break; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 9535 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9536 | |
| 9537 | default: |
| 9538 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9539 | } // end switch on message type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9540 | } |
| 9541 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9542 | void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, |
| 9543 | tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult) |
| 9544 | { |
| 9545 | if(pSession) |
| 9546 | { |
| 9547 | if(pSession->bRefAssocStartCnt) |
| 9548 | { |
| 9549 | pSession->bRefAssocStartCnt--; |
| 9550 | VOS_ASSERT( pSession->bRefAssocStartCnt == 0); |
| 9551 | //Need to call association_completion because there is an assoc_start pending. |
| 9552 | csrRoamCallCallback(pMac, pSession->sessionId, NULL, roamId, |
| 9553 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 9554 | eCSR_ROAM_RESULT_FAILURE); |
| 9555 | } |
| 9556 | csrRoamCallCallback(pMac, pSession->sessionId, pRoamInfo, roamId, eCSR_ROAM_ROAMING_COMPLETION, roamResult); |
| 9557 | } |
| 9558 | else |
| 9559 | { |
| 9560 | smsLog(pMac, LOGW, FL(" pSession is NULL")); |
| 9561 | } |
| 9562 | } |
| 9563 | |
| 9564 | |
| 9565 | eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason) |
| 9566 | { |
| 9567 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9568 | if(CSR_IS_LOSTLINK_ROAMING(roamingReason) && |
| 9569 | (eANI_BOOLEAN_FALSE == pMac->roam.roamSession[sessionId].fCancelRoaming)) |
| 9570 | { |
| 9571 | status = csrScanRequestLostLink1( pMac, sessionId ); |
| 9572 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9573 | return(status); |
| 9574 | } |
| 9575 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9576 | //return a boolean to indicate whether roaming completed or continue. |
| 9577 | tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 9578 | tANI_BOOLEAN fForce, eCsrRoamResult roamResult) |
| 9579 | { |
| 9580 | tANI_BOOLEAN fCompleted = eANI_BOOLEAN_TRUE; |
| 9581 | tANI_TIMESTAMP roamTime = (tANI_TIMESTAMP)(pMac->roam.configParam.nRoamingTime * PAL_TICKS_PER_SECOND); |
| 9582 | tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 9583 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9584 | if(!pSession) |
| 9585 | { |
| 9586 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9587 | return eANI_BOOLEAN_FALSE; |
| 9588 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9589 | //Check whether time is up |
| 9590 | if(pSession->fCancelRoaming || fForce || |
| 9591 | ((curTime - pSession->roamingStartTime) > roamTime) || |
| 9592 | eCsrReassocRoaming == pSession->roamingReason || |
| 9593 | eCsrDynamicRoaming == pSession->roamingReason) |
| 9594 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9595 | smsLog(pMac, LOGW, FL(" indicates roaming completion")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9596 | if(pSession->fCancelRoaming && CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason)) |
| 9597 | { |
| 9598 | //roaming is cancelled, tell HDD to indicate disconnect |
| 9599 | //Because LIM overload deauth_ind for both deauth frame and missed beacon |
| 9600 | //we need to use this logic to detinguish it. For missed beacon, LIM set reason |
| 9601 | //to be eSIR_BEACON_MISSED |
| 9602 | if(eSIR_BEACON_MISSED == pSession->roamingStatusCode) |
| 9603 | { |
| 9604 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 9605 | } |
| 9606 | else if(eCsrLostlinkRoamingDisassoc == pSession->roamingReason) |
| 9607 | { |
| 9608 | roamResult = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 9609 | } |
| 9610 | else if(eCsrLostlinkRoamingDeauth == pSession->roamingReason) |
| 9611 | { |
| 9612 | roamResult = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 9613 | } |
| 9614 | else |
| 9615 | { |
| 9616 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 9617 | } |
| 9618 | } |
| 9619 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 9620 | pSession->roamingReason = eCsrNotRoaming; |
| 9621 | } |
| 9622 | else |
| 9623 | { |
| 9624 | pSession->roamResult = roamResult; |
| 9625 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoamingTimer(pMac, sessionId, PAL_TIMER_TO_SEC_UNIT))) |
| 9626 | { |
| 9627 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 9628 | pSession->roamingReason = eCsrNotRoaming; |
| 9629 | } |
| 9630 | else |
| 9631 | { |
| 9632 | fCompleted = eANI_BOOLEAN_FALSE; |
| 9633 | } |
| 9634 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9635 | return(fCompleted); |
| 9636 | } |
| 9637 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9638 | void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9639 | { |
| 9640 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9641 | |
| 9642 | if(!pSession) |
| 9643 | { |
| 9644 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9645 | return; |
| 9646 | } |
| 9647 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9648 | if(CSR_IS_ROAMING(pSession)) |
| 9649 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9650 | smsLog(pMac, LOGW, " Cancelling roaming"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9651 | pSession->fCancelRoaming = eANI_BOOLEAN_TRUE; |
| 9652 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 9653 | { |
| 9654 | //No need to do anything in here because the handler takes care of it |
| 9655 | } |
| 9656 | else |
| 9657 | { |
| 9658 | eCsrRoamResult roamResult = CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason) ? |
| 9659 | eCSR_ROAM_RESULT_LOSTLINK : eCSR_ROAM_RESULT_NONE; |
| 9660 | //Roaming is stopped after here |
| 9661 | csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_TRUE, roamResult); |
| 9662 | //Since CSR may be in lostlink roaming situation, abort all roaming related activities |
| 9663 | csrScanAbortMacScan(pMac); |
| 9664 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 9665 | } |
| 9666 | } |
| 9667 | } |
| 9668 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9669 | void csrRoamRoamingTimerHandler(void *pv) |
| 9670 | { |
| 9671 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9672 | tpAniSirGlobal pMac = pInfo->pMac; |
| 9673 | tANI_U32 sessionId = pInfo->sessionId; |
| 9674 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9675 | |
| 9676 | if(!pSession) |
| 9677 | { |
| 9678 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9679 | return; |
| 9680 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9681 | |
| 9682 | if(eANI_BOOLEAN_FALSE == pSession->fCancelRoaming) |
| 9683 | { |
| 9684 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoaming(pMac, sessionId, pSession->roamingReason))) |
| 9685 | { |
| 9686 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, pSession->roamResult); |
| 9687 | pSession->roamingReason = eCsrNotRoaming; |
| 9688 | } |
| 9689 | } |
| 9690 | } |
| 9691 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9692 | eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 9693 | { |
| 9694 | eHalStatus status; |
| 9695 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9696 | |
| 9697 | if(!pSession) |
| 9698 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9699 | smsLog(pMac, LOGE, FL(" session %d not found"), sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9700 | return eHAL_STATUS_FAILURE; |
| 9701 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9702 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9703 | smsLog(pMac, LOG1, " csrScanStartRoamingTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9704 | pSession->roamingTimerInfo.sessionId = (tANI_U8)sessionId; |
| 9705 | status = palTimerStart(pMac->hHdd, pSession->hTimerRoaming, interval, eANI_BOOLEAN_FALSE); |
| 9706 | |
| 9707 | return (status); |
| 9708 | } |
| 9709 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9710 | eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9711 | { |
| 9712 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerRoaming)); |
| 9713 | } |
| 9714 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9715 | void csrRoamWaitForKeyTimeOutHandler(void *pv) |
| 9716 | { |
| 9717 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9718 | tpAniSirGlobal pMac = pInfo->pMac; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9719 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pInfo->sessionId ); |
| 9720 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9721 | smsLog(pMac, LOGW, "WaitForKey timer expired in state=%d sub-state=%d", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9722 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9723 | pMac->roam.curSubState[pInfo->sessionId]); |
| 9724 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9725 | if( CSR_IS_WAIT_FOR_KEY( pMac, pInfo->sessionId ) ) |
| 9726 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9727 | #ifdef FEATURE_WLAN_LFR |
| 9728 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9729 | { |
| 9730 | /* |
| 9731 | * Enable heartbeat timer when hand-off is in progress |
| 9732 | * and Key Wait timer expired. |
| 9733 | */ |
| 9734 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey expiry" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9735 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9736 | pMac->roam.configParam.HeartbeatThresh24); |
| 9737 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 9738 | pMac->roam.configParam.HeartbeatThresh24, |
| 9739 | NULL, eANI_BOOLEAN_FALSE); |
| 9740 | } |
| 9741 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9742 | smsLog(pMac, LOGW, " SME pre-auth state timeout. "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9743 | //Change the substate so command queue is unblocked. |
| 9744 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, pInfo->sessionId); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9745 | if (pSession) |
| 9746 | { |
| 9747 | if( csrIsConnStateConnectedInfra(pMac, pInfo->sessionId) ) |
| 9748 | { |
| 9749 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 9750 | smeProcessPendingQueue(pMac); |
| 9751 | } |
| 9752 | else |
| 9753 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9754 | smsLog(pMac, LOGW, "%s: could not post link up", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9755 | __func__); |
| 9756 | } |
| 9757 | } |
| 9758 | else |
| 9759 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9760 | smsLog(pMac, LOGW, "%s: session not found", __func__); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9761 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9762 | } |
| 9763 | |
| 9764 | } |
| 9765 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9766 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval) |
| 9767 | { |
| 9768 | eHalStatus status; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9769 | #ifdef FEATURE_WLAN_LFR |
| 9770 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9771 | { |
| 9772 | /* Disable heartbeat timer when hand-off is in progress */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9773 | smsLog(pMac, LOG2, "%s: disabling HB timer in state=%d sub-state=%d", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9774 | __func__, |
| 9775 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9776 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId]); |
| 9777 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE); |
| 9778 | } |
| 9779 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9780 | smsLog(pMac, LOG1, " csrScanStartWaitForKeyTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9781 | status = palTimerStart(pMac->hHdd, pMac->roam.hTimerWaitForKey, interval, eANI_BOOLEAN_FALSE); |
| 9782 | |
| 9783 | return (status); |
| 9784 | } |
| 9785 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9786 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac) |
| 9787 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9788 | smsLog(pMac, LOG2, "WaitForKey timer stopped in state=%d sub-state=%d", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9789 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9790 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId]); |
| 9791 | #ifdef FEATURE_WLAN_LFR |
| 9792 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9793 | { |
| 9794 | /* |
| 9795 | * Enable heartbeat timer when hand-off is in progress |
| 9796 | * and Key Wait timer got stopped for some reason |
| 9797 | */ |
| 9798 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey stop" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9799 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9800 | pMac->roam.configParam.HeartbeatThresh24); |
| 9801 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 9802 | pMac->roam.configParam.HeartbeatThresh24, |
| 9803 | NULL, eANI_BOOLEAN_FALSE); |
| 9804 | } |
| 9805 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9806 | return (palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey)); |
| 9807 | } |
| 9808 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9809 | void csrRoamIbssJoinTimerHandler(void *pv) |
| 9810 | { |
| 9811 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9812 | tpAniSirGlobal pMac = pInfo->pMac; |
| 9813 | eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE; |
| 9814 | tANI_U32 sessionId = pInfo->sessionId; |
| 9815 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9816 | |
| 9817 | if(!pSession) |
| 9818 | { |
| 9819 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9820 | return; |
| 9821 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9822 | |
| 9823 | pSession->ibss_join_pending = FALSE; |
| 9824 | // JEZ100225: As of main/latest "tip", we are no longer doing this. Check on this. |
| 9825 | //csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 9826 | // Send an IBSS stop request to PE |
| 9827 | csrRoamDisconnectInternal(pMac, sessionId, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9828 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9829 | eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 9830 | { |
| 9831 | eHalStatus status; |
| 9832 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9833 | |
| 9834 | if(!pSession) |
| 9835 | { |
| 9836 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9837 | return eHAL_STATUS_FAILURE; |
| 9838 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9839 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9840 | smsLog(pMac, LOG1, " csrRoamStartIbssJoinTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9841 | pSession->ibssJoinTimerInfo.sessionId = (tANI_U8)sessionId; |
| 9842 | status = palTimerStart(pMac->hHdd, pSession->hTimerIbssJoining, interval, eANI_BOOLEAN_FALSE); |
| 9843 | |
| 9844 | return (status); |
| 9845 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9846 | eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9847 | { |
| 9848 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerIbssJoining)); |
| 9849 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9850 | void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, |
| 9851 | eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess) |
| 9852 | { |
| 9853 | eRoamCmdStatus roamStatus = csrGetRoamCompleteStatus(pMac, sessionId); |
| 9854 | tANI_U32 roamId = 0; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9855 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 9856 | /* To silence the KW tool Null chaeck is added */ |
| 9857 | if(!pSession) |
| 9858 | { |
| 9859 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9860 | return; |
| 9861 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9862 | |
| 9863 | if(pCommand) |
| 9864 | { |
| 9865 | roamId = pCommand->u.roamCmd.roamId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9866 | VOS_ASSERT( sessionId == pCommand->sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9867 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9868 | if(eCSR_ROAM_ROAMING_COMPLETION == roamStatus) |
| 9869 | { |
| 9870 | //if success, force roaming completion |
| 9871 | csrRoamCompleteRoaming(pMac, sessionId, fSuccess, roamResult); |
| 9872 | } |
| 9873 | else |
| 9874 | { |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9875 | VOS_ASSERT(pSession->bRefAssocStartCnt == 0); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9876 | smsLog(pMac, LOGW, FL(" indicates association completion. roamResult = %d"), roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9877 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, roamId, roamStatus, roamResult); |
| 9878 | } |
| 9879 | } |
| 9880 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9881 | eHalStatus csrRoamLostLink( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 type, tSirSmeRsp *pSirMsg) |
| 9882 | { |
| 9883 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9884 | tSirSmeDeauthInd *pDeauthIndMsg = NULL; |
| 9885 | tSirSmeDisassocInd *pDisassocIndMsg = NULL; |
| 9886 | eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK; |
| 9887 | tCsrRoamInfo *pRoamInfo = NULL; |
| 9888 | tCsrRoamInfo roamInfo; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9889 | tANI_BOOLEAN fToRoam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9890 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9891 | /* To silence the KW tool Null chaeck is added */ |
| 9892 | if(!pSession) |
| 9893 | { |
| 9894 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9895 | return eHAL_STATUS_FAILURE; |
| 9896 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9897 | //Only need to roam for infra station. In this case P2P client will roam as well |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9898 | fToRoam = CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9899 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
| 9900 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 9901 | { |
| 9902 | result = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 9903 | pDisassocIndMsg = (tSirSmeDisassocInd *)pSirMsg; |
| 9904 | pSession->roamingStatusCode = pDisassocIndMsg->statusCode; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 9905 | pSession->joinFailStatusCode.reasonCode = pDisassocIndMsg->reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9906 | } |
| 9907 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 9908 | { |
| 9909 | result = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 9910 | pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg; |
| 9911 | pSession->roamingStatusCode = pDeauthIndMsg->statusCode; |
Madan Mohan Koyyalamudi | 6a80893 | 2012-11-06 16:05:54 -0800 | [diff] [blame] | 9912 | /* Convert into proper reason code */ |
| 9913 | pSession->joinFailStatusCode.reasonCode = |
| 9914 | (pDeauthIndMsg->reasonCode == eSIR_BEACON_MISSED) ? |
Agarwal Ashish | 838f1f3 | 2013-03-11 20:54:52 +0530 | [diff] [blame] | 9915 | 0 : pDeauthIndMsg->reasonCode; |
| 9916 | /* cfg layer expects 0 as reason code if |
| 9917 | the driver dosent know the reason code |
| 9918 | eSIR_BEACON_MISSED is defined as locally */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9919 | } |
| 9920 | else |
| 9921 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9922 | smsLog(pMac, LOGW, FL("gets an unknown type (%d)"), type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9923 | result = eCSR_ROAM_RESULT_NONE; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 9924 | pSession->joinFailStatusCode.reasonCode = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9925 | } |
| 9926 | |
| 9927 | // call profile lost link routine here |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9928 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9929 | { |
| 9930 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_LOSTLINK_DETECTED, result); |
| 9931 | } |
| 9932 | |
| 9933 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 9934 | { |
| 9935 | status = csrSendMBDisassocCnfMsg(pMac, pDisassocIndMsg); |
| 9936 | } |
| 9937 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 9938 | { |
| 9939 | status = csrSendMBDeauthCnfMsg(pMac, pDeauthIndMsg); |
| 9940 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9941 | if(!HAL_STATUS_SUCCESS(status)) |
| 9942 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9943 | //If fail to send confirmation to PE, not to trigger roaming |
| 9944 | fToRoam = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9945 | } |
| 9946 | |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9947 | //prepare to tell HDD to disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9948 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 9949 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 9950 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9951 | if( eWNI_SME_DISASSOC_IND == type) |
| 9952 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9953 | //staMacAddr |
| 9954 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 9955 | roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId; |
| 9956 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9957 | else if( eWNI_SME_DEAUTH_IND == type ) |
| 9958 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9959 | //staMacAddr |
| 9960 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 9961 | roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId; |
| 9962 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9963 | smsLog(pMac, LOGW, FL("roamInfo.staId (%d)"), roamInfo.staId); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9964 | |
| 9965 | /* See if we can possibly roam. If so, start the roaming process and notify HDD |
| 9966 | that we are roaming. But if we cannot possibly roam, or if we are unable to |
| 9967 | currently roam, then notify HDD of the lost link */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9968 | if(fToRoam) |
| 9969 | { |
| 9970 | //Only remove the connected BSS in infrastructure mode |
| 9971 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 9972 | //Not to do anying for lostlink with WDS |
| 9973 | if( pMac->roam.configParam.nRoamingTime ) |
| 9974 | { |
| 9975 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac, sessionId, |
| 9976 | ( eWNI_SME_DEAUTH_IND == type ) ? |
| 9977 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc))) |
| 9978 | { |
| 9979 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 9980 | //For IBSS, we need to give some more info to HDD |
| 9981 | if(csrIsBssTypeIBSS(pSession->connectedProfile.BSSType)) |
| 9982 | { |
| 9983 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 9984 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 9985 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 9986 | } |
| 9987 | else |
| 9988 | { |
| 9989 | roamInfo.reasonCode = eCsrRoamReasonSmeIssuedForLostLink; |
| 9990 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9991 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9992 | pSession->roamingReason = ( eWNI_SME_DEAUTH_IND == type ) ? |
| 9993 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc; |
| 9994 | pSession->roamingStartTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 9995 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_LOSTLINK); |
| 9996 | } |
| 9997 | else |
| 9998 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9999 | smsLog(pMac, LOGW, " %s Fail to start roaming, status = %d", __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10000 | fToRoam = eANI_BOOLEAN_FALSE; |
| 10001 | } |
| 10002 | } |
| 10003 | else |
| 10004 | { |
| 10005 | //We are told not to roam, indicate lostlink |
| 10006 | fToRoam = eANI_BOOLEAN_FALSE; |
| 10007 | } |
| 10008 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10009 | if(!fToRoam) |
| 10010 | { |
Madan Mohan Koyyalamudi | af854cf | 2012-10-30 17:56:25 -0700 | [diff] [blame] | 10011 | //Tell HDD about the lost link |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10012 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 10013 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10014 | /* Don't call csrRoamCallCallback for GO/SoftAp case as this indication |
| 10015 | * was already given as part of eWNI_SME_DISASSOC_IND msg handling in |
| 10016 | * csrRoamCheckForLinkStatusChange API. |
| 10017 | */ |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 10018 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result); |
| 10019 | } |
| 10020 | |
| 10021 | /*No need to start idle scan in case of IBSS/SAP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10022 | Still enable idle scan for polling in case concurrent sessions are running */ |
| 10023 | if(CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile)) |
| 10024 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10025 | csrScanStartIdleScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10026 | } |
| 10027 | } |
| 10028 | |
| 10029 | return (status); |
| 10030 | } |
| 10031 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10032 | eHalStatus csrRoamLostLinkAfterhandoffFailure( tpAniSirGlobal pMac,tANI_U32 sessionId) |
| 10033 | { |
| 10034 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10035 | tListElem *pEntry = NULL; |
| 10036 | tSmeCmd *pCommand = NULL; |
| 10037 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10038 | |
| 10039 | if(!pSession) |
| 10040 | { |
| 10041 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10042 | return eHAL_STATUS_FAILURE; |
| 10043 | } |
| 10044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10045 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10046 | //Only remove the connected BSS in infrastructure mode |
| 10047 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 10048 | if(pMac->roam.configParam.nRoamingTime) |
| 10049 | { |
| 10050 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac,sessionId, pSession->roamingReason))) |
| 10051 | { |
| 10052 | //before starting the lost link logic release the roam command for handoff |
| 10053 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 10054 | if(pEntry) |
| 10055 | { |
| 10056 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 10057 | } |
| 10058 | if(pCommand) |
| 10059 | { |
| 10060 | if (( eSmeCommandRoam == pCommand->command ) && |
| 10061 | ( eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)) |
| 10062 | { |
| 10063 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10064 | { |
| 10065 | csrReleaseCommandRoam( pMac, pCommand ); |
| 10066 | } |
| 10067 | } |
| 10068 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10069 | smsLog( pMac, LOGW, "Lost link roaming started ..."); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10070 | } |
| 10071 | } |
| 10072 | else |
| 10073 | { |
| 10074 | //We are told not to roam, indicate lostlink |
| 10075 | status = eHAL_STATUS_FAILURE; |
| 10076 | } |
| 10077 | |
| 10078 | return (status); |
| 10079 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10080 | void csrRoamWmStatusChangeComplete( tpAniSirGlobal pMac ) |
| 10081 | { |
| 10082 | tListElem *pEntry; |
| 10083 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10084 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 10085 | if ( pEntry ) |
| 10086 | { |
| 10087 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 10088 | if ( eSmeCommandWmStatusChange == pCommand->command ) |
| 10089 | { |
| 10090 | // Nothing to process in a Lost Link completion.... It just kicks off a |
| 10091 | // roaming sequence. |
| 10092 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10093 | { |
| 10094 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 10095 | } |
| 10096 | else |
| 10097 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10098 | smsLog( pMac, LOGE, " ******csrRoamWmStatusChangeComplete fail to release command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10099 | } |
| 10100 | |
| 10101 | } |
| 10102 | else |
| 10103 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10104 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but LOST LINK command is not ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10105 | } |
| 10106 | } |
| 10107 | else |
| 10108 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10109 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10110 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10111 | smeProcessPendingQueue( pMac ); |
| 10112 | } |
| 10113 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10114 | void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 10115 | { |
| 10116 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 10117 | tSirSmeRsp *pSirSmeMsg; |
| 10118 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pCommand->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10119 | |
| 10120 | if(!pSession) |
| 10121 | { |
| 10122 | smsLog(pMac, LOGE, FL(" session %d not found "), pCommand->sessionId); |
| 10123 | return; |
| 10124 | } |
| 10125 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10126 | switch ( pCommand->u.wmStatusChangeCmd.Type ) |
| 10127 | { |
| 10128 | case eCsrDisassociated: |
| 10129 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg; |
| 10130 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DISASSOC_IND, pSirSmeMsg); |
| 10131 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10132 | case eCsrDeauthenticated: |
| 10133 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg; |
| 10134 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DEAUTH_IND, pSirSmeMsg); |
| 10135 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10136 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10137 | smsLog(pMac, LOGW, FL("gets an unknown command %d"), pCommand->u.wmStatusChangeCmd.Type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10138 | break; |
| 10139 | } |
| 10140 | //For WDS, we want to stop BSS as well when it is indicated that it is disconnected. |
| 10141 | if( CSR_IS_CONN_WDS(&pSession->connectedProfile) ) |
| 10142 | { |
| 10143 | if( !HAL_STATUS_SUCCESS(csrRoamIssueStopBssCmd( pMac, pCommand->sessionId, eANI_BOOLEAN_TRUE )) ) |
| 10144 | { |
| 10145 | //This is not good |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10146 | smsLog(pMac, LOGE, FL(" failed to issue stopBSS command")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10147 | } |
| 10148 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10149 | // Lost Link just triggers a roaming sequence. We can complte the Lost Link |
| 10150 | // command here since there is nothing else to do. |
| 10151 | csrRoamWmStatusChangeComplete( pMac ); |
| 10152 | } |
| 10153 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10154 | //This function returns band and mode information. |
| 10155 | //The only tricky part is that if phyMode is set to 11abg, this function may return eCSR_CFG_DOT11_MODE_11B |
| 10156 | //instead of eCSR_CFG_DOT11_MODE_11G if everything is set to auto-pick. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10157 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 10158 | tANI_U8 operationChn, eCsrBand *pBand ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10159 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10160 | eCsrPhyMode phyModeIn = (eCsrPhyMode)pProfile->phyMode; |
| 10161 | eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pProfile, phyModeIn, |
| 10162 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10163 | eCsrBand eBand; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 10164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10165 | //If the global setting for dot11Mode is set to auto/abg, we overwrite the setting in the profile. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10166 | if( ((!CSR_IS_INFRA_AP(pProfile )&& !CSR_IS_WDS(pProfile )) && |
| 10167 | ((eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) || |
| 10168 | (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode))) || |
| 10169 | (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10170 | { |
| 10171 | switch( pMac->roam.configParam.uCfgDot11Mode ) |
| 10172 | { |
| 10173 | case eCSR_CFG_DOT11_MODE_11A: |
| 10174 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10175 | eBand = eCSR_BAND_5G; |
| 10176 | break; |
| 10177 | case eCSR_CFG_DOT11_MODE_11B: |
| 10178 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10179 | eBand = eCSR_BAND_24; |
| 10180 | break; |
| 10181 | case eCSR_CFG_DOT11_MODE_11G: |
| 10182 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 10183 | eBand = eCSR_BAND_24; |
| 10184 | break; |
| 10185 | case eCSR_CFG_DOT11_MODE_11N: |
| 10186 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10187 | eBand = eCSR_BAND_24; |
| 10188 | break; |
| 10189 | //case eCSR_CFG_DOT11_MODE_BEST: |
| 10190 | // cfgDot11Mode = eCSR_CFG_DOT11_MODE_BEST; |
| 10191 | // eBand = eCSR_BAND_24; |
| 10192 | // break; |
| 10193 | default: |
| 10194 | // Global dot11 Mode setting is 11a/b/g. |
| 10195 | // use the channel number to determine the Mode setting. |
| 10196 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 10197 | { |
| 10198 | eBand = pMac->roam.configParam.eBand; |
| 10199 | if(eCSR_BAND_24 == eBand) |
| 10200 | { |
| 10201 | //See reason in else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) to pick 11B |
| 10202 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10203 | } |
| 10204 | else |
| 10205 | { |
| 10206 | //prefer 5GHz |
| 10207 | eBand = eCSR_BAND_5G; |
| 10208 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10209 | } |
| 10210 | } |
| 10211 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10212 | { |
| 10213 | // channel is a 2.4GHz channel. Set mode to 11g. |
| 10214 | // |
| 10215 | // !!LAC - WiFi tests require IBSS networks to start in 11b mode without any change to the |
| 10216 | // default parameter settings on the adapter. We use ACU to start an IBSS through creation |
| 10217 | // of a startIBSS profile. this startIBSS profile has Auto MACProtocol and the |
| 10218 | // adapter property setting for dot11Mode is also AUTO. So in this case, let's start |
| 10219 | // the IBSS network in 11b mode instead of 11g mode. |
| 10220 | // |
| 10221 | // so this is for Auto=profile->MacProtocol && Auto=Global.dot11Mode && profile->channel is < 14, |
| 10222 | // then start the IBSS in b mode. |
| 10223 | // |
| 10224 | // Note: we used to have this start as an 11g IBSS for best performance... now to specify that |
| 10225 | // the user will have to set the do11Mode in the property page to 11g to force it. |
| 10226 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10227 | eBand = eCSR_BAND_24; |
| 10228 | } |
| 10229 | else |
| 10230 | { |
| 10231 | // else, it's a 5.0GHz channel. Set mode to 11a. |
| 10232 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10233 | eBand = eCSR_BAND_5G; |
| 10234 | } |
| 10235 | break; |
| 10236 | }//switch |
| 10237 | }//if( eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 10238 | else |
| 10239 | { |
| 10240 | //dot11 mode is set, lets pick the band |
| 10241 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 10242 | { |
| 10243 | // channel is Auto also. |
| 10244 | eBand = pMac->roam.configParam.eBand; |
| 10245 | if(eCSR_BAND_ALL == eBand) |
| 10246 | { |
| 10247 | //prefer 5GHz |
| 10248 | eBand = eCSR_BAND_5G; |
| 10249 | } |
| 10250 | } |
| 10251 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10252 | { |
| 10253 | eBand = eCSR_BAND_24; |
| 10254 | } |
| 10255 | else |
| 10256 | { |
| 10257 | eBand = eCSR_BAND_5G; |
| 10258 | } |
| 10259 | } |
| 10260 | if(pBand) |
| 10261 | { |
| 10262 | *pBand = eBand; |
| 10263 | } |
| 10264 | |
| 10265 | if (operationChn == 14){ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10266 | smsLog(pMac, LOGE, FL(" Switching to Dot11B mode ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10267 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10268 | } |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10269 | |
Madan Mohan Koyyalamudi | 5ec4b18 | 2012-11-28 16:15:17 -0800 | [diff] [blame] | 10270 | /* Incase of WEP Security encryption type is coming as part of add key. So while STart BSS dont have information */ |
| 10271 | if( (!CSR_IS_11n_ALLOWED(pProfile->EncryptionType.encryptionType[0] ) || ((pProfile->privacy == 1) && (pProfile->EncryptionType.encryptionType[0] == eCSR_ENCRYPT_TYPE_NONE)) ) && |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 10272 | ((eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10273 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 10274 | (eCSR_CFG_DOT11_MODE_11AC == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10275 | #endif |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 10276 | (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode)) ) |
| 10277 | { |
| 10278 | //We cannot do 11n here |
| 10279 | if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10280 | { |
| 10281 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 10282 | } |
| 10283 | else |
| 10284 | { |
| 10285 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10286 | } |
| 10287 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10288 | return( cfgDot11Mode ); |
| 10289 | } |
| 10290 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10291 | eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 10292 | { |
| 10293 | eHalStatus status; |
| 10294 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10295 | |
| 10296 | if(!pSession) |
| 10297 | { |
| 10298 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10299 | return eHAL_STATUS_FAILURE; |
| 10300 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10301 | |
| 10302 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10303 | { |
| 10304 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10305 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 10306 | if(pIbssLog) |
| 10307 | { |
| 10308 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_REQ; |
| 10309 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 10310 | } |
| 10311 | } |
| 10312 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10313 | pSession->ibss_join_pending = FALSE; |
| 10314 | csrRoamStopIbssJoinTimer(pMac, sessionId ); |
| 10315 | // Set the roaming substate to 'stop Bss request'... |
| 10316 | csrRoamSubstateChange( pMac, NewSubstate, sessionId ); |
| 10317 | |
| 10318 | // attempt to stop the Bss (reason code is ignored...) |
| 10319 | status = csrSendMBStopBssReqMsg( pMac, sessionId ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 10320 | if(!HAL_STATUS_SUCCESS(status)) |
| 10321 | { |
| 10322 | smsLog(pMac, LOGW, FL("csrSendMBStopBssReqMsg failed with status %d"), status); |
| 10323 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10324 | return (status); |
| 10325 | } |
| 10326 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10327 | //pNumChan is a caller allocated space with the sizeof pChannels |
| 10328 | eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan) |
| 10329 | { |
| 10330 | |
| 10331 | return (ccmCfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 10332 | (tANI_U8 *)pChannels, |
| 10333 | pNumChan)); |
| 10334 | } |
| 10335 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 10336 | tPowerdBm csrGetCfgMaxTxPower (tpAniSirGlobal pMac, tANI_U8 channel) |
| 10337 | { |
| 10338 | tANI_U32 cfgLength = 0; |
| 10339 | tANI_U16 cfgId = 0; |
| 10340 | tPowerdBm maxTxPwr = 0; |
| 10341 | tANI_U8 *pCountryInfo = NULL; |
| 10342 | eHalStatus status; |
| 10343 | tANI_U8 count = 0; |
| 10344 | tANI_U8 firstChannel; |
| 10345 | tANI_U8 maxChannels; |
| 10346 | |
| 10347 | if (CSR_IS_CHANNEL_5GHZ(channel)) |
| 10348 | { |
| 10349 | cfgId = WNI_CFG_MAX_TX_POWER_5; |
| 10350 | cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN; |
| 10351 | } |
| 10352 | else if (CSR_IS_CHANNEL_24GHZ(channel)) |
| 10353 | { |
| 10354 | cfgId = WNI_CFG_MAX_TX_POWER_2_4; |
| 10355 | cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN; |
| 10356 | } |
| 10357 | else |
| 10358 | return maxTxPwr; |
| 10359 | |
| 10360 | status = palAllocateMemory(pMac->hHdd, (void **)&pCountryInfo, cfgLength); |
| 10361 | if (status != eHAL_STATUS_SUCCESS) |
| 10362 | { |
| 10363 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 10364 | FL("%s: palAllocateMemory() failed, status = %d"), |
| 10365 | __FUNCTION__, status); |
| 10366 | goto error; |
| 10367 | } |
| 10368 | status = ccmCfgGetStr(pMac, cfgId, (tANI_U8 *)pCountryInfo, &cfgLength); |
| 10369 | if (status != eHAL_STATUS_SUCCESS) |
| 10370 | { |
| 10371 | goto error; |
| 10372 | } |
| 10373 | /* Identify the channel and maxtxpower */ |
| 10374 | while (count <= (cfgLength - (sizeof(tSirMacChanInfo)))) |
| 10375 | { |
| 10376 | firstChannel = pCountryInfo[count++]; |
| 10377 | maxChannels = pCountryInfo[count++]; |
| 10378 | maxTxPwr = pCountryInfo[count++]; |
| 10379 | |
| 10380 | if ((channel >= firstChannel) && |
| 10381 | (channel < (firstChannel + maxChannels))) |
| 10382 | { |
| 10383 | break; |
| 10384 | } |
| 10385 | } |
| 10386 | |
| 10387 | error: |
| 10388 | if (NULL != pCountryInfo) |
| 10389 | palFreeMemory(pMac->hHdd, pCountryInfo); |
| 10390 | |
| 10391 | return maxTxPwr; |
| 10392 | } |
| 10393 | |
| 10394 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10395 | tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel ) |
| 10396 | { |
| 10397 | tANI_BOOLEAN fValid = FALSE; |
| 10398 | tANI_U32 idxValidChannels; |
| 10399 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10400 | |
| 10401 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len))) |
| 10402 | { |
| 10403 | for ( idxValidChannels = 0; ( idxValidChannels < len ); idxValidChannels++ ) |
| 10404 | { |
| 10405 | if ( channel == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10406 | { |
| 10407 | fValid = TRUE; |
| 10408 | break; |
| 10409 | } |
| 10410 | } |
| 10411 | } |
| 10412 | pMac->roam.numValidChannels = len; |
| 10413 | return fValid; |
| 10414 | } |
| 10415 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10416 | tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel) |
| 10417 | { |
| 10418 | tANI_BOOLEAN fValid = eANI_BOOLEAN_FALSE; |
| 10419 | tANI_U8 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10420 | for(i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++) |
| 10421 | { |
| 10422 | if(channel == pMac->scan.base40MHzChannels.channelList[i]) |
| 10423 | { |
| 10424 | fValid = eANI_BOOLEAN_TRUE; |
| 10425 | break; |
| 10426 | } |
| 10427 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10428 | return (fValid); |
| 10429 | } |
| 10430 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10431 | //This function check and validate whether the NIC can do CB (40MHz) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10432 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10433 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10434 | ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10435 | tANI_U8 centerChn; |
| 10436 | tANI_U32 ChannelBondingMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10437 | if(CSR_IS_CHANNEL_24GHZ(primaryChn)) |
| 10438 | { |
| 10439 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 10440 | } |
| 10441 | else |
| 10442 | { |
| 10443 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 10444 | } |
| 10445 | //Figure what the other side's CB mode |
| 10446 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 10447 | { |
| 10448 | if(pIes->HTCaps.present && (eHT_CHANNEL_WIDTH_40MHZ == pIes->HTCaps.supportedChannelWidthSet)) |
| 10449 | { |
| 10450 | if(pIes->HTInfo.present) |
| 10451 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10452 | /* This is called during INFRA STA/CLIENT and should use the merged value of |
| 10453 | * supported channel width and recommended tx width as per standard |
| 10454 | */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10455 | smsLog(pMac, LOG1, "scws %u rtws %u sco %u", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10456 | pIes->HTCaps.supportedChannelWidthSet, |
| 10457 | pIes->HTInfo.recommendedTxWidthSet, |
| 10458 | pIes->HTInfo.secondaryChannelOffset); |
| 10459 | |
| 10460 | if (pIes->HTInfo.recommendedTxWidthSet == eHT_CHANNEL_WIDTH_40MHZ) |
| 10461 | eRet = (ePhyChanBondState)pIes->HTInfo.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10462 | else |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10463 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 10464 | switch (eRet) { |
| 10465 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 10466 | centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET; |
| 10467 | break; |
| 10468 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 10469 | centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET; |
| 10470 | break; |
| 10471 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 10472 | default: |
| 10473 | centerChn = primaryChn; |
| 10474 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10475 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10476 | if((PHY_SINGLE_CHANNEL_CENTERED != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10477 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10478 | smsLog(pMac, LOGE, " Invalid center channel (%d), disable 40MHz mode", centerChn); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10479 | //eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10480 | } |
| 10481 | } |
| 10482 | } |
| 10483 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10484 | return eRet; |
| 10485 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10486 | tANI_BOOLEAN csrIsEncryptionInList( tpAniSirGlobal pMac, tCsrEncryptionList *pCipherList, eCsrEncryptionType encryptionType ) |
| 10487 | { |
| 10488 | tANI_BOOLEAN fFound = FALSE; |
| 10489 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10490 | for( idx = 0; idx < pCipherList->numEntries; idx++ ) |
| 10491 | { |
| 10492 | if( pCipherList->encryptionType[idx] == encryptionType ) |
| 10493 | { |
| 10494 | fFound = TRUE; |
| 10495 | break; |
| 10496 | } |
| 10497 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10498 | return fFound; |
| 10499 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10500 | tANI_BOOLEAN csrIsAuthInList( tpAniSirGlobal pMac, tCsrAuthList *pAuthList, eCsrAuthType authType ) |
| 10501 | { |
| 10502 | tANI_BOOLEAN fFound = FALSE; |
| 10503 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10504 | for( idx = 0; idx < pAuthList->numEntries; idx++ ) |
| 10505 | { |
| 10506 | if( pAuthList->authType[idx] == authType ) |
| 10507 | { |
| 10508 | fFound = TRUE; |
| 10509 | break; |
| 10510 | } |
| 10511 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10512 | return fFound; |
| 10513 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10514 | tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2) |
| 10515 | { |
| 10516 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 10517 | tCsrScanResultFilter *pScanFilter = NULL; |
| 10518 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10519 | |
| 10520 | if(pProfile1 && pProfile2) |
| 10521 | { |
| 10522 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 10523 | if(HAL_STATUS_SUCCESS(status)) |
| 10524 | { |
| 10525 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 10526 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile2, pScanFilter); |
| 10527 | if(HAL_STATUS_SUCCESS(status)) |
| 10528 | { |
| 10529 | fCheck = eANI_BOOLEAN_FALSE; |
| 10530 | do |
| 10531 | { |
| 10532 | tANI_U32 i; |
| 10533 | for(i = 0; i < pScanFilter->SSIDs.numOfSSIDs; i++) |
| 10534 | { |
| 10535 | fCheck = csrIsSsidMatch( pMac, pScanFilter->SSIDs.SSIDList[i].SSID.ssId, |
| 10536 | pScanFilter->SSIDs.SSIDList[i].SSID.length, |
| 10537 | pProfile1->SSID.ssId, pProfile1->SSID.length, eANI_BOOLEAN_FALSE ); |
| 10538 | if ( fCheck ) break; |
| 10539 | } |
| 10540 | if(!fCheck) |
| 10541 | { |
| 10542 | break; |
| 10543 | } |
| 10544 | if( !csrIsAuthInList( pMac, &pProfile2->AuthType, pProfile1->AuthType) |
| 10545 | || pProfile2->BSSType != pProfile1->BSSType |
| 10546 | || !csrIsEncryptionInList( pMac, &pProfile2->EncryptionType, pProfile1->EncryptionType ) |
| 10547 | ) |
| 10548 | { |
| 10549 | fCheck = eANI_BOOLEAN_FALSE; |
| 10550 | break; |
| 10551 | } |
| 10552 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10553 | if (pProfile1->MDID.mdiePresent || pProfile2->MDID.mdiePresent) |
| 10554 | { |
| 10555 | if (pProfile1->MDID.mobilityDomain != pProfile2->MDID.mobilityDomain) |
| 10556 | { |
| 10557 | fCheck = eANI_BOOLEAN_FALSE; |
| 10558 | break; |
| 10559 | } |
| 10560 | } |
| 10561 | #endif |
| 10562 | //Match found |
| 10563 | fCheck = eANI_BOOLEAN_TRUE; |
| 10564 | }while(0); |
| 10565 | csrFreeScanFilter(pMac, pScanFilter); |
| 10566 | } |
| 10567 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 10568 | } |
| 10569 | } |
| 10570 | |
| 10571 | return (fCheck); |
| 10572 | } |
| 10573 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10574 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2) |
| 10575 | { |
| 10576 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 10577 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10578 | do |
| 10579 | { |
| 10580 | //Only check for static WEP |
| 10581 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) && |
| 10582 | !csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) |
| 10583 | { |
| 10584 | fCheck = eANI_BOOLEAN_TRUE; |
| 10585 | break; |
| 10586 | } |
| 10587 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, pConnProfile->EncryptionType)) break; |
| 10588 | if(pConnProfile->Keys.defaultIndex != pProfile2->Keys.defaultIndex) break; |
| 10589 | for(i = 0; i < CSR_MAX_NUM_KEY; i++) |
| 10590 | { |
| 10591 | if(pConnProfile->Keys.KeyLength[i] != pProfile2->Keys.KeyLength[i]) break; |
| 10592 | if(!palEqualMemory(pMac->hHdd, &pConnProfile->Keys.KeyMaterial[i], |
| 10593 | &pProfile2->Keys.KeyMaterial[i], pProfile2->Keys.KeyLength[i])) |
| 10594 | { |
| 10595 | break; |
| 10596 | } |
| 10597 | } |
| 10598 | if( i == CSR_MAX_NUM_KEY) |
| 10599 | { |
| 10600 | fCheck = eANI_BOOLEAN_TRUE; |
| 10601 | } |
| 10602 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10603 | return (fCheck); |
| 10604 | } |
| 10605 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10606 | //IBSS |
| 10607 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10608 | tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac ) |
| 10609 | { |
| 10610 | tANI_U8 channel = 0; |
| 10611 | tANI_U32 idx; |
| 10612 | tANI_U32 idxValidChannels; |
| 10613 | tANI_BOOLEAN fFound = FALSE; |
| 10614 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10615 | |
| 10616 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel5G) |
| 10617 | { |
| 10618 | channel = pMac->roam.configParam.AdHocChannel5G; |
| 10619 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 10620 | { |
| 10621 | channel = 0; |
| 10622 | } |
| 10623 | } |
| 10624 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 10625 | { |
| 10626 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_50 ) && !fFound; idx++ ) |
| 10627 | { |
| 10628 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 10629 | { |
| 10630 | if ( csrStartIbssChannels50[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10631 | { |
| 10632 | fFound = TRUE; |
| 10633 | channel = csrStartIbssChannels50[ idx ]; |
| 10634 | } |
| 10635 | } |
| 10636 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10637 | // this is rare, but if it does happen, we find anyone in 11a bandwidth and return the first 11a channel found! |
| 10638 | if (!fFound) |
| 10639 | { |
| 10640 | for ( idxValidChannels = 0; idxValidChannels < len ; idxValidChannels++ ) |
| 10641 | { |
| 10642 | if ( CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ idx ]) ) // the max channel# in 11g is 14 |
| 10643 | { |
| 10644 | channel = csrStartIbssChannels50[ idx ]; |
| 10645 | break; |
| 10646 | } |
| 10647 | } |
| 10648 | } |
| 10649 | }//if |
| 10650 | |
| 10651 | return( channel ); |
| 10652 | } |
| 10653 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10654 | tANI_U8 csrRoamGetIbssStartChannelNumber24( tpAniSirGlobal pMac ) |
| 10655 | { |
| 10656 | tANI_U8 channel = 1; |
| 10657 | tANI_U32 idx; |
| 10658 | tANI_U32 idxValidChannels; |
| 10659 | tANI_BOOLEAN fFound = FALSE; |
| 10660 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10661 | |
| 10662 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel24) |
| 10663 | { |
| 10664 | channel = pMac->roam.configParam.AdHocChannel24; |
| 10665 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 10666 | { |
| 10667 | channel = 0; |
| 10668 | } |
| 10669 | } |
| 10670 | |
| 10671 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 10672 | { |
| 10673 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_24 ) && !fFound; idx++ ) |
| 10674 | { |
| 10675 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 10676 | { |
| 10677 | if ( csrStartIbssChannels24[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10678 | { |
| 10679 | fFound = TRUE; |
| 10680 | channel = csrStartIbssChannels24[ idx ]; |
| 10681 | } |
| 10682 | } |
| 10683 | } |
| 10684 | } |
| 10685 | |
| 10686 | return( channel ); |
| 10687 | } |
| 10688 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10689 | static void csrRoamGetBssStartParms( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 10690 | tCsrRoamStartBssParams *pParam ) |
| 10691 | { |
| 10692 | eCsrCfgDot11Mode cfgDot11Mode; |
| 10693 | eCsrBand eBand; |
| 10694 | tANI_U8 channel = 0; |
| 10695 | tSirNwType nwType; |
| 10696 | tANI_U8 operationChannel = 0; |
| 10697 | |
| 10698 | if(pProfile->ChannelInfo.numOfChannels && pProfile->ChannelInfo.ChannelList) |
| 10699 | { |
| 10700 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 10701 | } |
| 10702 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10703 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10704 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10705 | if( ( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 10706 | (pProfile->csrPersona == VOS_P2P_GO_MODE) ) |
| 10707 | && ( cfgDot11Mode == eCSR_CFG_DOT11_MODE_11B) |
| 10708 | ) |
| 10709 | { |
| 10710 | /* This should never happen */ |
| 10711 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10712 | FL("For P2PClient/P2P-GO (persona %d) cfgDot11Mode is 11B"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10713 | pProfile->csrPersona); |
| 10714 | VOS_ASSERT(0); |
| 10715 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10716 | switch( cfgDot11Mode ) |
| 10717 | { |
| 10718 | case eCSR_CFG_DOT11_MODE_11G: |
| 10719 | nwType = eSIR_11G_NW_TYPE; |
| 10720 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10721 | case eCSR_CFG_DOT11_MODE_11B: |
| 10722 | nwType = eSIR_11B_NW_TYPE; |
| 10723 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10724 | case eCSR_CFG_DOT11_MODE_11A: |
| 10725 | nwType = eSIR_11A_NW_TYPE; |
| 10726 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10727 | default: |
| 10728 | case eCSR_CFG_DOT11_MODE_11N: |
| 10729 | case eCSR_CFG_DOT11_MODE_TAURUS: |
| 10730 | //Because LIM only verifies it against 11a, 11b or 11g, set only 11g or 11a here |
| 10731 | if(eCSR_BAND_24 == eBand) |
| 10732 | { |
| 10733 | nwType = eSIR_11G_NW_TYPE; |
| 10734 | } |
| 10735 | else |
| 10736 | { |
| 10737 | nwType = eSIR_11A_NW_TYPE; |
| 10738 | } |
| 10739 | break; |
| 10740 | } |
| 10741 | |
| 10742 | pParam->extendedRateSet.numRates = 0; |
| 10743 | |
| 10744 | switch ( nwType ) |
| 10745 | { |
| 10746 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10747 | smsLog(pMac, LOGE, FL("sees an unknown pSirNwType (%d)"), nwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10748 | case eSIR_11A_NW_TYPE: |
| 10749 | |
| 10750 | pParam->operationalRateSet.numRates = 8; |
| 10751 | |
| 10752 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 10753 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10754 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 10755 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10756 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 10757 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10758 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10759 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10760 | |
| 10761 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10762 | { |
| 10763 | channel = csrRoamGetIbssStartChannelNumber50( pMac ); |
| 10764 | if( 0 == channel && |
| 10765 | CSR_IS_PHY_MODE_DUAL_BAND(pProfile->phyMode) && |
| 10766 | CSR_IS_PHY_MODE_DUAL_BAND(pMac->roam.configParam.phyMode) |
| 10767 | ) |
| 10768 | { |
| 10769 | //We could not find a 5G channel by auto pick, let's try 2.4G channels |
| 10770 | //We only do this here because csrRoamGetPhyModeBandForBss always picks 11a for AUTO |
| 10771 | nwType = eSIR_11B_NW_TYPE; |
| 10772 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10773 | pParam->operationalRateSet.numRates = 4; |
| 10774 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10775 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10776 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10777 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 10778 | } |
| 10779 | } |
| 10780 | else |
| 10781 | { |
| 10782 | channel = operationChannel; |
| 10783 | } |
| 10784 | break; |
| 10785 | |
| 10786 | case eSIR_11B_NW_TYPE: |
| 10787 | pParam->operationalRateSet.numRates = 4; |
| 10788 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10789 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10790 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10791 | 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] | 10792 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10793 | { |
| 10794 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10795 | } |
| 10796 | else |
| 10797 | { |
| 10798 | channel = operationChannel; |
| 10799 | } |
| 10800 | |
| 10801 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10802 | case eSIR_11G_NW_TYPE: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10803 | /* For P2P Client and P2P GO, disable 11b rates */ |
| 10804 | if( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 10805 | (pProfile->csrPersona == VOS_P2P_GO_MODE) |
| 10806 | ) |
| 10807 | { |
| 10808 | pParam->operationalRateSet.numRates = 8; |
| 10809 | |
| 10810 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 10811 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10812 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 10813 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10814 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 10815 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10816 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10817 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10818 | } |
| 10819 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10820 | { |
| 10821 | pParam->operationalRateSet.numRates = 4; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10822 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10823 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10824 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10825 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 10826 | |
| 10827 | pParam->extendedRateSet.numRates = 8; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10828 | pParam->extendedRateSet.rate[0] = SIR_MAC_RATE_6; |
| 10829 | pParam->extendedRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10830 | pParam->extendedRateSet.rate[2] = SIR_MAC_RATE_12; |
| 10831 | pParam->extendedRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10832 | pParam->extendedRateSet.rate[4] = SIR_MAC_RATE_24; |
| 10833 | pParam->extendedRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10834 | pParam->extendedRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10835 | pParam->extendedRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10836 | } |
| 10837 | |
| 10838 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10839 | { |
| 10840 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10841 | } |
| 10842 | else |
| 10843 | { |
| 10844 | channel = operationChannel; |
| 10845 | } |
| 10846 | |
| 10847 | break; |
| 10848 | } |
| 10849 | pParam->operationChn = channel; |
| 10850 | pParam->sirNwType = nwType; |
| 10851 | } |
| 10852 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10853 | static void csrRoamGetBssStartParmsFromBssDesc( tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, |
| 10854 | tDot11fBeaconIEs *pIes, tCsrRoamStartBssParams *pParam ) |
| 10855 | { |
| 10856 | |
| 10857 | if( pParam ) |
| 10858 | { |
| 10859 | pParam->sirNwType = pBssDesc->nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10860 | pParam->cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10861 | pParam->operationChn = pBssDesc->channelId; |
| 10862 | palCopyMemory( pMac->hHdd, &pParam->bssid, pBssDesc->bssId, sizeof(tCsrBssid) ); |
| 10863 | |
| 10864 | if( pIes ) |
| 10865 | { |
| 10866 | if(pIes->SuppRates.present) |
| 10867 | { |
| 10868 | pParam->operationalRateSet.numRates = pIes->SuppRates.num_rates; |
| 10869 | if(pIes->SuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) |
| 10870 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10871 | smsLog(pMac, LOGE, FL("num_rates :%d is more than SIR_MAC_RATESET_EID_MAX, resetting to SIR_MAC_RATESET_EID_MAX"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10872 | pIes->SuppRates.num_rates); |
| 10873 | pIes->SuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
| 10874 | } |
| 10875 | palCopyMemory(pMac->hHdd, pParam->operationalRateSet.rate, pIes->SuppRates.rates, |
| 10876 | sizeof(*pIes->SuppRates.rates) * pIes->SuppRates.num_rates); |
| 10877 | } |
| 10878 | if( pIes->SSID.present ) |
| 10879 | { |
| 10880 | pParam->ssId.length = pIes->SSID.num_ssid; |
| 10881 | palCopyMemory(pMac->hHdd, pParam->ssId.ssId, pIes->SSID.ssid, pParam->ssId.length); |
| 10882 | } |
| 10883 | pParam->cbMode = csrGetCBModeFromIes(pMac, pParam->operationChn, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10884 | } |
| 10885 | else |
| 10886 | { |
| 10887 | pParam->ssId.length = 0; |
| 10888 | pParam->operationalRateSet.numRates = 0; |
| 10889 | } |
| 10890 | } |
| 10891 | } |
| 10892 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10893 | static void csrRoamDetermineMaxRateForAdHoc( tpAniSirGlobal pMac, tSirMacRateSet *pSirRateSet ) |
| 10894 | { |
| 10895 | tANI_U8 MaxRate = 0; |
| 10896 | tANI_U32 i; |
| 10897 | tANI_U8 *pRate; |
| 10898 | |
| 10899 | pRate = pSirRateSet->rate; |
| 10900 | for ( i = 0; i < pSirRateSet->numRates; i++ ) |
| 10901 | { |
| 10902 | MaxRate = CSR_MAX( MaxRate, ( pRate[ i ] & (~CSR_DOT11_BASIC_RATE_MASK) ) ); |
| 10903 | } |
| 10904 | |
| 10905 | // Save the max rate in the connected state information... |
| 10906 | |
| 10907 | // modify LastRates variable as well |
| 10908 | |
| 10909 | return; |
| 10910 | } |
| 10911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10912 | eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, |
| 10913 | tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId ) |
| 10914 | { |
| 10915 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10916 | eCsrBand eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10917 | // Set the roaming substate to 'Start BSS attempt'... |
| 10918 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10919 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10920 | //Need to figure out whether we need to log WDS??? |
| 10921 | if( CSR_IS_IBSS( pProfile ) ) |
| 10922 | { |
| 10923 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10924 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 10925 | if(pIbssLog) |
| 10926 | { |
| 10927 | if(pBssDesc) |
| 10928 | { |
| 10929 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_REQ; |
| 10930 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pBssDesc->bssId, 6); |
| 10931 | } |
| 10932 | else |
| 10933 | { |
| 10934 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_REQ; |
| 10935 | } |
| 10936 | palCopyMemory(pMac->hHdd, pIbssLog->ssid, pParam->ssId.ssId, |
| 10937 | pParam->ssId.length); |
| 10938 | if(pProfile->ChannelInfo.numOfChannels == 0) |
| 10939 | { |
| 10940 | pIbssLog->channelSetting = AUTO_PICK; |
| 10941 | } |
| 10942 | else |
| 10943 | { |
| 10944 | pIbssLog->channelSetting = SPECIFIED; |
| 10945 | } |
| 10946 | pIbssLog->operatingChannel = pParam->operationChn; |
| 10947 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 10948 | } |
| 10949 | } |
| 10950 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10951 | //Put RSN information in for Starting BSS |
| 10952 | pParam->nRSNIELength = (tANI_U16)pProfile->nRSNReqIELength; |
| 10953 | pParam->pRSNIE = pProfile->pRSNReqIE; |
| 10954 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10955 | pParam->privacy = pProfile->privacy; |
| 10956 | pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq; |
| 10957 | pParam->authType = pProfile->csr80211AuthType; |
| 10958 | pParam->beaconInterval = pProfile->beaconInterval; |
| 10959 | pParam->dtimPeriod = pProfile->dtimPeriod; |
| 10960 | pParam->ApUapsdEnable = pProfile->ApUapsdEnable; |
| 10961 | pParam->ssidHidden = pProfile->SSIDs.SSIDList[0].ssidHidden; |
| 10962 | if (CSR_IS_INFRA_AP(pProfile)&& (pParam->operationChn != 0)) |
| 10963 | { |
| 10964 | if (csrIsValidChannel(pMac, pParam->operationChn) != eHAL_STATUS_SUCCESS) |
| 10965 | { |
| 10966 | pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL; |
| 10967 | } |
| 10968 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10969 | pParam->protEnabled = pProfile->protEnabled; |
| 10970 | pParam->obssProtEnabled = pProfile->obssProtEnabled; |
| 10971 | pParam->ht_protection = pProfile->cfg_protection; |
| 10972 | pParam->wps_state = pProfile->wps_state; |
Jeff Johnson | 96fbeeb | 2013-02-26 21:23:00 -0800 | [diff] [blame] | 10973 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10974 | pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, pParam->operationChn /* pProfile->operationChannel*/, |
| 10975 | &eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10976 | pParam->bssPersona = pProfile->csrPersona; |
| 10977 | // When starting an IBSS, start on the channel from the Profile. |
| 10978 | status = csrSendMBStartBssReqMsg( pMac, sessionId, pProfile->BSSType, pParam, pBssDesc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10979 | return (status); |
| 10980 | } |
| 10981 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10982 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10983 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10984 | { |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 10985 | tANI_U8 Channel; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10986 | ePhyChanBondState cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10987 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10988 | |
| 10989 | if(!pSession) |
| 10990 | { |
| 10991 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10992 | return; |
| 10993 | } |
| 10994 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10995 | if( pBssDesc ) |
| 10996 | { |
| 10997 | csrRoamGetBssStartParmsFromBssDesc( pMac, pBssDesc, pIes, &pSession->bssParams ); |
| 10998 | //Since csrRoamGetBssStartParmsFromBssDesc fills in the bssid for pSession->bssParams |
| 10999 | //The following code has to be do after that. |
| 11000 | //For WDS station, use selfMac as the self BSSID |
| 11001 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 11002 | { |
| 11003 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid)); |
| 11004 | } |
| 11005 | } |
| 11006 | else |
| 11007 | { |
| 11008 | csrRoamGetBssStartParms(pMac, pProfile, &pSession->bssParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11009 | //Use the first SSID |
| 11010 | if(pProfile->SSIDs.numOfSSIDs) |
| 11011 | { |
| 11012 | palCopyMemory(pMac->hHdd, &pSession->bssParams.ssId, pProfile->SSIDs.SSIDList, sizeof(tSirMacSSid)); |
| 11013 | } |
| 11014 | //For WDS station, use selfMac as the self BSSID |
| 11015 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 11016 | { |
| 11017 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid)); |
| 11018 | } |
| 11019 | //Use the first BSSID |
| 11020 | else if( pProfile->BSSIDs.numOfBSSIDs ) |
| 11021 | { |
| 11022 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 11023 | } |
| 11024 | else |
| 11025 | { |
| 11026 | palZeroMemory( pMac->hHdd, &pSession->bssParams.bssid, sizeof(tCsrBssid) ); |
| 11027 | } |
| 11028 | } |
| 11029 | Channel = pSession->bssParams.operationChn; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11030 | //Set operating channel in pProfile which will be used |
| 11031 | //in csrRoamSetBssConfigCfg() to determine channel bonding |
| 11032 | //mode and will be configured in CFG later |
| 11033 | pProfile->operationChannel = Channel; |
| 11034 | |
| 11035 | if(Channel == 0) |
| 11036 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11037 | smsLog(pMac, LOGW, " CSR cannot find a channel to start IBSS"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11038 | } |
| 11039 | else |
| 11040 | { |
| 11041 | |
| 11042 | csrRoamDetermineMaxRateForAdHoc( pMac, &pSession->bssParams.operationalRateSet ); |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11043 | if (CSR_IS_INFRA_AP(pProfile) || CSR_IS_START_IBSS( pProfile ) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11044 | { |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11045 | if(CSR_IS_CHANNEL_24GHZ(Channel) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11046 | { |
| 11047 | cbMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 11048 | } |
| 11049 | else |
| 11050 | { |
| 11051 | cbMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 11052 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11053 | smsLog(pMac, LOG1, "## cbMode %d", cbMode); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11054 | pBssConfig->cbMode = cbMode; |
| 11055 | pSession->bssParams.cbMode = cbMode; |
| 11056 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11057 | } |
| 11058 | } |
| 11059 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11060 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 11061 | tANI_BOOLEAN *pfSameIbss ) |
| 11062 | { |
| 11063 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11064 | tANI_BOOLEAN fSameIbss = FALSE; |
| 11065 | |
| 11066 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 11067 | { |
| 11068 | // Check if any profile parameter has changed ? If any profile parameter |
| 11069 | // has changed then stop old BSS and start a new one with new parameters |
| 11070 | if ( csrIsSameProfile( pMac, &pMac->roam.roamSession[sessionId].connectedProfile, pProfile ) ) |
| 11071 | { |
| 11072 | fSameIbss = TRUE; |
| 11073 | } |
| 11074 | else |
| 11075 | { |
| 11076 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 11077 | } |
| 11078 | } |
| 11079 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 11080 | { |
| 11081 | // Disassociate from the connected Infrastructure network... |
| 11082 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 11083 | } |
| 11084 | else |
| 11085 | { |
| 11086 | tBssConfigParam *pBssConfig; |
| 11087 | |
| 11088 | status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); |
| 11089 | if(HAL_STATUS_SUCCESS(status)) |
| 11090 | { |
| 11091 | palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam)); |
| 11092 | // there is no Bss description before we start an IBSS so we need to adopt |
| 11093 | // all Bss configuration parameters from the Profile. |
| 11094 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, pBssConfig, NULL); |
| 11095 | if(HAL_STATUS_SUCCESS(status)) |
| 11096 | { |
| 11097 | //save dotMode |
| 11098 | pMac->roam.roamSession[sessionId].bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
| 11099 | //Prepare some more parameters for this IBSS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11100 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11101 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
| 11102 | } |
| 11103 | |
| 11104 | palFreeMemory(pMac->hHdd, pBssConfig); |
| 11105 | }//Allocate memory |
| 11106 | } |
| 11107 | |
| 11108 | if(pfSameIbss) |
| 11109 | { |
| 11110 | *pfSameIbss = fSameIbss; |
| 11111 | } |
| 11112 | return( status ); |
| 11113 | } |
| 11114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11115 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11116 | tSirSmeNewBssInfo *pNewBss ) |
| 11117 | { |
| 11118 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11119 | |
| 11120 | if(!pSession) |
| 11121 | { |
| 11122 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11123 | return; |
| 11124 | } |
| 11125 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11126 | if( pNewBss ) |
| 11127 | { |
| 11128 | // Set the operating channel. |
| 11129 | pSession->connectedProfile.operationChannel = pNewBss->channelNumber; |
| 11130 | // move the BSSId from the BSS description into the connected state information. |
| 11131 | palCopyMemory( pMac->hHdd, &pSession->connectedProfile.bssid, |
| 11132 | &(pNewBss->bssId), sizeof( tCsrBssid ) ); |
| 11133 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11134 | return; |
| 11135 | } |
| 11136 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11137 | #ifdef FEATURE_WLAN_WAPI |
| 11138 | eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, |
| 11139 | tANI_U32 numItems ) |
| 11140 | { |
| 11141 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11142 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11143 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11144 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11145 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11146 | return status; |
| 11147 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11148 | smsLog(pMac, LOGW, "csrRoamSetBKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11149 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11150 | if(numItems <= CSR_MAX_BKID_ALLOWED) |
| 11151 | { |
| 11152 | status = eHAL_STATUS_SUCCESS; |
| 11153 | //numItems may be 0 to clear the cache |
| 11154 | pSession->NumBkidCache = (tANI_U16)numItems; |
| 11155 | if(numItems && pBKIDCache) |
| 11156 | { |
| 11157 | status = palCopyMemory( pMac->hHdd, pSession->BkidCacheInfo, pBKIDCache, |
| 11158 | sizeof(tBkidCacheInfo) * numItems ); |
| 11159 | } |
| 11160 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11161 | return (status); |
| 11162 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11163 | eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, |
| 11164 | tBkidCacheInfo *pBkidCache) |
| 11165 | { |
| 11166 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11167 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11168 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11169 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11170 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11171 | return status; |
| 11172 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11173 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11174 | if(pNum && pBkidCache) |
| 11175 | { |
| 11176 | if(pSession->NumBkidCache == 0) |
| 11177 | { |
| 11178 | *pNum = 0; |
| 11179 | status = eHAL_STATUS_SUCCESS; |
| 11180 | } |
| 11181 | else if(*pNum >= pSession->NumBkidCache) |
| 11182 | { |
| 11183 | if(pSession->NumBkidCache > CSR_MAX_PMKID_ALLOWED) |
| 11184 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11185 | smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11186 | pSession->NumBkidCache); |
| 11187 | pSession->NumBkidCache = CSR_MAX_PMKID_ALLOWED; |
| 11188 | } |
| 11189 | palCopyMemory( pMac->hHdd, pBkidCache, pSession->BkidCacheInfo, |
| 11190 | sizeof(tBkidCacheInfo) * pSession->NumBkidCache ); |
| 11191 | *pNum = pSession->NumBkidCache; |
| 11192 | status = eHAL_STATUS_SUCCESS; |
| 11193 | } |
| 11194 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11195 | return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11196 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11197 | tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11198 | { |
| 11199 | return (pMac->roam.roamSession[sessionId].NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11200 | } |
| 11201 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11202 | eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11203 | tPmkidCacheInfo *pPMKIDCache, tANI_U32 numItems ) |
| 11204 | { |
| 11205 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11206 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11207 | |
| 11208 | if(!pSession) |
| 11209 | { |
| 11210 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11211 | return eHAL_STATUS_FAILURE; |
| 11212 | } |
| 11213 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11214 | smsLog(pMac, LOGW, "csrRoamSetPMKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11215 | if(numItems <= CSR_MAX_PMKID_ALLOWED) |
| 11216 | { |
| 11217 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11218 | { |
| 11219 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
| 11220 | palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 11221 | secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_UPDATE; |
| 11222 | secEvent.encryptionModeMulticast = |
| 11223 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 11224 | secEvent.encryptionModeUnicast = |
| 11225 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 11226 | palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 11227 | secEvent.authMode = |
| 11228 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 11229 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 11230 | } |
| 11231 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11232 | status = eHAL_STATUS_SUCCESS; |
| 11233 | //numItems may be 0 to clear the cache |
| 11234 | pSession->NumPmkidCache = (tANI_U16)numItems; |
| 11235 | if(numItems && pPMKIDCache) |
| 11236 | { |
| 11237 | status = palCopyMemory( pMac->hHdd, pSession->PmkidCacheInfo, pPMKIDCache, |
| 11238 | sizeof(tPmkidCacheInfo) * numItems ); |
| 11239 | } |
| 11240 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11241 | return (status); |
| 11242 | } |
| 11243 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11244 | tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11245 | { |
| 11246 | return (pMac->roam.roamSession[sessionId].NumPmkidCache); |
| 11247 | } |
| 11248 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11249 | eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache) |
| 11250 | { |
| 11251 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11252 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11253 | |
| 11254 | if(!pSession) |
| 11255 | { |
| 11256 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11257 | return eHAL_STATUS_FAILURE; |
| 11258 | } |
| 11259 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11260 | if(pNum && pPmkidCache) |
| 11261 | { |
| 11262 | if(pSession->NumPmkidCache == 0) |
| 11263 | { |
| 11264 | *pNum = 0; |
| 11265 | status = eHAL_STATUS_SUCCESS; |
| 11266 | } |
| 11267 | else if(*pNum >= pSession->NumPmkidCache) |
| 11268 | { |
| 11269 | if(pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED) |
| 11270 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11271 | smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11272 | pSession->NumPmkidCache); |
| 11273 | pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED; |
| 11274 | } |
| 11275 | palCopyMemory( pMac->hHdd, pPmkidCache, pSession->PmkidCacheInfo, |
| 11276 | sizeof(tPmkidCacheInfo) * pSession->NumPmkidCache ); |
| 11277 | *pNum = pSession->NumPmkidCache; |
| 11278 | status = eHAL_STATUS_SUCCESS; |
| 11279 | } |
| 11280 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11281 | return (status); |
| 11282 | } |
| 11283 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11284 | eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11285 | { |
| 11286 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11287 | tANI_U32 len; |
| 11288 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11289 | |
| 11290 | if(!pSession) |
| 11291 | { |
| 11292 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11293 | return eHAL_STATUS_FAILURE; |
| 11294 | } |
| 11295 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11296 | if(pLen) |
| 11297 | { |
| 11298 | len = *pLen; |
| 11299 | *pLen = pSession->nWpaRsnReqIeLength; |
| 11300 | if(pBuf) |
| 11301 | { |
| 11302 | if(len >= pSession->nWpaRsnReqIeLength) |
| 11303 | { |
| 11304 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnReqIE, pSession->nWpaRsnReqIeLength); |
| 11305 | } |
| 11306 | } |
| 11307 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11308 | return (status); |
| 11309 | } |
| 11310 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11311 | eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11312 | { |
| 11313 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11314 | tANI_U32 len; |
| 11315 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11316 | |
| 11317 | if(!pSession) |
| 11318 | { |
| 11319 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11320 | return eHAL_STATUS_FAILURE; |
| 11321 | } |
| 11322 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11323 | if(pLen) |
| 11324 | { |
| 11325 | len = *pLen; |
| 11326 | *pLen = pSession->nWpaRsnRspIeLength; |
| 11327 | if(pBuf) |
| 11328 | { |
| 11329 | if(len >= pSession->nWpaRsnRspIeLength) |
| 11330 | { |
| 11331 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnRspIE, pSession->nWpaRsnRspIeLength); |
| 11332 | } |
| 11333 | } |
| 11334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11335 | return (status); |
| 11336 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11337 | #ifdef FEATURE_WLAN_WAPI |
| 11338 | eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11339 | { |
| 11340 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11341 | tANI_U32 len; |
| 11342 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11343 | |
| 11344 | if(!pSession) |
| 11345 | { |
| 11346 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11347 | return eHAL_STATUS_FAILURE; |
| 11348 | } |
| 11349 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11350 | if(pLen) |
| 11351 | { |
| 11352 | len = *pLen; |
| 11353 | *pLen = pSession->nWapiReqIeLength; |
| 11354 | if(pBuf) |
| 11355 | { |
| 11356 | if(len >= pSession->nWapiReqIeLength) |
| 11357 | { |
| 11358 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiReqIE, pSession->nWapiReqIeLength); |
| 11359 | } |
| 11360 | } |
| 11361 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11362 | return (status); |
| 11363 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11364 | eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11365 | { |
| 11366 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11367 | tANI_U32 len; |
| 11368 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11369 | |
| 11370 | if(!pSession) |
| 11371 | { |
| 11372 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11373 | return eHAL_STATUS_FAILURE; |
| 11374 | } |
| 11375 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11376 | if(pLen) |
| 11377 | { |
| 11378 | len = *pLen; |
| 11379 | *pLen = pSession->nWapiRspIeLength; |
| 11380 | if(pBuf) |
| 11381 | { |
| 11382 | if(len >= pSession->nWapiRspIeLength) |
| 11383 | { |
| 11384 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiRspIE, pSession->nWapiRspIeLength); |
| 11385 | } |
| 11386 | } |
| 11387 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11388 | return (status); |
| 11389 | } |
| 11390 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11391 | eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11392 | { |
| 11393 | eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION; |
| 11394 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11395 | |
| 11396 | if(!pSession) |
| 11397 | { |
| 11398 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11399 | return (retStatus); |
| 11400 | } |
| 11401 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11402 | if(CSR_IS_ROAMING(pSession)) |
| 11403 | { |
| 11404 | retStatus = eCSR_ROAM_ROAMING_COMPLETION; |
| 11405 | pSession->fRoaming = eANI_BOOLEAN_FALSE; |
| 11406 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11407 | return (retStatus); |
| 11408 | } |
| 11409 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11410 | //This function remove the connected BSS from te cached scan result |
| 11411 | eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac, |
| 11412 | tCsrRoamConnectedProfile *pConnProfile) |
| 11413 | { |
| 11414 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 11415 | tCsrScanResultFilter *pScanFilter = NULL; |
| 11416 | tListElem *pEntry; |
| 11417 | tCsrScanResult *pResult; |
| 11418 | tDot11fBeaconIEs *pIes; |
| 11419 | tANI_BOOLEAN fMatch; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11420 | if(!(csrIsMacAddressZero(pMac, &pConnProfile->bssid) || |
| 11421 | csrIsMacAddressBroadcast(pMac, &pConnProfile->bssid))) |
| 11422 | { |
| 11423 | do |
| 11424 | { |
| 11425 | //Prepare the filter. Only fill in the necessary fields. Not all fields are needed |
| 11426 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 11427 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11428 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 11429 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 11430 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11431 | palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, &pConnProfile->bssid, sizeof(tCsrBssid)); |
| 11432 | pScanFilter->BSSIDs.numOfBSSIDs = 1; |
| 11433 | if(!csrIsNULLSSID(pConnProfile->SSID.ssId, pConnProfile->SSID.length)) |
| 11434 | { |
| 11435 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, sizeof(tCsrSSIDInfo)); |
| 11436 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11437 | palCopyMemory(pMac->hHdd, &pScanFilter->SSIDs.SSIDList[0].SSID, &pConnProfile->SSID, sizeof(tSirMacSSid)); |
| 11438 | } |
| 11439 | pScanFilter->authType.numEntries = 1; |
| 11440 | pScanFilter->authType.authType[0] = pConnProfile->AuthType; |
| 11441 | pScanFilter->BSSType = pConnProfile->BSSType; |
| 11442 | pScanFilter->EncryptionType.numEntries = 1; |
| 11443 | pScanFilter->EncryptionType.encryptionType[0] = pConnProfile->EncryptionType; |
| 11444 | pScanFilter->mcEncryptionType.numEntries = 1; |
| 11445 | pScanFilter->mcEncryptionType.encryptionType[0] = pConnProfile->mcEncryptionType; |
| 11446 | //We ignore the channel for now, BSSID should be enough |
| 11447 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 11448 | //Also ignore the following fields |
| 11449 | pScanFilter->uapsd_mask = 0; |
| 11450 | pScanFilter->bWPSAssociation = eANI_BOOLEAN_FALSE; |
| 11451 | pScanFilter->countryCode[0] = 0; |
| 11452 | pScanFilter->phyMode = eCSR_DOT11_MODE_TAURUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11453 | csrLLLock(&pMac->scan.scanResultList); |
| 11454 | pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK ); |
| 11455 | while( pEntry ) |
| 11456 | { |
| 11457 | pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link ); |
| 11458 | pIes = (tDot11fBeaconIEs *)( pResult->Result.pvIes ); |
| 11459 | fMatch = csrMatchBSS(pMac, &pResult->Result.BssDescriptor, |
| 11460 | pScanFilter, NULL, NULL, NULL, &pIes); |
| 11461 | //Release the IEs allocated by csrMatchBSS is needed |
| 11462 | if( !pResult->Result.pvIes ) |
| 11463 | { |
| 11464 | //need to free the IEs since it is allocated by csrMatchBSS |
| 11465 | palFreeMemory(pMac->hHdd, pIes); |
| 11466 | } |
| 11467 | if(fMatch) |
| 11468 | { |
| 11469 | //We found the one |
| 11470 | if( csrLLRemoveEntry(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK) ) |
| 11471 | { |
| 11472 | //Free the memory |
| 11473 | csrFreeScanResultEntry( pMac, pResult ); |
| 11474 | } |
| 11475 | break; |
| 11476 | } |
| 11477 | pEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK); |
| 11478 | }//while |
| 11479 | csrLLUnlock(&pMac->scan.scanResultList); |
| 11480 | }while(0); |
| 11481 | if(pScanFilter) |
| 11482 | { |
| 11483 | csrFreeScanFilter(pMac, pScanFilter); |
| 11484 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 11485 | } |
| 11486 | } |
| 11487 | return (status); |
| 11488 | } |
| 11489 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11490 | //BT-AMP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11491 | eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId ) |
| 11492 | { |
| 11493 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11494 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11495 | for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 11496 | { |
| 11497 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 11498 | { |
| 11499 | if( csrIsConnStateIbss( pMac, sessionId ) || csrIsBTAMP( pMac, sessionId ) ) |
| 11500 | { |
| 11501 | //co-exist with IBSS or BT-AMP is not supported |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11502 | smsLog( pMac, LOGW, " BTAMP is not allowed due to IBSS/BT-AMP exist in session %d", sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11503 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 11504 | break; |
| 11505 | } |
| 11506 | if( csrIsConnStateInfra( pMac, sessionId ) ) |
| 11507 | { |
| 11508 | if( chnId && |
| 11509 | ( (tANI_U8)chnId != pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ) ) |
| 11510 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11511 | smsLog( pMac, LOGW, " BTAMP is not allowed due to channel (%d) diff than infr channel (%d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11512 | chnId, pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ); |
| 11513 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 11514 | break; |
| 11515 | } |
| 11516 | } |
| 11517 | } |
| 11518 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11519 | return ( status ); |
| 11520 | } |
| 11521 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11522 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ) |
| 11523 | { |
| 11524 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11525 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11526 | tBssConfigParam bssConfig; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11527 | |
| 11528 | if(!pSession) |
| 11529 | { |
| 11530 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11531 | return eHAL_STATUS_FAILURE; |
| 11532 | } |
| 11533 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11534 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 11535 | { |
| 11536 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 11537 | } |
| 11538 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 11539 | { |
| 11540 | // Disassociate from the connected Infrastructure network... |
| 11541 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 11542 | } |
| 11543 | else |
| 11544 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11545 | //We don't expect Bt-AMP HDD not to disconnect the last connection first at this time. |
| 11546 | //Otherwise we need to add code to handle the |
| 11547 | //situation just like IBSS. Though for WDS station, we need to send disassoc to PE first then |
| 11548 | //send stop_bss to PE, before we can continue. |
| 11549 | VOS_ASSERT( !csrIsConnStateWds( pMac, sessionId ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11550 | palZeroMemory(pMac->hHdd, &bssConfig, sizeof(tBssConfigParam)); |
| 11551 | /* Assume HDD provide bssid in profile */ |
| 11552 | palCopyMemory( pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid[0], sizeof(tCsrBssid) ); |
| 11553 | // there is no Bss description before we start an WDS so we need |
| 11554 | // to adopt all Bss configuration parameters from the Profile. |
| 11555 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, &bssConfig, pBssDesc); |
| 11556 | if(HAL_STATUS_SUCCESS(status)) |
| 11557 | { |
| 11558 | //Save profile for late use |
| 11559 | csrFreeRoamProfile( pMac, sessionId ); |
| 11560 | if (HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 11561 | (void **)&pSession->pCurRoamProfile, |
| 11562 | sizeof(tCsrRoamProfile)))) |
| 11563 | { |
| 11564 | palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 11565 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile); |
| 11566 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11567 | //Prepare some more parameters for this WDS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11568 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11569 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
| 11570 | } |
| 11571 | } |
| 11572 | |
| 11573 | return( status ); |
| 11574 | } |
| 11575 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11576 | ////////////////////Mail box |
| 11577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11578 | //pBuf is caller allocated memory point to &(tSirSmeJoinReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 11579 | //or &(tSirSmeReassocReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 11580 | static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, |
| 11581 | tSirBssDescription *pBssDescription, |
| 11582 | tANI_U8 *pBuf, tANI_U8 uapsdMask) |
| 11583 | { |
| 11584 | tCsrChannelSet channelGroup; |
| 11585 | tSirMacCapabilityInfo *pAP_capabilityInfo; |
| 11586 | tAniBool fTmp; |
| 11587 | tANI_BOOLEAN found = FALSE; |
| 11588 | tANI_U32 size = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11589 | tANI_S8 pwrLimit = 0; |
| 11590 | tANI_U16 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11591 | // plug in neighborhood occupancy info (i.e. BSSes on primary or secondary channels) |
| 11592 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundPri |
| 11593 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecDown |
| 11594 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecUp |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11595 | // 802.11h |
| 11596 | //We can do this because it is in HOST CPU order for now. |
| 11597 | pAP_capabilityInfo = (tSirMacCapabilityInfo *)&pBssDescription->capabilityInfo; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11598 | //tell the target AP my 11H capability only if both AP and STA support 11H and the channel being used is 11a |
| 11599 | if ( csrIs11hSupported( pMac ) && pAP_capabilityInfo->spectrumMgt && eSIR_11A_NW_TYPE == pBssDescription->nwType ) |
| 11600 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11601 | fTmp = (tAniBool)pal_cpu_to_be32(1); |
| 11602 | } |
| 11603 | else |
| 11604 | fTmp = (tAniBool)0; |
| 11605 | |
| 11606 | // corresponds to --- pMsg->spectrumMgtIndicator = ON; |
| 11607 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&fTmp, sizeof(tAniBool) ); |
| 11608 | pBuf += sizeof(tAniBool); |
| 11609 | *pBuf++ = MIN_STA_PWR_CAP_DBM; // it is for pMsg->powerCap.minTxPower = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11610 | found = csrSearchChannelListForTxPower(pMac, pBssDescription, &channelGroup); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11611 | // This is required for 11k test VoWiFi Ent: Test 2. |
| 11612 | // We need the power capabilities for Assoc Req. |
| 11613 | // This macro is provided by the halPhyCfg.h. We pick our |
| 11614 | // max and min capability by the halPhy provided macros |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11615 | pwrLimit = csrGetCfgMaxTxPower (pMac, pBssDescription->channelId); |
| 11616 | if (0 != pwrLimit) |
| 11617 | { |
| 11618 | *pBuf++ = pwrLimit; |
| 11619 | } |
| 11620 | else |
| 11621 | { |
| 11622 | *pBuf++ = MAX_STA_PWR_CAP_DBM; |
| 11623 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11624 | size = sizeof(pMac->roam.validChannelList); |
| 11625 | if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size))) |
| 11626 | { |
| 11627 | *pBuf++ = (tANI_U8)size; //tSirSupChnl->numChnl |
| 11628 | for ( i = 0; i < size; i++) |
| 11629 | { |
| 11630 | *pBuf++ = pMac->roam.validChannelList[ i ]; //tSirSupChnl->channelList[ i ] |
| 11631 | |
| 11632 | } |
| 11633 | } |
| 11634 | else |
| 11635 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11636 | smsLog(pMac, LOGE, FL("can not find any valid channel")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11637 | *pBuf++ = 0; //tSirSupChnl->numChnl |
| 11638 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11639 | //Check whether it is ok to enter UAPSD |
| 11640 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 11641 | if( btcIsReadyForUapsd(pMac) ) |
| 11642 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 11643 | { |
| 11644 | *pBuf++ = uapsdMask; |
| 11645 | } |
| 11646 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 11647 | else |
| 11648 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11649 | smsLog(pMac, LOGE, FL(" BTC doesn't allow UAPSD for uapsd_mask(0x%X)"), uapsdMask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11650 | *pBuf++ = 0; |
| 11651 | } |
| 11652 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 11653 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11654 | // move the entire BssDescription into the join request. |
| 11655 | palCopyMemory( pMac->hHdd, pBuf, pBssDescription, |
| 11656 | pBssDescription->length + sizeof( pBssDescription->length ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11657 | pBuf += pBssDescription->length + sizeof( pBssDescription->length ); // update to new location |
| 11658 | } |
| 11659 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11660 | /* |
| 11661 | * The communication between HDD and LIM is thru mailbox (MB). |
| 11662 | * Both sides will access the data structure "tSirSmeJoinReq". |
| 11663 | * The rule is, while the components of "tSirSmeJoinReq" can be accessed in the regular way like tSirSmeJoinReq.assocType, this guideline |
| 11664 | * stops at component tSirRSNie; any acces to the components after tSirRSNie is forbidden because the space from tSirRSNie is quueezed |
| 11665 | * with the component "tSirBssDescription". And since the size of actual 'tSirBssDescription' varies, the receiving side (which is the routine |
| 11666 | * limJoinReqSerDes() of limSerDesUtils.cc) should keep in mind not to access the components DIRECTLY after tSirRSNie. |
| 11667 | */ |
| 11668 | eHalStatus csrSendJoinReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11669 | tCsrRoamProfile *pProfile, tDot11fBeaconIEs *pIes, tANI_U16 messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11670 | { |
| 11671 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11672 | tSirSmeJoinReq *pMsg; |
| 11673 | tANI_U8 *pBuf; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11674 | v_U8_t acm_mask = 0, uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11675 | tANI_U16 msgLen, wTmp, ieLen; |
| 11676 | tSirMacRateSet OpRateSet; |
| 11677 | tSirMacRateSet ExRateSet; |
| 11678 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11679 | tANI_U32 dwTmp; |
| 11680 | tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN]; //RSN MAX is bigger than WPA MAX |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11681 | |
| 11682 | if(!pSession) |
| 11683 | { |
| 11684 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11685 | return eHAL_STATUS_FAILURE; |
| 11686 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11687 | /* To satisfy klockworks */ |
| 11688 | if (NULL == pBssDescription) |
| 11689 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11690 | smsLog(pMac, LOGE, FL(" pBssDescription is NULL")); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11691 | return eHAL_STATUS_FAILURE; |
| 11692 | } |
| 11693 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11694 | do { |
| 11695 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 11696 | pSession->joinFailStatusCode.reasonCode = 0; |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 11697 | memcpy (&pSession->joinFailStatusCode.bssId, &pBssDescription->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11698 | // There are a number of variable length fields to consider. First, the tSirSmeJoinReq |
| 11699 | // includes a single bssDescription. bssDescription includes a single tANI_U32 for the |
| 11700 | // IE fields, but the length field in the bssDescription needs to be interpreted to |
| 11701 | // determine length of the IE fields. |
| 11702 | // |
| 11703 | // So, take the size of the JoinReq, subtract the size of the bssDescription and |
| 11704 | // add in the length from the bssDescription (then add the size of the 'length' field |
| 11705 | // itself because that is NOT included in the length field). |
| 11706 | msgLen = sizeof( tSirSmeJoinReq ) - sizeof( *pBssDescription ) + |
| 11707 | pBssDescription->length + sizeof( pBssDescription->length ) + |
| 11708 | 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] | 11709 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 11710 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11711 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11712 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)messageType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11713 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 11714 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11715 | // sessionId |
| 11716 | *pBuf = (tANI_U8)sessionId; |
| 11717 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11718 | // transactionId |
| 11719 | *pBuf = 0; |
| 11720 | *( pBuf + 1 ) = 0; |
| 11721 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11722 | // ssId |
| 11723 | if( pIes->SSID.present && pIes->SSID.num_ssid ) |
| 11724 | { |
| 11725 | // ssId len |
| 11726 | *pBuf = pIes->SSID.num_ssid; |
| 11727 | pBuf++; |
| 11728 | palCopyMemory( pMac->hHdd, pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid ); |
| 11729 | pBuf += pIes->SSID.num_ssid; |
| 11730 | } |
| 11731 | else |
| 11732 | { |
| 11733 | *pBuf = 0; |
| 11734 | pBuf++; |
| 11735 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11736 | // selfMacAddr |
| 11737 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 11738 | pBuf += sizeof(tSirMacAddr); |
| 11739 | // bsstype |
| 11740 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) ); |
| 11741 | if (dwTmp == eSIR_BTAMP_STA_MODE) dwTmp = eSIR_BTAMP_AP_MODE; // Override BssType for BTAMP |
| 11742 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 11743 | pBuf += sizeof(tSirBssType); |
| 11744 | // dot11mode |
| 11745 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode ); |
| 11746 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11747 | //Persona |
| 11748 | *pBuf = (tANI_U8)pProfile->csrPersona; |
| 11749 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11750 | //CBMode |
| 11751 | *pBuf = (tANI_U8)pSession->bssParams.cbMode; |
| 11752 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11753 | |
| 11754 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11755 | FL("CSR PERSONA=%d CSR CbMode %d"), pProfile->csrPersona, pSession->bssParams.cbMode); |
| 11756 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11757 | // uapsdPerAcBitmask |
| 11758 | *pBuf = pProfile->uapsd_mask; |
| 11759 | pBuf++; |
| 11760 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11761 | |
| 11762 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11763 | status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11764 | if (HAL_STATUS_SUCCESS(status) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11765 | { |
| 11766 | // OperationalRateSet |
| 11767 | if (OpRateSet.numRates) { |
| 11768 | *pBuf++ = OpRateSet.numRates; |
| 11769 | palCopyMemory(pMac->hHdd, pBuf, OpRateSet.rate, OpRateSet.numRates); |
| 11770 | pBuf += OpRateSet.numRates; |
| 11771 | } else *pBuf++ = 0; |
| 11772 | // ExtendedRateSet |
| 11773 | if (ExRateSet.numRates) { |
| 11774 | *pBuf++ = ExRateSet.numRates; |
| 11775 | palCopyMemory(pMac->hHdd, pBuf, ExRateSet.rate, ExRateSet.numRates); |
| 11776 | pBuf += ExRateSet.numRates; |
| 11777 | } else *pBuf++ = 0; |
| 11778 | } |
| 11779 | else |
| 11780 | { |
| 11781 | *pBuf++ = 0; |
| 11782 | *pBuf++ = 0; |
| 11783 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11784 | // rsnIE |
| 11785 | if ( csrIsProfileWpa( pProfile ) ) |
| 11786 | { |
| 11787 | // Insert the Wpa IE into the join request |
| 11788 | ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes, |
| 11789 | (tCsrWpaIe *)( wpaRsnIE ) ); |
| 11790 | } |
| 11791 | else if( csrIsProfileRSN( pProfile ) ) |
| 11792 | { |
| 11793 | // Insert the RSN IE into the join request |
| 11794 | ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 11795 | (tCsrRSNIe *)( wpaRsnIE ) ); |
| 11796 | } |
| 11797 | #ifdef FEATURE_WLAN_WAPI |
| 11798 | else if( csrIsProfileWapi( pProfile ) ) |
| 11799 | { |
| 11800 | // Insert the WAPI IE into the join request |
| 11801 | ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 11802 | (tCsrWapiIe *)( wpaRsnIE ) ); |
| 11803 | } |
| 11804 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11805 | else |
| 11806 | { |
| 11807 | ieLen = 0; |
| 11808 | } |
| 11809 | //remember the IE for future use |
| 11810 | if( ieLen ) |
| 11811 | { |
| 11812 | if(ieLen > DOT11F_IE_RSN_MAX_LEN) |
| 11813 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11814 | smsLog(pMac, LOGE, FL(" WPA RSN IE length :%d is more than DOT11F_IE_RSN_MAX_LEN, resetting to %d"), ieLen, DOT11F_IE_RSN_MAX_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11815 | ieLen = DOT11F_IE_RSN_MAX_LEN; |
| 11816 | } |
| 11817 | #ifdef FEATURE_WLAN_WAPI |
| 11818 | if( csrIsProfileWapi( pProfile ) ) |
| 11819 | { |
| 11820 | //Check whether we need to allocate more memory |
| 11821 | if(ieLen > pSession->nWapiReqIeLength) |
| 11822 | { |
| 11823 | if(pSession->pWapiReqIE && pSession->nWapiReqIeLength) |
| 11824 | { |
| 11825 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 11826 | } |
| 11827 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiReqIE, ieLen); |
| 11828 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11829 | } |
| 11830 | pSession->nWapiReqIeLength = ieLen; |
| 11831 | palCopyMemory(pMac->hHdd, pSession->pWapiReqIE, wpaRsnIE, ieLen); |
| 11832 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11833 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11834 | pBuf += sizeof(tANI_U16); |
| 11835 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11836 | pBuf += ieLen; |
| 11837 | } |
| 11838 | else//should be WPA/WPA2 otherwise |
| 11839 | #endif /* FEATURE_WLAN_WAPI */ |
| 11840 | { |
| 11841 | //Check whether we need to allocate more memory |
| 11842 | if(ieLen > pSession->nWpaRsnReqIeLength) |
| 11843 | { |
| 11844 | if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength) |
| 11845 | { |
| 11846 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 11847 | } |
| 11848 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnReqIE, ieLen); |
| 11849 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11850 | } |
| 11851 | pSession->nWpaRsnReqIeLength = ieLen; |
| 11852 | palCopyMemory(pMac->hHdd, pSession->pWpaRsnReqIE, wpaRsnIE, ieLen); |
| 11853 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11854 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11855 | pBuf += sizeof(tANI_U16); |
| 11856 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11857 | pBuf += ieLen; |
| 11858 | } |
| 11859 | } |
| 11860 | else |
| 11861 | { |
| 11862 | //free whatever old info |
| 11863 | pSession->nWpaRsnReqIeLength = 0; |
| 11864 | if(pSession->pWpaRsnReqIE) |
| 11865 | { |
| 11866 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 11867 | pSession->pWpaRsnReqIE = NULL; |
| 11868 | } |
| 11869 | #ifdef FEATURE_WLAN_WAPI |
| 11870 | pSession->nWapiReqIeLength = 0; |
| 11871 | if(pSession->pWapiReqIE) |
| 11872 | { |
| 11873 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 11874 | pSession->pWapiReqIE = NULL; |
| 11875 | } |
| 11876 | #endif /* FEATURE_WLAN_WAPI */ |
| 11877 | //length is two bytes |
| 11878 | *pBuf = 0; |
| 11879 | *(pBuf + 1) = 0; |
| 11880 | pBuf += 2; |
| 11881 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11882 | #ifdef FEATURE_WLAN_CCX |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11883 | if( eWNI_SME_JOIN_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11884 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11885 | // Never include the cckmIE in an Join Request |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11886 | //length is two bytes |
| 11887 | *pBuf = 0; |
| 11888 | *(pBuf + 1) = 0; |
| 11889 | pBuf += 2; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11890 | } |
| 11891 | else if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11892 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11893 | // cckmIE |
| 11894 | if( csrIsProfileCCX( pProfile ) ) |
| 11895 | { |
| 11896 | // Insert the CCKM IE into the join request |
| 11897 | ieLen = csrConstructCcxCckmIe( pMac, |
| 11898 | pSession, |
| 11899 | pProfile, |
| 11900 | pBssDescription, |
| 11901 | pSession->pWpaRsnReqIE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11902 | pSession->nWpaRsnReqIeLength, |
| 11903 | (void *)( wpaRsnIE ) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11904 | } |
| 11905 | else |
| 11906 | { |
| 11907 | ieLen = 0; |
| 11908 | } |
| 11909 | //If present, copy the IE into the eWNI_SME_REASSOC_REQ message buffer |
| 11910 | if( ieLen ) |
| 11911 | { |
| 11912 | //Copy the CCKM IE over from the temp buffer (wpaRsnIE) |
| 11913 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11914 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11915 | pBuf += sizeof(tANI_U16); |
| 11916 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11917 | pBuf += ieLen; |
| 11918 | } |
| 11919 | else |
| 11920 | { |
| 11921 | //Indicate you have no CCKM IE |
| 11922 | //length is two bytes |
| 11923 | *pBuf = 0; |
| 11924 | *(pBuf + 1) = 0; |
| 11925 | pBuf += 2; |
| 11926 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11927 | } |
| 11928 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11929 | // addIEScan |
| 11930 | if(pProfile->nAddIEScanLength && pProfile->pAddIEScan) |
| 11931 | { |
| 11932 | ieLen = pProfile->nAddIEScanLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11933 | if(ieLen > pSession->nAddIEScanLength) |
| 11934 | { |
| 11935 | if(pSession->pAddIEScan && pSession->nAddIEScanLength) |
| 11936 | { |
| 11937 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 11938 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11939 | status = palAllocateMemory(pMac->hHdd, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11940 | (void **)&pSession->pAddIEScan, ieLen); |
| 11941 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11942 | } |
| 11943 | pSession->nAddIEScanLength = ieLen; |
| 11944 | palCopyMemory(pMac->hHdd, pSession->pAddIEScan, |
| 11945 | pProfile->pAddIEScan, ieLen); |
| 11946 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11947 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11948 | pBuf += sizeof(tANI_U16); |
| 11949 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEScan, ieLen ); |
| 11950 | pBuf += ieLen; |
| 11951 | } |
| 11952 | else |
| 11953 | { |
| 11954 | pSession->nAddIEScanLength = 0; |
| 11955 | if(pSession->pAddIEScan) |
| 11956 | { |
| 11957 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 11958 | pSession->pAddIEScan = NULL; |
| 11959 | } |
| 11960 | *pBuf = 0; |
| 11961 | *(pBuf + 1) = 0; |
| 11962 | pBuf += 2; |
| 11963 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11964 | // addIEAssoc |
| 11965 | if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc) |
| 11966 | { |
| 11967 | ieLen = pProfile->nAddIEAssocLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11968 | if(ieLen > pSession->nAddIEAssocLength) |
| 11969 | { |
| 11970 | if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength) |
| 11971 | { |
| 11972 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 11973 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11974 | status = palAllocateMemory(pMac->hHdd, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11975 | (void **)&pSession->pAddIEAssoc, ieLen); |
| 11976 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11977 | } |
| 11978 | pSession->nAddIEAssocLength = ieLen; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11979 | palCopyMemory(pMac->hHdd, pSession->pAddIEAssoc, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11980 | pProfile->pAddIEAssoc, ieLen); |
| 11981 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11982 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11983 | pBuf += sizeof(tANI_U16); |
| 11984 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEAssoc, ieLen ); |
| 11985 | pBuf += ieLen; |
| 11986 | } |
| 11987 | else |
| 11988 | { |
| 11989 | pSession->nAddIEAssocLength = 0; |
| 11990 | if(pSession->pAddIEAssoc) |
| 11991 | { |
| 11992 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 11993 | pSession->pAddIEAssoc = NULL; |
| 11994 | } |
| 11995 | *pBuf = 0; |
| 11996 | *(pBuf + 1) = 0; |
| 11997 | pBuf += 2; |
| 11998 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11999 | |
| 12000 | if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12001 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12002 | //Unmask any AC in reassoc that is ACM-set |
| 12003 | uapsd_mask = (v_U8_t)pProfile->uapsd_mask; |
| 12004 | if( uapsd_mask && ( NULL != pBssDescription ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12005 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12006 | if( CSR_IS_QOS_BSS(pIes) && CSR_IS_UAPSD_BSS(pIes) ) |
| 12007 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12008 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12009 | acm_mask = sme_QosGetACMMask(pMac, pBssDescription, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12010 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12011 | uapsd_mask &= ~(acm_mask); |
| 12012 | } |
| 12013 | else |
| 12014 | { |
| 12015 | uapsd_mask = 0; |
| 12016 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12017 | } |
| 12018 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12019 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12020 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) ); |
| 12021 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12022 | pBuf += sizeof(tANI_U32); |
| 12023 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12024 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) ); |
| 12025 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12026 | pBuf += sizeof(tANI_U32); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12027 | #ifdef WLAN_FEATURE_11W |
| 12028 | //MgmtEncryption |
| 12029 | if (pProfile->MFPEnabled) |
| 12030 | { |
| 12031 | dwTmp = pal_cpu_to_be32(eSIR_ED_AES_128_CMAC); |
| 12032 | } |
| 12033 | else |
| 12034 | { |
| 12035 | dwTmp = pal_cpu_to_be32(eSIR_ED_NONE); |
| 12036 | } |
| 12037 | palCopyMemory(pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32)); |
| 12038 | pBuf += sizeof(tANI_U32); |
| 12039 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12040 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12041 | pProfile->MDID.mdiePresent = pBssDescription->mdiePresent; |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 12042 | if (csrIsProfile11r( pProfile ) |
| 12043 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 09dd66b | 2013-04-01 17:13:01 +0530 | [diff] [blame] | 12044 | && !((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) && |
| 12045 | (pIes->CCXVersion.present) && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 12046 | #endif |
| 12047 | ) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12048 | { |
| 12049 | // is11Rconnection; |
| 12050 | dwTmp = pal_cpu_to_be32(TRUE); |
| 12051 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 12052 | pBuf += sizeof(tAniBool); |
| 12053 | } |
| 12054 | else |
| 12055 | { |
| 12056 | // is11Rconnection; |
| 12057 | dwTmp = pal_cpu_to_be32(FALSE); |
| 12058 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 12059 | pBuf += sizeof(tAniBool); |
| 12060 | } |
| 12061 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12062 | #ifdef FEATURE_WLAN_CCX |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12063 | /* A profile can not be both CCX and 11R. But an 802.11R AP |
| 12064 | * may be advertising support for CCX as well. So if we are |
| 12065 | * associating Open or explicitly CCX then we will get CCX. |
| 12066 | * If we are associating explictly 11R only then we will get |
| 12067 | * 11R. |
| 12068 | */ |
| 12069 | if ((csrIsProfileCCX(pProfile) || |
| 12070 | ((pIes->CCXVersion.present) |
| 12071 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12072 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 12073 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 12074 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12075 | #ifdef WLAN_FEATURE_11W |
| 12076 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 12077 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12078 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12079 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
| 12080 | { |
| 12081 | // isCCXconnection; |
| 12082 | dwTmp = pal_cpu_to_be32(TRUE); |
| 12083 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 12084 | pBuf += sizeof(tAniBool); |
| 12085 | } |
| 12086 | else |
| 12087 | { |
| 12088 | //isCCXconnection; |
| 12089 | dwTmp = pal_cpu_to_be32(FALSE); |
| 12090 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 12091 | pBuf += sizeof(tAniBool); |
| 12092 | } |
| 12093 | |
| 12094 | if (eWNI_SME_JOIN_REQ == messageType) |
| 12095 | { |
| 12096 | tCCXTspecInfo ccxTspec; |
| 12097 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 12098 | // so nullify the TSPEC parameters |
| 12099 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 12100 | palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 12101 | pBuf += sizeof(tCCXTspecInfo); |
| 12102 | } |
| 12103 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 12104 | { |
| 12105 | if ((csrIsProfileCCX(pProfile) || |
| 12106 | ((pIes->CCXVersion.present) |
| 12107 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12108 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 12109 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 12110 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12111 | #ifdef WLAN_FEATURE_11W |
| 12112 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 12113 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12114 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12115 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12116 | { |
| 12117 | tCCXTspecInfo ccxTspec; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12118 | // CCX Tspec information |
| 12119 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 12120 | ccxTspec.numTspecs = sme_QosCCxRetrieveTspecInfo(pMac, sessionId, (tTspecInfo *) &ccxTspec.tspec[0]); |
| 12121 | *pBuf = ccxTspec.numTspecs; |
| 12122 | pBuf += sizeof(tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12123 | // Copy the TSPEC information only if present |
| 12124 | if (ccxTspec.numTspecs) { |
| 12125 | palCopyMemory(pMac->hHdd, pBuf, (void*)&ccxTspec.tspec[0], (ccxTspec.numTspecs*sizeof(tTspecInfo))); |
| 12126 | } |
| 12127 | pBuf += sizeof(ccxTspec.tspec); |
| 12128 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12129 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12130 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12131 | tCCXTspecInfo ccxTspec; |
| 12132 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 12133 | // so nullify the TSPEC parameters |
| 12134 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 12135 | palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 12136 | pBuf += sizeof(tCCXTspecInfo); |
| 12137 | } |
| 12138 | } |
| 12139 | #endif // FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12140 | #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] | 12141 | // Fill in isFastTransitionEnabled |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12142 | if (pMac->roam.configParam.isFastTransitionEnabled |
| 12143 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 12144 | || csrRoamIsFastRoamEnabled(pMac, sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12145 | #endif |
| 12146 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12147 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12148 | dwTmp = pal_cpu_to_be32(TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12149 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12150 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12151 | } |
| 12152 | else |
| 12153 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12154 | dwTmp = pal_cpu_to_be32(FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12155 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12156 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12157 | } |
| 12158 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12159 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 12160 | if(csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12161 | { |
| 12162 | //legacy fast roaming enabled |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12163 | dwTmp = pal_cpu_to_be32(TRUE); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12164 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12165 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12166 | } |
| 12167 | else |
| 12168 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12169 | dwTmp = pal_cpu_to_be32(FALSE); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12170 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12171 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12172 | } |
| 12173 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12174 | |
| 12175 | // txLdpcIniFeatureEnabled |
| 12176 | *pBuf = (tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 12177 | pBuf++; |
| 12178 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12179 | if ((csrIs11hSupported (pMac)) && (CSR_IS_CHANNEL_5GHZ(pBssDescription->channelId)) && |
| 12180 | (pIes->Country.present) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)) |
| 12181 | { |
| 12182 | csrSaveToChannelPower2G_5G( pMac, pIes->Country.num_triplets * sizeof(tSirMacChanInfo), |
| 12183 | (tSirMacChanInfo *)(&pIes->Country.triplets[0]) ); |
| 12184 | csrApplyPower2Current(pMac); |
| 12185 | } |
| 12186 | |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 12187 | #ifdef WLAN_FEATURE_11AC |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12188 | // txBFIniFeatureEnabled |
| 12189 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFEnable; |
| 12190 | pBuf++; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 12191 | |
| 12192 | // txBFCsnValue |
| 12193 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFCsnValue; |
| 12194 | pBuf++; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 12195 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12196 | //BssDesc |
| 12197 | csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, |
| 12198 | (tANI_U8)pProfile->uapsd_mask); |
| 12199 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 12200 | if(!HAL_STATUS_SUCCESS(status)) |
| 12201 | { |
| 12202 | break; |
| 12203 | } |
| 12204 | else |
| 12205 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12206 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12207 | if (eWNI_SME_JOIN_REQ == messageType) |
| 12208 | { |
| 12209 | //Tush-QoS: notify QoS module that join happening |
| 12210 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_JOIN_REQ, NULL); |
| 12211 | } |
| 12212 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 12213 | { |
| 12214 | //Tush-QoS: notify QoS module that reassoc happening |
| 12215 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_REASSOC_REQ, NULL); |
| 12216 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12217 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12218 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12219 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12220 | return( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12221 | } |
| 12222 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12223 | // |
| 12224 | eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 12225 | { |
| 12226 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12227 | tSirSmeDisassocReq *pMsg; |
| 12228 | tANI_U8 *pBuf; |
| 12229 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12230 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12231 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 12232 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12233 | do { |
| 12234 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocReq )); |
| 12235 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12236 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocReq )); |
| 12237 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_REQ); |
| 12238 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12239 | pBuf = &pMsg->sessionId; |
| 12240 | // sessionId |
| 12241 | *pBuf++ = (tANI_U8)sessionId; |
| 12242 | // transactionId |
| 12243 | *pBuf = 0; |
| 12244 | *( pBuf + 1 ) = 0; |
| 12245 | pBuf += sizeof(tANI_U16); |
| 12246 | |
Gopichand Nakkala | 06a7b3f | 2013-03-05 17:56:50 +0530 | [diff] [blame] | 12247 | if ( (pSession->pCurRoamProfile != NULL) && |
| 12248 | ((CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
| 12249 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile))) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12250 | { |
| 12251 | // Set the bssid address before sending the message to LIM |
| 12252 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( tSirMacAddr ) ); |
| 12253 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12254 | // Set the peer MAC address before sending the message to LIM |
| 12255 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); //perMacAddr is passed as bssId for softAP |
| 12256 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 12257 | } |
| 12258 | else |
| 12259 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12260 | // Set the peer MAC address before sending the message to LIM |
| 12261 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); |
| 12262 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12263 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->bssId ) ); |
| 12264 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12265 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12266 | if(!HAL_STATUS_SUCCESS(status)) |
| 12267 | { |
| 12268 | palFreeMemory(pMac->hHdd, pMsg); |
| 12269 | break; |
| 12270 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12271 | // reasonCode |
| 12272 | wTmp = pal_cpu_to_be16(reasonCode); |
| 12273 | status = palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12274 | if(!HAL_STATUS_SUCCESS(status)) |
| 12275 | { |
| 12276 | palFreeMemory(pMac->hHdd, pMsg); |
| 12277 | break; |
| 12278 | } |
| 12279 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12280 | /* The state will be DISASSOC_HANDOFF only when we are doing handoff. |
| 12281 | Here we should not send the disassoc over the air to the AP */ |
| 12282 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId) |
| 12283 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 12284 | && csrRoamIs11rAssoc(pMac) |
| 12285 | #endif |
| 12286 | ) |
| 12287 | { |
| 12288 | *pBuf = CSR_DONT_SEND_DISASSOC_OVER_THE_AIR; /* Set DoNotSendOverTheAir flag to 1 only for handoff case */ |
| 12289 | } |
| 12290 | pBuf += sizeof(tANI_U8); |
| 12291 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12292 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12293 | return( status ); |
| 12294 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12295 | eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable, tSirMacAddr bssId ) |
| 12296 | { |
| 12297 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12298 | tSirSmeTkipCntrMeasReq *pMsg; |
| 12299 | tANI_U8 *pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12300 | do |
| 12301 | { |
| 12302 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeTkipCntrMeasReq )); |
| 12303 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12304 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeTkipCntrMeasReq )); |
| 12305 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_TKIP_CNTR_MEAS_REQ); |
| 12306 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeTkipCntrMeasReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12307 | pBuf = &pMsg->sessionId; |
| 12308 | // sessionId |
| 12309 | *pBuf++ = (tANI_U8)sessionId; |
| 12310 | // transactionId |
| 12311 | *pBuf = 0; |
| 12312 | *( pBuf + 1 ) = 0; |
| 12313 | pBuf += sizeof(tANI_U16); |
| 12314 | // bssid |
| 12315 | status = palCopyMemory( pMac->hHdd, pMsg->bssId, bssId, sizeof( tSirMacAddr ) ); |
| 12316 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 12317 | // bEnable |
| 12318 | *pBuf = (tANI_BOOLEAN)bEnable; |
| 12319 | if(!HAL_STATUS_SUCCESS(status)) |
| 12320 | { |
| 12321 | palFreeMemory(pMac->hHdd, pMsg); |
| 12322 | break; |
| 12323 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12324 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12325 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12326 | return( status ); |
| 12327 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12328 | eHalStatus |
| 12329 | csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12330 | VOS_MODULE_ID modId, tSirMacAddr bssId, |
| 12331 | void *pUsrContext, void *pfnSapEventCallback, |
| 12332 | tANI_U8 *pAssocStasBuf ) |
| 12333 | { |
| 12334 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12335 | tSirSmeGetAssocSTAsReq *pMsg; |
| 12336 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 12337 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12338 | do |
| 12339 | { |
| 12340 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeGetAssocSTAsReq ) ); |
| 12341 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12342 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetAssocSTAsReq ) ); |
| 12343 | 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] | 12344 | pBuf = (tANI_U8 *)&pMsg->bssId; |
| 12345 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12346 | // bssId |
| 12347 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) ); |
| 12348 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12349 | // modId |
| 12350 | dwTmp = pal_cpu_to_be16((tANI_U16)modId); |
| 12351 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U16)); |
| 12352 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12353 | // pUsrContext |
| 12354 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
| 12355 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12356 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12357 | // pfnSapEventCallback |
| 12358 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
| 12359 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12360 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12361 | // pAssocStasBuf |
| 12362 | dwTmp = pal_cpu_to_be32((tANI_U32)pAssocStasBuf); |
| 12363 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12364 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12365 | 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] | 12366 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12367 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12368 | return( status ); |
| 12369 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12370 | eHalStatus |
| 12371 | csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12372 | tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac) |
| 12373 | { |
| 12374 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12375 | tSirSmeGetWPSPBCSessionsReq *pMsg; |
| 12376 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 12377 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12378 | do |
| 12379 | { |
| 12380 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirSmeGetWPSPBCSessionsReq) ); |
| 12381 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12382 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetWPSPBCSessionsReq ) ); |
| 12383 | 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] | 12384 | pBuf = (tANI_U8 *)&pMsg->pUsrContext; |
| 12385 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12386 | // pUsrContext |
| 12387 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
| 12388 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12389 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12390 | // pSapEventCallback |
| 12391 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
| 12392 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12393 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12394 | // bssId |
| 12395 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) ); |
| 12396 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12397 | // MAC Address of STA in WPS session |
| 12398 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pRemoveMac.bytes, sizeof(v_MACADDR_t)); |
| 12399 | pBuf += sizeof(v_MACADDR_t); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12400 | 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] | 12401 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12402 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12403 | return( status ); |
| 12404 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 12405 | |
| 12406 | eHalStatus |
| 12407 | csrSendChngMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12408 | { |
| 12409 | tpSirChangeBIParams pMsg; |
| 12410 | tANI_U16 len = 0; |
| 12411 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12412 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12413 | |
| 12414 | if(!pSession) |
| 12415 | { |
| 12416 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12417 | return eHAL_STATUS_FAILURE; |
| 12418 | } |
| 12419 | |
| 12420 | //NO need to update the Beacon Params if update beacon parameter flag is not set |
| 12421 | if(!pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval ) |
| 12422 | return eHAL_STATUS_SUCCESS; |
| 12423 | |
| 12424 | pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE; |
| 12425 | |
| 12426 | /* Create the message and send to lim */ |
| 12427 | len = sizeof(tSirChangeBIParams); |
| 12428 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len ); |
| 12429 | if(HAL_STATUS_SUCCESS(status)) |
| 12430 | { |
| 12431 | palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirChangeBIParams) ); |
| 12432 | pMsg->messageType = eWNI_SME_CHNG_MCC_BEACON_INTERVAL; |
| 12433 | pMsg->length = len; |
| 12434 | |
| 12435 | // bssId |
| 12436 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12437 | smsLog( pMac, LOG1, FL("CSR Attempting to change BI for Bssid= %02x-%02x-%02x-%02x-%02x-%02x "), |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 12438 | pMsg->bssId[ 0 ], pMsg->bssId[ 1 ], pMsg->bssId[ 2 ], |
| 12439 | pMsg->bssId[ 3 ], pMsg->bssId[ 4 ], pMsg->bssId[ 5 ] ); |
| 12440 | pMsg->sessionId = sessionId; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12441 | smsLog(pMac, LOG1, FL(" session %d BeaconInterval %d"), sessionId, pMac->roam.roamSession[sessionId].bssParams.beaconInterval); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 12442 | pMsg->beaconInterval = pMac->roam.roamSession[sessionId].bssParams.beaconInterval; |
| 12443 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 12444 | } |
| 12445 | return status; |
| 12446 | } |
| 12447 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12448 | eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 12449 | { |
| 12450 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12451 | tSirSmeDeauthReq *pMsg; |
| 12452 | tANI_U8 *pBuf; |
| 12453 | tANI_U16 wTmp; |
| 12454 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12455 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 12456 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12457 | do { |
| 12458 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthReq )); |
| 12459 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12460 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthReq )); |
| 12461 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_REQ); |
| 12462 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthReq )); |
| 12463 | //sessionId |
| 12464 | pBuf = &pMsg->sessionId; |
| 12465 | *pBuf++ = (tANI_U8)sessionId; |
| 12466 | |
| 12467 | //tansactionId |
| 12468 | *pBuf = 0; |
| 12469 | *(pBuf + 1 ) = 0; |
| 12470 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12471 | if ((pSession->pCurRoamProfile != NULL) && ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12472 | (CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12473 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))){ |
| 12474 | // Set the BSSID before sending the message to LIM |
| 12475 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( pMsg->peerMacAddr ) ); |
| 12476 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 12477 | } |
| 12478 | else |
| 12479 | { |
| 12480 | // Set the BSSID before sending the message to LIM |
| 12481 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 12482 | pBuf = pBuf + sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12483 | } |
| 12484 | if(!HAL_STATUS_SUCCESS(status)) |
| 12485 | { |
| 12486 | palFreeMemory(pMac->hHdd, pMsg); |
| 12487 | break; |
| 12488 | } |
| 12489 | // Set the peer MAC address before sending the message to LIM |
| 12490 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *) pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 12491 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 12492 | if(!HAL_STATUS_SUCCESS(status)) |
| 12493 | { |
| 12494 | palFreeMemory(pMac->hHdd, pMsg); |
| 12495 | break; |
| 12496 | } |
| 12497 | wTmp = pal_cpu_to_be16(reasonCode); |
| 12498 | status = palCopyMemory( pMac->hHdd, pBuf, &wTmp,sizeof( tANI_U16 ) ); |
| 12499 | if(!HAL_STATUS_SUCCESS(status)) |
| 12500 | { |
| 12501 | palFreeMemory(pMac->hHdd, pMsg); |
| 12502 | break; |
| 12503 | } |
| 12504 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12505 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12506 | return( status ); |
| 12507 | } |
| 12508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12509 | eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd ) |
| 12510 | { |
| 12511 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12512 | tSirSmeDisassocCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12513 | do { |
| 12514 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocCnf )); |
| 12515 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12516 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocCnf )); |
| 12517 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_CNF); |
| 12518 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12519 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocCnf )); |
| 12520 | status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDisassocInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); |
| 12521 | if(!HAL_STATUS_SUCCESS(status)) |
| 12522 | { |
| 12523 | palFreeMemory(pMac->hHdd, pMsg); |
| 12524 | break; |
| 12525 | } |
| 12526 | //To test reconn |
| 12527 | status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDisassocInd->bssId, sizeof(pMsg->peerMacAddr)); |
| 12528 | if(!HAL_STATUS_SUCCESS(status)) |
| 12529 | { |
| 12530 | palFreeMemory(pMac->hHdd, pMsg); |
| 12531 | break; |
| 12532 | } |
| 12533 | //To test reconn ends |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12534 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12535 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12536 | return( status ); |
| 12537 | } |
| 12538 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12539 | eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd ) |
| 12540 | { |
| 12541 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12542 | tSirSmeDeauthCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12543 | do { |
| 12544 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthCnf )); |
| 12545 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12546 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthCnf )); |
| 12547 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_CNF); |
| 12548 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12549 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthCnf )); |
| 12550 | status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDeauthInd->bssId, sizeof(pMsg->bssId)); |
| 12551 | if(!HAL_STATUS_SUCCESS(status)) |
| 12552 | { |
| 12553 | palFreeMemory(pMac->hHdd, pMsg); |
| 12554 | break; |
| 12555 | } |
| 12556 | status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDeauthInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); |
| 12557 | if(!HAL_STATUS_SUCCESS(status)) |
| 12558 | { |
| 12559 | palFreeMemory(pMac->hHdd, pMsg); |
| 12560 | break; |
| 12561 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12562 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12563 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12564 | return( status ); |
| 12565 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12566 | eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus ) |
| 12567 | { |
| 12568 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12569 | tSirSmeAssocCnf *pMsg; |
| 12570 | tANI_U8 *pBuf; |
| 12571 | tSirResultCodes statusCode; |
| 12572 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12573 | do { |
| 12574 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocCnf )); |
| 12575 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12576 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocCnf )); |
| 12577 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ASSOC_CNF); |
| 12578 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocCnf )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12579 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 12580 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 12581 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12582 | else |
| 12583 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
| 12584 | palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) ); |
| 12585 | pBuf += sizeof(tSirResultCodes); |
| 12586 | // bssId |
| 12587 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12588 | pBuf += sizeof (tSirMacAddr); |
| 12589 | // peerMacAddr |
| 12590 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 12591 | pBuf += sizeof (tSirMacAddr); |
| 12592 | // aid |
| 12593 | wTmp = pal_cpu_to_be16(pAssocInd->aid); |
| 12594 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12595 | pBuf += sizeof (tANI_U16); |
| 12596 | // alternateBssId |
| 12597 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12598 | pBuf += sizeof (tSirMacAddr); |
| 12599 | // alternateChannelId |
| 12600 | *pBuf = 11; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12601 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12602 | if(!HAL_STATUS_SUCCESS(status)) |
| 12603 | { |
| 12604 | //pMsg is freed by palSendMBMessage |
| 12605 | break; |
| 12606 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12607 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12608 | return( status ); |
| 12609 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12610 | eHalStatus csrSendAssocIndToUpperLayerCnfMsg( tpAniSirGlobal pMac, |
| 12611 | tpSirSmeAssocInd pAssocInd, |
| 12612 | eHalStatus Halstatus, |
| 12613 | tANI_U8 sessionId) |
| 12614 | { |
| 12615 | tSirMsgQ msgQ; |
| 12616 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12617 | tSirSmeAssocIndToUpperLayerCnf *pMsg; |
| 12618 | tANI_U8 *pBuf; |
| 12619 | tSirResultCodes statusCode; |
| 12620 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12621 | do { |
| 12622 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 12623 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12624 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12625 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12626 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPPER_LAYER_ASSOC_CNF); |
| 12627 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 12628 | |
| 12629 | pMsg->sessionId = sessionId; |
| 12630 | |
| 12631 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 12632 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 12633 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12634 | else |
| 12635 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
| 12636 | palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) ); |
| 12637 | pBuf += sizeof(tSirResultCodes); |
| 12638 | // bssId |
| 12639 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12640 | pBuf += sizeof (tSirMacAddr); |
| 12641 | // peerMacAddr |
| 12642 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 12643 | pBuf += sizeof (tSirMacAddr); |
| 12644 | // StaId |
| 12645 | wTmp = pal_cpu_to_be16(pAssocInd->staId); |
| 12646 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12647 | pBuf += sizeof (tANI_U16); |
| 12648 | // alternateBssId |
| 12649 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12650 | pBuf += sizeof (tSirMacAddr); |
| 12651 | // alternateChannelId |
| 12652 | *pBuf = 11; |
| 12653 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12654 | // Instead of copying roam Info, we just copy only WmmEnabled , RsnIE information |
| 12655 | //Wmm |
| 12656 | *pBuf = pAssocInd->wmmEnabledSta; |
| 12657 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12658 | //RSN IE |
| 12659 | status = palCopyMemory(pMac->hHdd, (tSirRSNie *)pBuf, &pAssocInd->rsnIE, sizeof(tSirRSNie)); |
| 12660 | pBuf += sizeof (tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12661 | //Additional IE |
| 12662 | status = palCopyMemory(pMac->hHdd, (void *)pBuf, &pAssocInd->addIE, sizeof(tSirAddie)); |
| 12663 | pBuf += sizeof (tSirAddie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12664 | //reassocReq |
| 12665 | *pBuf = pAssocInd->reassocReq; |
| 12666 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12667 | msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF; |
| 12668 | msgQ.bodyptr = pMsg; |
| 12669 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12670 | SysProcessMmhMsg(pMac, &msgQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12671 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12672 | return( status ); |
| 12673 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12674 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12675 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId , |
| 12676 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 12677 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 12678 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 12679 | tANI_U8 *pKeyRsc ) |
| 12680 | { |
| 12681 | tSirSmeSetContextReq *pMsg; |
| 12682 | tANI_U16 msgLen; |
| 12683 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12684 | tAniEdType tmpEdType; |
| 12685 | tAniKeyDirection tmpDirection; |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 12686 | tANI_U8 *pBuf = NULL; |
| 12687 | tANI_U8 *p = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12688 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12689 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12690 | if( ( 1 != numKeys ) && ( 0 != numKeys ) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12691 | // all of these fields appear in every SET_CONTEXT message. Below we'll add in the size for each |
| 12692 | // key set. Since we only support upto one key, we always allocate memory for 1 key |
| 12693 | msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) + |
| 12694 | sizeof( tSirMacAddr ) + 1 + sizeof(tANI_U16) + |
| 12695 | sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + |
| 12696 | ( sizeof( pMsg->keyMaterial.key ) ); |
| 12697 | |
| 12698 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12699 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12700 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 12701 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SETCONTEXT_REQ); |
| 12702 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12703 | //sessionId |
| 12704 | pBuf = &pMsg->sessionId; |
| 12705 | *pBuf = (tANI_U8)sessionId; |
| 12706 | pBuf++; |
| 12707 | // transactionId |
| 12708 | *pBuf = 0; |
| 12709 | *(pBuf + 1) = 0; |
| 12710 | pBuf += sizeof(tANI_U16); |
| 12711 | // peerMacAddr |
| 12712 | palCopyMemory( pMac->hHdd, pBuf, |
| 12713 | (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr) ); |
| 12714 | |
| 12715 | pBuf += sizeof(tSirMacAddr); |
| 12716 | |
| 12717 | // bssId |
| 12718 | palCopyMemory( pMac->hHdd, pBuf, |
| 12719 | (tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 12720 | |
| 12721 | pBuf += sizeof(tSirMacAddr); |
| 12722 | |
| 12723 | p = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12724 | // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field |
| 12725 | // in the tSirKeyMaterial keyMaterial; field). |
| 12726 | // |
| 12727 | // !!NOTE: This keyMaterial.length contains the length of a MAX size key, though the keyLength can be |
| 12728 | // shorter than this max size. Is LIM interpreting this ok ? |
| 12729 | 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] | 12730 | // set pMsg->keyMaterial.edType |
| 12731 | tmpEdType = (tAniEdType)pal_cpu_to_be32(edType); |
| 12732 | palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType) ); |
| 12733 | p += sizeof( pMsg->keyMaterial.edType ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12734 | // set the pMsg->keyMaterial.numKeys field |
| 12735 | *p = numKeys; |
| 12736 | p += sizeof( pMsg->keyMaterial.numKeys ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12737 | // set pSirKey->keyId = keyId; |
| 12738 | *p = keyId; |
| 12739 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12740 | // set pSirKey->unicast = (tANI_U8)fUnicast; |
| 12741 | *p = (tANI_U8)fUnicast; |
| 12742 | p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12743 | // set pSirKey->keyDirection = aniKeyDirection; |
| 12744 | tmpDirection = (tAniKeyDirection)pal_cpu_to_be32(aniKeyDirection); |
| 12745 | palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection) ); |
| 12746 | p += sizeof(tAniKeyDirection); |
| 12747 | // pSirKey->keyRsc = ;; |
| 12748 | palCopyMemory( pMac->hHdd, p, pKeyRsc, CSR_MAX_RSC_LEN ); |
| 12749 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12750 | // set pSirKey->paeRole |
| 12751 | *p = paeRole; // 0 is Supplicant |
| 12752 | p++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12753 | // set pSirKey->keyLength = keyLength; |
| 12754 | p = pal_set_U16( p, pal_cpu_to_be16(keyLength) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12755 | if ( keyLength && pKey ) |
| 12756 | { |
| 12757 | palCopyMemory( pMac->hHdd, p, pKey, keyLength ); |
| 12758 | if(keyLength == 16) |
| 12759 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12760 | smsLog(pMac, LOG1, " SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12761 | keyId, edType, pKey[0], pKey[1], pKey[2], pKey[3], pKey[4], |
| 12762 | pKey[5], pKey[6], pKey[7], pKey[8], |
| 12763 | pKey[9], pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], pKey[15]); |
| 12764 | } |
| 12765 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12766 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12767 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12768 | return( status ); |
| 12769 | } |
| 12770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12771 | eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, |
| 12772 | tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc ) |
| 12773 | { |
| 12774 | eHalStatus status; |
| 12775 | tSirSmeStartBssReq *pMsg; |
| 12776 | tANI_U8 *pBuf = NULL; |
| 12777 | tANI_U8 *wTmpBuf = NULL; |
| 12778 | tANI_U16 msgLen, wTmp; |
| 12779 | tANI_U32 dwTmp; |
| 12780 | tSirNwType nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12781 | ePhyChanBondState cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12782 | tANI_U32 authType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12783 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12784 | |
| 12785 | if(!pSession) |
| 12786 | { |
| 12787 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12788 | return eHAL_STATUS_FAILURE; |
| 12789 | } |
| 12790 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12791 | do { |
| 12792 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 12793 | pSession->joinFailStatusCode.reasonCode = 0; |
| 12794 | msgLen = sizeof(tSirSmeStartBssReq); |
| 12795 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12796 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12797 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 12798 | 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] | 12799 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12800 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12801 | //sessionId |
| 12802 | *pBuf = (tANI_U8)sessionId; |
| 12803 | pBuf++; |
| 12804 | // transactionId |
| 12805 | *pBuf = 0; |
| 12806 | *(pBuf + 1) = 0; |
| 12807 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12808 | // bssid |
| 12809 | palCopyMemory( pMac->hHdd, pBuf, pParam->bssid, sizeof(tSirMacAddr) ); |
| 12810 | pBuf += sizeof(tSirMacAddr); |
| 12811 | // selfMacAddr |
| 12812 | palCopyMemory( pMac->hHdd, pBuf, pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 12813 | pBuf += sizeof(tSirMacAddr); |
| 12814 | // beaconInterval |
| 12815 | if( pBssDesc && pBssDesc->beaconInterval ) |
| 12816 | { |
| 12817 | wTmp = pal_cpu_to_be16( pBssDesc->beaconInterval ); |
| 12818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12819 | else if(pParam->beaconInterval) |
| 12820 | { |
| 12821 | wTmp = pal_cpu_to_be16( pParam->beaconInterval ); |
| 12822 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12823 | else |
| 12824 | { |
| 12825 | wTmp = pal_cpu_to_be16( WNI_CFG_BEACON_INTERVAL_STADEF ); |
| 12826 | } |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame] | 12827 | if(csrIsconcurrentsessionValid (pMac, sessionId, |
| 12828 | pParam->bssPersona) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12829 | == eHAL_STATUS_SUCCESS ) |
| 12830 | { |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 12831 | csrValidateMCCBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12832 | pParam->bssPersona); |
| 12833 | //Update the beacon Interval |
| 12834 | pParam->beaconInterval = wTmp; |
| 12835 | } |
| 12836 | else |
| 12837 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12838 | smsLog( pMac,LOGE, FL("****Start BSS failed persona already exists***")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12839 | status = eHAL_STATUS_FAILURE; |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 12840 | palFreeMemory( pMac->hHdd, pMsg ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12841 | return status; |
| 12842 | } |
| 12843 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12844 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); |
| 12845 | pBuf += sizeof(tANI_U16); |
| 12846 | // dot11mode |
| 12847 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pParam->uCfgDot11Mode ); |
| 12848 | pBuf += 1; |
| 12849 | // bssType |
| 12850 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( bssType ) ); |
| 12851 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 12852 | pBuf += sizeof(tSirBssType); |
| 12853 | // ssId |
| 12854 | if( pParam->ssId.length ) |
| 12855 | { |
| 12856 | // ssId len |
| 12857 | *pBuf = pParam->ssId.length; |
| 12858 | pBuf++; |
| 12859 | palCopyMemory( pMac->hHdd, pBuf, pParam->ssId.ssId, pParam->ssId.length ); |
| 12860 | pBuf += pParam->ssId.length; |
| 12861 | } |
| 12862 | else |
| 12863 | { |
| 12864 | *pBuf = 0; |
| 12865 | pBuf++; |
| 12866 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12867 | // set the channel Id |
| 12868 | *pBuf = pParam->operationChn; |
| 12869 | pBuf++; |
| 12870 | //What should we really do for the cbmode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12871 | cbMode = (ePhyChanBondState)pal_cpu_to_be32(pParam->cbMode); |
| 12872 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState) ); |
| 12873 | pBuf += sizeof(ePhyChanBondState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12874 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12875 | // Set privacy |
| 12876 | *pBuf = pParam->privacy; |
| 12877 | pBuf++; |
| 12878 | |
| 12879 | //Set Uapsd |
| 12880 | *pBuf = pParam->ApUapsdEnable; |
| 12881 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12882 | //Set SSID hidden |
| 12883 | *pBuf = pParam->ssidHidden; |
| 12884 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12885 | *pBuf = (tANI_U8)pParam->fwdWPSPBCProbeReq; |
| 12886 | pBuf++; |
| 12887 | |
| 12888 | //Ht protection Enable/Disable |
| 12889 | *pBuf = (tANI_U8)pParam->protEnabled; |
| 12890 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12891 | //Enable Beacons to Receive for OBSS protection Enable/Disable |
| 12892 | *pBuf = (tANI_U8)pParam->obssProtEnabled; |
| 12893 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12894 | //set cfg related to protection |
| 12895 | wTmp = pal_cpu_to_be16( pParam->ht_protection ); |
| 12896 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); |
| 12897 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12898 | // Set Auth type |
| 12899 | authType = pal_cpu_to_be32(pParam->authType); |
| 12900 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&authType, sizeof(tANI_U32)); |
| 12901 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12902 | // Set DTIM |
| 12903 | dwTmp = pal_cpu_to_be32(pParam->dtimPeriod); |
| 12904 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12905 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12906 | // Set wps_state |
| 12907 | *pBuf = pParam->wps_state; |
| 12908 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12909 | //Persona |
| 12910 | *pBuf = (tANI_U8)pParam->bssPersona; |
| 12911 | pBuf++; |
| 12912 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 12913 | //txLdpcIniFeatureEnabled |
| 12914 | *pBuf = (tANI_U8)(tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 12915 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12916 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12917 | |
| 12918 | // set RSN IE |
| 12919 | if( pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata) ) |
| 12920 | { |
| 12921 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 12922 | palFreeMemory( pMac->hHdd, pMsg ); |
| 12923 | break; |
| 12924 | } |
| 12925 | wTmp = pal_cpu_to_be16( pParam->nRSNIELength ); |
| 12926 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12927 | pBuf += sizeof(tANI_U16); |
| 12928 | if( wTmp ) |
| 12929 | { |
| 12930 | wTmp = pParam->nRSNIELength; |
| 12931 | palCopyMemory( pMac->hHdd, pBuf, pParam->pRSNIE, wTmp ); |
| 12932 | pBuf += wTmp; |
| 12933 | } |
| 12934 | nwType = (tSirNwType)pal_cpu_to_be32(pParam->sirNwType); |
| 12935 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType) ); |
| 12936 | pBuf += sizeof(tSirNwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12937 | *pBuf = pParam->operationalRateSet.numRates; //tSirMacRateSet->numRates |
| 12938 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12939 | palCopyMemory( pMac->hHdd, pBuf, pParam->operationalRateSet.rate, pParam->operationalRateSet.numRates ); |
| 12940 | pBuf += pParam->operationalRateSet.numRates ; |
| 12941 | *pBuf++ = pParam->extendedRateSet.numRates; |
| 12942 | if(0 != pParam->extendedRateSet.numRates) |
| 12943 | { |
| 12944 | palCopyMemory( pMac->hHdd, pBuf, pParam->extendedRateSet.rate, pParam->extendedRateSet.numRates ); |
| 12945 | pBuf += pParam->extendedRateSet.numRates; |
| 12946 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12947 | msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg |
| 12948 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 12949 | |
| 12950 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12951 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12952 | return( status ); |
| 12953 | } |
| 12954 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12955 | eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 12956 | { |
| 12957 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12958 | tSirSmeStopBssReq *pMsg; |
| 12959 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12960 | tANI_U8 *pBuf; |
| 12961 | tANI_U16 msgLen; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12962 | |
| 12963 | if(!pSession) |
| 12964 | { |
| 12965 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12966 | return eHAL_STATUS_FAILURE; |
| 12967 | } |
| 12968 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12969 | do { |
| 12970 | status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq)); |
| 12971 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12972 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq )); |
| 12973 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 12974 | pBuf = &pMsg->sessionId; |
| 12975 | //sessionId |
| 12976 | *pBuf = (tANI_U8)sessionId; |
| 12977 | pBuf++; |
| 12978 | // transactionId |
| 12979 | *pBuf = 0; |
| 12980 | pBuf += sizeof(tANI_U16); |
| 12981 | //reason code |
| 12982 | *pBuf = 0; |
| 12983 | pBuf += sizeof(tSirResultCodes); |
| 12984 | // bssid |
| 12985 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 12986 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 12987 | { |
| 12988 | palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 12989 | } |
| 12990 | else |
| 12991 | { |
| 12992 | palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 12993 | } |
| 12994 | pBuf += sizeof(tSirMacAddr); |
| 12995 | msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr); |
| 12996 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12997 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12998 | #if 0 |
| 12999 | status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq)); |
| 13000 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 13001 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq )); |
| 13002 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 13003 | pMsg->reasonCode = 0; |
| 13004 | // bssid |
| 13005 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 13006 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 13007 | { |
| 13008 | pbBssid = (tANI_U8 *)&pSession->selfMacAddr; |
| 13009 | } |
| 13010 | else |
| 13011 | { |
| 13012 | pbBssid = (tANI_U8 *)&pSession->connectedProfile.bssid; |
| 13013 | } |
| 13014 | palCopyMemory( pMac->hHdd, &pMsg->bssId, pbBssid, sizeof(tSirMacAddr) ); |
| 13015 | pMsg->transactionId = 0; |
| 13016 | pMsg->sessionId = (tANI_U8)sessionId; |
| 13017 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeStopBssReq )); |
| 13018 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13019 | #endif |
| 13020 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13021 | return( status ); |
| 13022 | } |
| 13023 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13024 | eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13025 | tCsrRoamModifyProfileFields *pModProfileFields, |
| 13026 | tANI_U32 *pRoamId, v_BOOL_t fForce) |
| 13027 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13028 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13029 | tANI_U32 roamId = 0; |
| 13030 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13031 | if((csrIsConnStateConnected(pMac, sessionId)) && |
| 13032 | (fForce || (!palEqualMemory(pMac->hHdd, &pModProfileFields, |
| 13033 | &pSession->connectedProfile.modifyProfileFields, |
| 13034 | sizeof(tCsrRoamModifyProfileFields)))) ) |
| 13035 | { |
| 13036 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 13037 | if(pRoamId) |
| 13038 | { |
| 13039 | *pRoamId = roamId; |
| 13040 | } |
| 13041 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13042 | status = csrRoamIssueReassoc(pMac, sessionId, NULL, pModProfileFields, |
| 13043 | eCsrSmeIssuedReassocToSameAP, roamId, |
| 13044 | eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13045 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13046 | return status; |
| 13047 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13048 | static eHalStatus csrRoamSessionOpened(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13049 | { |
| 13050 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13051 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13052 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 13053 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 13054 | eCSR_ROAM_SESSION_OPENED, eCSR_ROAM_RESULT_NONE); |
| 13055 | return (status); |
| 13056 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13057 | eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 13058 | { |
| 13059 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13060 | tListElem *pEntry = NULL; |
| 13061 | tSmeCmd *pCommand = NULL; |
| 13062 | tSirSmeAddStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13063 | do |
| 13064 | { |
| 13065 | if(pMsg == NULL) |
| 13066 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13067 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13068 | status = eHAL_STATUS_FAILURE; |
| 13069 | break; |
| 13070 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13071 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 13072 | if(pEntry) |
| 13073 | { |
| 13074 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13075 | if(eSmeCommandAddStaSession == pCommand->command) |
| 13076 | { |
| 13077 | pRsp = (tSirSmeAddStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13078 | smsLog( pMac, LOG1, "Add Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13079 | //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] | 13080 | csrRoamSessionOpened(pMac, pCommand->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13081 | //Remove this command out of the active list |
| 13082 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 13083 | { |
| 13084 | //Now put this command back on the avilable command list |
| 13085 | csrReleaseCommand(pMac, pCommand); |
| 13086 | } |
| 13087 | smeProcessPendingQueue( pMac ); |
| 13088 | } |
| 13089 | else |
| 13090 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13091 | smsLog(pMac, LOGE, "in %s eWNI_SME_ADD_STA_SELF_RSP Received but NO Add sta session command are ACTIVE ...", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13092 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13093 | status = eHAL_STATUS_FAILURE; |
| 13094 | break; |
| 13095 | } |
| 13096 | } |
| 13097 | else |
| 13098 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13099 | smsLog(pMac, LOGE, "in %s eWNI_SME_ADD_STA_SELF_RSP Received but NO commands are ACTIVE ...", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13100 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13101 | status = eHAL_STATUS_FAILURE; |
| 13102 | break; |
| 13103 | } |
| 13104 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13105 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13106 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13107 | eHalStatus csrSendMBAddSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 13108 | { |
| 13109 | tSirSmeAddStaSelfReq *pMsg; |
| 13110 | tANI_U16 msgLen; |
| 13111 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13112 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13113 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 13114 | sizeof( tSirBssType )*/; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13115 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 13116 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13117 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13118 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ADD_STA_SELF_REQ); |
| 13119 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13120 | // self station address |
| 13121 | palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13122 | smsLog( pMac, LOG1, FL("selfMac=%02x, %02x, %02x, %02x, %02x, %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13123 | pMsg->selfMacAddr[0], |
| 13124 | pMsg->selfMacAddr[1], |
| 13125 | pMsg->selfMacAddr[2], |
| 13126 | pMsg->selfMacAddr[3], |
| 13127 | pMsg->selfMacAddr[4], |
| 13128 | pMsg->selfMacAddr[5]); |
| 13129 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13130 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13131 | return( status ); |
| 13132 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13133 | eHalStatus csrIssueAddStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr sessionMacAddr) |
| 13134 | { |
| 13135 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13136 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13137 | pCommand = csrGetCommandBuffer(pMac); |
| 13138 | if(NULL == pCommand) |
| 13139 | { |
| 13140 | status = eHAL_STATUS_RESOURCES; |
| 13141 | } |
| 13142 | else |
| 13143 | { |
| 13144 | pCommand->command = eSmeCommandAddStaSession; |
| 13145 | pCommand->sessionId = (tANI_U8)sessionId; |
| 13146 | palCopyMemory( pMac->hHdd, pCommand->u.addStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13147 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 13148 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 13149 | { |
| 13150 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13151 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13152 | } |
| 13153 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13154 | return (status); |
| 13155 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13156 | eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 13157 | { |
| 13158 | return csrSendMBAddSelfStaReqMsg( pMac, |
| 13159 | pCommand->u.addStaSessionCmd.selfMacAddr ); |
| 13160 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13161 | eHalStatus csrRoamOpenSession( tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext, |
| 13162 | tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId ) |
| 13163 | { |
| 13164 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13165 | tANI_U32 i; |
| 13166 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13167 | *pbSessionId = CSR_SESSION_ID_INVALID; |
| 13168 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13169 | { |
| 13170 | if( !CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13171 | { |
| 13172 | pSession = CSR_GET_SESSION( pMac, i ); |
| 13173 | status = eHAL_STATUS_SUCCESS; |
| 13174 | pSession->sessionActive = eANI_BOOLEAN_TRUE; |
| 13175 | pSession->sessionId = (tANI_U8)i; |
| 13176 | pSession->callback = callback; |
| 13177 | pSession->pContext = pContext; |
| 13178 | palCopyMemory( pMac->hHdd, &pSession->selfMacAddr, pSelfMacAddr, sizeof(tCsrBssid) ); |
| 13179 | *pbSessionId = (tANI_U8)i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13180 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerRoaming, csrRoamRoamingTimerHandler, |
| 13181 | &pSession->roamingTimerInfo); |
| 13182 | if(!HAL_STATUS_SUCCESS(status)) |
| 13183 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13184 | smsLog(pMac, LOGE, FL("cannot allocate memory for Roaming timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13185 | break; |
| 13186 | } |
| 13187 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 13188 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerJoinRetry, csrRoamJoinRetryTimerHandler, |
| 13189 | &pSession->joinRetryTimerInfo); |
| 13190 | if(!HAL_STATUS_SUCCESS(status)) |
| 13191 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13192 | smsLog(pMac, LOGE, FL("cannot allocate memory for joinretry timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13193 | break; |
| 13194 | } |
| 13195 | #endif |
| 13196 | pSession->ibssJoinTimerInfo.pMac = pMac; |
| 13197 | pSession->ibssJoinTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13198 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerIbssJoining, csrRoamIbssJoinTimerHandler, |
| 13199 | &pSession->ibssJoinTimerInfo); |
| 13200 | if(!HAL_STATUS_SUCCESS(status)) |
| 13201 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13202 | smsLog(pMac, LOGE, FL("cannot allocate memory for IbssJoining timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13203 | break; |
| 13204 | } |
| 13205 | status = csrIssueAddStaForSessionReq ( pMac, i, pSelfMacAddr ); |
| 13206 | break; |
| 13207 | } |
| 13208 | } |
| 13209 | if( CSR_ROAM_SESSION_MAX == i ) |
| 13210 | { |
| 13211 | //No session is available |
| 13212 | status = eHAL_STATUS_RESOURCES; |
| 13213 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13214 | return ( status ); |
| 13215 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13216 | eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 13217 | { |
| 13218 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13219 | tListElem *pEntry = NULL; |
| 13220 | tSmeCmd *pCommand = NULL; |
| 13221 | tSirSmeDelStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13222 | do |
| 13223 | { |
| 13224 | if(pMsg == NULL) |
| 13225 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13226 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13227 | status = eHAL_STATUS_FAILURE; |
| 13228 | break; |
| 13229 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13230 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 13231 | if(pEntry) |
| 13232 | { |
| 13233 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13234 | if(eSmeCommandDelStaSession == pCommand->command) |
| 13235 | { |
| 13236 | tANI_U8 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13237 | pRsp = (tSirSmeDelStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13238 | smsLog( pMac, LOG1, "Del Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13239 | //This session is done. |
| 13240 | csrCleanupSession(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13241 | if(pCommand->u.delStaSessionCmd.callback) |
| 13242 | { |
| 13243 | |
| 13244 | status = sme_ReleaseGlobalLock( &pMac->sme ); |
| 13245 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 13246 | { |
| 13247 | pCommand->u.delStaSessionCmd.callback( |
| 13248 | pCommand->u.delStaSessionCmd.pContext); |
| 13249 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 13250 | if (! HAL_STATUS_SUCCESS( status ) ) |
| 13251 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13252 | smsLog(pMac, LOGP, "%s: Failed to Acquire Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13253 | return status; |
| 13254 | } |
| 13255 | } |
| 13256 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13257 | smsLog(pMac, LOGE, "%s: Failed to Release Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13258 | } |
| 13259 | } |
| 13260 | |
| 13261 | //Remove this command out of the active list |
| 13262 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 13263 | { |
| 13264 | //Now put this command back on the avilable command list |
| 13265 | csrReleaseCommand(pMac, pCommand); |
| 13266 | } |
| 13267 | smeProcessPendingQueue( pMac ); |
| 13268 | } |
| 13269 | else |
| 13270 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13271 | smsLog(pMac, LOGE, "in %s eWNI_SME_DEL_STA_SELF_RSP Received but NO Del sta session command are ACTIVE ...", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13272 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13273 | status = eHAL_STATUS_FAILURE; |
| 13274 | break; |
| 13275 | } |
| 13276 | } |
| 13277 | else |
| 13278 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13279 | smsLog(pMac, LOGE, "in %s eWNI_SME_DEL_STA_SELF_RSP Received but NO commands are ACTIVE ...", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13280 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13281 | status = eHAL_STATUS_FAILURE; |
| 13282 | break; |
| 13283 | } |
| 13284 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13285 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13286 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13287 | eHalStatus csrSendMBDelSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 13288 | { |
| 13289 | tSirSmeDelStaSelfReq *pMsg; |
| 13290 | tANI_U16 msgLen; |
| 13291 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13292 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13293 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 13294 | sizeof( tSirBssType )*/; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13295 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 13296 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 13297 | |
| 13298 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13299 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_STA_SELF_REQ); |
| 13300 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13301 | // self station address |
| 13302 | palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13303 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13304 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13305 | return( status ); |
| 13306 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13307 | eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13308 | tSirMacAddr sessionMacAddr, |
| 13309 | csrRoamSessionCloseCallback callback, |
| 13310 | void *pContext) |
| 13311 | { |
| 13312 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13313 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13314 | pCommand = csrGetCommandBuffer(pMac); |
| 13315 | if(NULL == pCommand) |
| 13316 | { |
| 13317 | status = eHAL_STATUS_RESOURCES; |
| 13318 | } |
| 13319 | else |
| 13320 | { |
| 13321 | pCommand->command = eSmeCommandDelStaSession; |
| 13322 | pCommand->sessionId = (tANI_U8)sessionId; |
| 13323 | pCommand->u.delStaSessionCmd.callback = callback; |
| 13324 | pCommand->u.delStaSessionCmd.pContext = pContext; |
| 13325 | palCopyMemory( pMac->hHdd, pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13326 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 13327 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 13328 | { |
| 13329 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13330 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13331 | } |
| 13332 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13333 | return (status); |
| 13334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13335 | eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 13336 | { |
| 13337 | return csrSendMBDelSelfStaReqMsg( pMac, |
| 13338 | pCommand->u.delStaSessionCmd.selfMacAddr ); |
| 13339 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13340 | static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13341 | { |
| 13342 | tDblLinkList *pList = &pMac->roam.roamCmdPendingList; |
| 13343 | tListElem *pEntry, *pNext; |
| 13344 | tSmeCmd *pCommand; |
| 13345 | tDblLinkList localList; |
| 13346 | |
| 13347 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 13348 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 13349 | { |
| 13350 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 13351 | return; |
| 13352 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13353 | csrLLLock(pList); |
| 13354 | pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK); |
| 13355 | while(pEntry != NULL) |
| 13356 | { |
| 13357 | pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK); |
| 13358 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13359 | if(pCommand->sessionId == sessionId) |
| 13360 | { |
| 13361 | if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK)) |
| 13362 | { |
| 13363 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 13364 | } |
| 13365 | } |
| 13366 | pEntry = pNext; |
| 13367 | } |
| 13368 | csrLLUnlock(pList); |
| 13369 | |
| 13370 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 13371 | { |
| 13372 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13373 | csrAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 13374 | } |
| 13375 | csrLLClose(&localList); |
| 13376 | } |
| 13377 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13378 | void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13379 | { |
| 13380 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 13381 | { |
| 13382 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13383 | csrRoamStop(pMac, sessionId); |
| 13384 | csrFreeConnectBssDesc(pMac, sessionId); |
| 13385 | csrRoamFreeConnectProfile( pMac, &pSession->connectedProfile ); |
| 13386 | csrRoamFreeConnectedInfo ( pMac, &pSession->connectedInfo); |
| 13387 | palTimerFree(pMac->hHdd, pSession->hTimerRoaming); |
| 13388 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 13389 | palTimerFree(pMac->hHdd, pSession->hTimerJoinRetry); |
| 13390 | #endif |
| 13391 | palTimerFree(pMac->hHdd, pSession->hTimerIbssJoining); |
| 13392 | purgeSmeSessionCmdList(pMac, sessionId); |
| 13393 | purgeCsrSessionCmdList(pMac, sessionId); |
| 13394 | csrInitSession(pMac, sessionId); |
| 13395 | } |
| 13396 | } |
| 13397 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13398 | eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13399 | tANI_BOOLEAN fSync, |
| 13400 | csrRoamSessionCloseCallback callback, |
| 13401 | void *pContext ) |
| 13402 | { |
| 13403 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13404 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 13405 | { |
| 13406 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13407 | if(fSync) |
| 13408 | { |
| 13409 | csrCleanupSession(pMac, sessionId); |
| 13410 | } |
| 13411 | else |
| 13412 | { |
| 13413 | purgeSmeSessionCmdList(pMac, sessionId); |
| 13414 | purgeCsrSessionCmdList(pMac, sessionId); |
| 13415 | status = csrIssueDelStaForSessionReq( pMac, sessionId, |
| 13416 | pSession->selfMacAddr, callback, pContext); |
| 13417 | } |
| 13418 | } |
| 13419 | else |
| 13420 | { |
| 13421 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 13422 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13423 | return ( status ); |
| 13424 | } |
| 13425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13426 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 13427 | { |
| 13428 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13429 | |
| 13430 | if(!pSession) |
| 13431 | { |
| 13432 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13433 | return; |
| 13434 | } |
| 13435 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13436 | pSession->sessionActive = eANI_BOOLEAN_FALSE; |
| 13437 | pSession->sessionId = CSR_SESSION_ID_INVALID; |
| 13438 | pSession->callback = NULL; |
| 13439 | pSession->pContext = NULL; |
| 13440 | pSession->ibss_join_pending = FALSE; |
| 13441 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 13442 | // TODO : Confirm pMac->roam.fReadyForPowerSave = eANI_BOOLEAN_FALSE; |
| 13443 | csrFreeRoamProfile( pMac, sessionId ); |
| 13444 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 13445 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 13446 | csrFreeConnectBssDesc(pMac, sessionId); |
| 13447 | csrScanEnable(pMac); |
| 13448 | palZeroMemory( pMac->hHdd, &pSession->selfMacAddr, sizeof(tCsrBssid) ); |
| 13449 | if(pSession->pWpaRsnReqIE) |
| 13450 | { |
| 13451 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 13452 | pSession->pWpaRsnReqIE = NULL; |
| 13453 | } |
| 13454 | pSession->nWpaRsnReqIeLength = 0; |
| 13455 | if(pSession->pWpaRsnRspIE) |
| 13456 | { |
| 13457 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE); |
| 13458 | pSession->pWpaRsnRspIE = NULL; |
| 13459 | } |
| 13460 | pSession->nWpaRsnRspIeLength = 0; |
| 13461 | #ifdef FEATURE_WLAN_WAPI |
| 13462 | if(pSession->pWapiReqIE) |
| 13463 | { |
| 13464 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 13465 | pSession->pWapiReqIE = NULL; |
| 13466 | } |
| 13467 | pSession->nWapiReqIeLength = 0; |
| 13468 | if(pSession->pWapiRspIE) |
| 13469 | { |
| 13470 | palFreeMemory(pMac->hHdd, pSession->pWapiRspIE); |
| 13471 | pSession->pWapiRspIE = NULL; |
| 13472 | } |
| 13473 | pSession->nWapiRspIeLength = 0; |
| 13474 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13475 | if(pSession->pAddIEScan) |
| 13476 | { |
| 13477 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 13478 | pSession->pAddIEScan = NULL; |
| 13479 | } |
| 13480 | pSession->nAddIEScanLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13481 | if(pSession->pAddIEAssoc) |
| 13482 | { |
| 13483 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 13484 | pSession->pAddIEAssoc = NULL; |
| 13485 | } |
| 13486 | pSession->nAddIEAssocLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13487 | } |
| 13488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13489 | eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId ) |
| 13490 | { |
| 13491 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13492 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13493 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13494 | { |
| 13495 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13496 | { |
| 13497 | if( csrIsMacAddressEqual( pMac, bssid, &pMac->roam.roamSession[i].connectedProfile.bssid ) ) |
| 13498 | { |
| 13499 | //Found it |
| 13500 | status = eHAL_STATUS_SUCCESS; |
| 13501 | *pSessionId = i; |
| 13502 | break; |
| 13503 | } |
| 13504 | } |
| 13505 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13506 | return( status ); |
| 13507 | } |
| 13508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13509 | //This function assumes that we only support one IBSS session. We cannot use BSSID to identify |
| 13510 | //session because for IBSS, the bssid changes. |
| 13511 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ) |
| 13512 | { |
| 13513 | tANI_U32 i, nRet = CSR_SESSION_ID_INVALID; |
| 13514 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13515 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13516 | { |
| 13517 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13518 | { |
| 13519 | pSession = CSR_GET_SESSION( pMac, i ); |
| 13520 | if( pSession->pCurRoamProfile && ( csrIsBssTypeIBSS( pSession->connectedProfile.BSSType ) ) ) |
| 13521 | { |
| 13522 | //Found it |
| 13523 | nRet = i; |
| 13524 | break; |
| 13525 | } |
| 13526 | } |
| 13527 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13528 | return (nRet); |
| 13529 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13530 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid) |
| 13531 | { |
| 13532 | /* Update the current BSS info in ho control block based on connected |
| 13533 | profile info from pmac global structure */ |
| 13534 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13535 | smsLog(pMac, LOGW, " csrRoamLinkUp: WLAN link UP with AP= %02x-%02x-%02x-%02x-%02x-%02x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13536 | bssid[ 0 ], bssid[ 1 ], bssid[ 2 ], |
| 13537 | bssid[ 3 ], bssid[ 4 ], bssid[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13538 | /* Check for user misconfig of RSSI trigger threshold */ |
| 13539 | pMac->roam.configParam.vccRssiThreshold = |
| 13540 | ( 0 == pMac->roam.configParam.vccRssiThreshold ) ? |
| 13541 | CSR_VCC_RSSI_THRESHOLD : pMac->roam.configParam.vccRssiThreshold; |
| 13542 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13543 | /* Check for user misconfig of UL MAC Loss trigger threshold */ |
| 13544 | pMac->roam.configParam.vccUlMacLossThreshold = |
| 13545 | ( 0 == pMac->roam.configParam.vccUlMacLossThreshold ) ? |
| 13546 | CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13547 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 13548 | { |
| 13549 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13550 | /* Indicate the neighbor roal algorithm about the connect indication */ |
| 13551 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId); |
| 13552 | csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS); |
| 13553 | } |
| 13554 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13555 | } |
| 13556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13557 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13558 | { |
| 13559 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13560 | |
| 13561 | if(!pSession) |
| 13562 | { |
| 13563 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13564 | return; |
| 13565 | } |
| 13566 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13567 | //Only to handle the case for Handover on infra link |
| 13568 | if( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 13569 | { |
| 13570 | return; |
| 13571 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13572 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 13573 | csrRoamDeregStatisticsReq(pMac); |
| 13574 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 13575 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 13576 | /* Indicate the neighbor roal algorithm about the disconnect indication */ |
| 13577 | csrNeighborRoamIndicateDisconnect(pMac, sessionId); |
| 13578 | #endif |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 13579 | |
| 13580 | //Remove this code once SLM_Sessionization is supported |
| 13581 | //BMPS_WORKAROUND_NOT_NEEDED |
| 13582 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 13583 | csrIsInfraApStarted( pMac ) && |
| 13584 | pMac->roam.configParam.doBMPSWorkaround) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13585 | { |
| 13586 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 13587 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13588 | } |
| 13589 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13590 | void csrRoamTlStatsTimerHandler(void *pv) |
| 13591 | { |
| 13592 | tpAniSirGlobal pMac = PMAC_STRUCT( pv ); |
| 13593 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13594 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 13595 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13596 | smsLog(pMac, LOG1, FL(" TL stat timer is no-op. It needs to support multiple stations")); |
| 13597 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13598 | #if 0 |
| 13599 | // TODO Persession .??? |
| 13600 | //req TL for stats |
| 13601 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId)) |
| 13602 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13603 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:couldn't get the stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13604 | } |
| 13605 | else |
| 13606 | { |
| 13607 | //save in SME |
| 13608 | csrRoamSaveStatsFromTl(pMac, tlStats); |
| 13609 | } |
| 13610 | #endif |
| 13611 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 13612 | { |
| 13613 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 13614 | { |
| 13615 | //start timer |
| 13616 | status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 13617 | pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE); |
| 13618 | if(!HAL_STATUS_SUCCESS(status)) |
| 13619 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13620 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13621 | return; |
| 13622 | } |
| 13623 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 13624 | } |
| 13625 | } |
| 13626 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13627 | void csrRoamPeStatsTimerHandler(void *pv) |
| 13628 | { |
| 13629 | tCsrPeStatsReqInfo *pPeStatsReqListEntry = (tCsrPeStatsReqInfo *)pv; |
| 13630 | eHalStatus status; |
| 13631 | tpAniSirGlobal pMac = pPeStatsReqListEntry->pMac; |
| 13632 | VOS_STATUS vosStatus; |
| 13633 | tPmcPowerState powerState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13634 | pPeStatsReqListEntry->timerRunning = FALSE; |
| 13635 | if( pPeStatsReqListEntry->timerStopFailed == TRUE ) |
| 13636 | { |
| 13637 | // If we entered here, meaning the timer could not be successfully |
| 13638 | // stopped in csrRoamRemoveEntryFromPeStatsReqList(). So do it here. |
| 13639 | |
| 13640 | /* Destroy the timer */ |
| 13641 | vosStatus = vos_timer_destroy( &pPeStatsReqListEntry->hPeStatsTimer ); |
| 13642 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13643 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13644 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13645 | } |
| 13646 | |
| 13647 | // Free the entry |
| 13648 | palFreeMemory(pMac->hHdd, pPeStatsReqListEntry); |
| 13649 | pPeStatsReqListEntry = NULL; |
| 13650 | } |
| 13651 | else |
| 13652 | { |
| 13653 | if(!pPeStatsReqListEntry->rspPending) |
| 13654 | { |
| 13655 | status = csrSendMBStatsReqMsg(pMac, pPeStatsReqListEntry->statsMask & ~(1 << eCsrGlobalClassDStats), |
| 13656 | pPeStatsReqListEntry->staId); |
| 13657 | if(!HAL_STATUS_SUCCESS(status)) |
| 13658 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13659 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to send down stats req to PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13660 | } |
| 13661 | else |
| 13662 | { |
| 13663 | pPeStatsReqListEntry->rspPending = TRUE; |
| 13664 | } |
| 13665 | } |
| 13666 | |
| 13667 | //send down a req |
| 13668 | if(pPeStatsReqListEntry->periodicity && |
| 13669 | (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pPeStatsReqListEntry->hPeStatsTimer))) |
| 13670 | { |
| 13671 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 13672 | if(ePMC_FULL_POWER == powerState) |
| 13673 | { |
| 13674 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 13675 | { |
| 13676 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 13677 | } |
| 13678 | } |
| 13679 | else |
| 13680 | { |
| 13681 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 13682 | { |
| 13683 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 13684 | } |
| 13685 | } |
| 13686 | //start timer |
| 13687 | vosStatus = vos_timer_start( &pPeStatsReqListEntry->hPeStatsTimer, pPeStatsReqListEntry->periodicity ); |
| 13688 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13689 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13690 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13691 | return; |
| 13692 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13693 | pPeStatsReqListEntry->timerRunning = TRUE; |
| 13694 | |
| 13695 | } |
| 13696 | |
| 13697 | } |
| 13698 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13699 | void csrRoamStatsClientTimerHandler(void *pv) |
| 13700 | { |
| 13701 | tCsrStatsClientReqInfo *pStaEntry = (tCsrStatsClientReqInfo *)pv; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13702 | if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pStaEntry->timer)) |
| 13703 | { |
| 13704 | #if 0 |
| 13705 | // TODO Stats fix for multisession |
| 13706 | //start the timer |
| 13707 | vosStatus = vos_timer_start( &pStaEntry->timer, pStaEntry->periodicity ); |
| 13708 | |
| 13709 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13710 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13711 | smsLog(pStaEntry->pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13712 | } |
| 13713 | #endif |
| 13714 | } |
| 13715 | #if 0 |
| 13716 | //send up the stats report |
| 13717 | csrRoamReportStatistics(pStaEntry->pMac, pStaEntry->statsMask, pStaEntry->callback, |
| 13718 | pStaEntry->staId, pStaEntry->pContext); |
| 13719 | #endif |
| 13720 | } |
| 13721 | |
| 13722 | |
| 13723 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13724 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId) |
| 13725 | { |
| 13726 | tAniGetPEStatsReq *pMsg; |
| 13727 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13728 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetPEStatsReq)); |
| 13729 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 13730 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13731 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to allocate mem for stats req "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13732 | return status; |
| 13733 | } |
| 13734 | // need to initiate a stats request to PE |
| 13735 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_STATISTICS_REQ); |
| 13736 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq); |
| 13737 | pMsg->staId = staId; |
| 13738 | pMsg->statsMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13739 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13740 | if(!HAL_STATUS_SUCCESS(status)) |
| 13741 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13742 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to send down the stats req "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13743 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13744 | return status; |
| 13745 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13746 | void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg) |
| 13747 | { |
| 13748 | tAniGetPEStatsRsp *pSmeStatsRsp; |
| 13749 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13750 | tListElem *pEntry = NULL; |
| 13751 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 13752 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 13753 | tANI_U32 tempMask = 0; |
| 13754 | tANI_U8 counter = 0; |
| 13755 | tANI_U8 *pStats = NULL; |
| 13756 | tANI_U32 length = 0; |
| 13757 | v_PVOID_t pvosGCtx; |
| 13758 | v_S7_t rssi = 0; |
| 13759 | tANI_U32 *pRssi = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13760 | pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg; |
| 13761 | if(pSmeStatsRsp->rc) |
| 13762 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13763 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:stats rsp from PE shows failure")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13764 | goto post_update; |
| 13765 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13766 | tempMask = pSmeStatsRsp->statsMask; |
| 13767 | pStats = ((tANI_U8 *)&pSmeStatsRsp->statsMask) + sizeof(pSmeStatsRsp->statsMask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13768 | /* subtract all statistics from this length, and after processing the entire |
| 13769 | * 'stat' part of the message, if the length is not zero, then rssi is piggy packed |
| 13770 | * in this 'stats' message. |
| 13771 | */ |
| 13772 | length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13773 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 13774 | while(tempMask) |
| 13775 | { |
| 13776 | if(tempMask & 1) |
| 13777 | { |
| 13778 | switch(counter) |
| 13779 | { |
| 13780 | case eCsrSummaryStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13781 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13782 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 13783 | pStats, sizeof(tCsrSummaryStatsInfo)); |
| 13784 | if(!HAL_STATUS_SUCCESS(status)) |
| 13785 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13786 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13787 | } |
| 13788 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 13789 | length -= sizeof(tCsrSummaryStatsInfo); |
| 13790 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13791 | case eCsrGlobalClassAStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13792 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13793 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 13794 | pStats, sizeof(tCsrGlobalClassAStatsInfo)); |
| 13795 | if(!HAL_STATUS_SUCCESS(status)) |
| 13796 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13797 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13798 | } |
| 13799 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
| 13800 | length -= sizeof(tCsrGlobalClassAStatsInfo); |
| 13801 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13802 | case eCsrGlobalClassBStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13803 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13804 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 13805 | pStats, sizeof(tCsrGlobalClassBStatsInfo)); |
| 13806 | if(!HAL_STATUS_SUCCESS(status)) |
| 13807 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13808 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13809 | } |
| 13810 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
| 13811 | length -= sizeof(tCsrGlobalClassBStatsInfo); |
| 13812 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13813 | case eCsrGlobalClassCStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13814 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13815 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 13816 | pStats, sizeof(tCsrGlobalClassCStatsInfo)); |
| 13817 | if(!HAL_STATUS_SUCCESS(status)) |
| 13818 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13819 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13820 | } |
| 13821 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
| 13822 | length -= sizeof(tCsrGlobalClassCStatsInfo); |
| 13823 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13824 | case eCsrPerStaStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13825 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13826 | if( CSR_MAX_STA > pSmeStatsRsp->staId ) |
| 13827 | { |
| 13828 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId], |
| 13829 | pStats, sizeof(tCsrPerStaStatsInfo)); |
| 13830 | } |
| 13831 | else |
| 13832 | { |
| 13833 | status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13834 | smsLog( pMac, LOGE, FL("csrRoamStatsRspProcessor:out bound staId:%d"), pSmeStatsRsp->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13835 | VOS_ASSERT( 0 ); |
| 13836 | } |
| 13837 | if(!HAL_STATUS_SUCCESS(status)) |
| 13838 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13839 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13840 | } |
| 13841 | pStats += sizeof(tCsrPerStaStatsInfo); |
| 13842 | length -= sizeof(tCsrPerStaStatsInfo); |
| 13843 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13844 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13845 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13846 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13847 | } |
| 13848 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13849 | tempMask >>=1; |
| 13850 | counter++; |
| 13851 | } |
| 13852 | pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 13853 | if (length != 0) |
| 13854 | { |
| 13855 | pRssi = (tANI_U32*)pStats; |
| 13856 | rssi = (v_S7_t)*pRssi; |
| 13857 | } |
| 13858 | else |
| 13859 | { |
| 13860 | /* If riva is not sending rssi, continue to use the hack */ |
| 13861 | rssi = RSSI_HACK_BMPS; |
| 13862 | } |
| 13863 | WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13864 | post_update: |
| 13865 | //make sure to update the pe stats req list |
| 13866 | pEntry = csrRoamFindInPeStatsReqList(pMac, pSmeStatsRsp->statsMask); |
| 13867 | if(pEntry) |
| 13868 | { |
| 13869 | pPeStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
| 13870 | pPeStaEntry->rspPending = FALSE; |
| 13871 | |
| 13872 | } |
| 13873 | //check the one timer cases |
| 13874 | pEntry = csrRoamCheckClientReqList(pMac, pSmeStatsRsp->statsMask); |
| 13875 | if(pEntry) |
| 13876 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13877 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13878 | if(pTempStaEntry->timerExpired) |
| 13879 | { |
| 13880 | //send up the stats report |
| 13881 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 13882 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 13883 | //also remove from the client list |
| 13884 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 13885 | pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13886 | } |
| 13887 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13888 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13889 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 13890 | { |
| 13891 | tListElem *pEntry = NULL; |
| 13892 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13893 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13894 | if(!pEntry) |
| 13895 | { |
| 13896 | //list empty |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13897 | smsLog(pMac, LOG2, "csrRoamFindInPeStatsReqList: List empty, no request to PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13898 | return NULL; |
| 13899 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13900 | while( pEntry ) |
| 13901 | { |
| 13902 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13903 | if(pTempStaEntry->statsMask == statsMask) |
| 13904 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13905 | smsLog(pMac, LOG3, "csrRoamFindInPeStatsReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13906 | break; |
| 13907 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13908 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13909 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13910 | return pEntry; |
| 13911 | } |
| 13912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13913 | tListElem * csrRoamChecknUpdateClientReqList(tpAniSirGlobal pMac, tCsrStatsClientReqInfo *pStaEntry, |
| 13914 | tANI_BOOLEAN update) |
| 13915 | { |
| 13916 | tListElem *pEntry; |
| 13917 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13918 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13919 | if(!pEntry) |
| 13920 | { |
| 13921 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13922 | smsLog(pMac, LOG2, "csrRoamChecknUpdateClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13923 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13924 | return NULL; |
| 13925 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13926 | while( pEntry ) |
| 13927 | { |
| 13928 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13929 | if((pTempStaEntry->requesterId == pStaEntry->requesterId) && |
| 13930 | (pTempStaEntry->statsMask == pStaEntry->statsMask)) |
| 13931 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13932 | smsLog(pMac, LOG3, "csrRoamChecknUpdateClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13933 | if(update) |
| 13934 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13935 | pTempStaEntry->periodicity = pStaEntry->periodicity; |
| 13936 | pTempStaEntry->callback = pStaEntry->callback; |
| 13937 | pTempStaEntry->pContext = pStaEntry->pContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13938 | } |
| 13939 | break; |
| 13940 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13941 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13942 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13943 | return pEntry; |
| 13944 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13945 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 13946 | { |
| 13947 | tListElem *pEntry; |
| 13948 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13949 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13950 | if(!pEntry) |
| 13951 | { |
| 13952 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13953 | smsLog(pMac, LOG2, "csrRoamCheckClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13954 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13955 | return NULL; |
| 13956 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13957 | while( pEntry ) |
| 13958 | { |
| 13959 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13960 | if((pTempStaEntry->statsMask & ~(1 << eCsrGlobalClassDStats)) == statsMask) |
| 13961 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13962 | smsLog(pMac, LOG3, "csrRoamCheckClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13963 | break; |
| 13964 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13965 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13966 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13967 | return pEntry; |
| 13968 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13969 | eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac, |
| 13970 | csrRoamLinkQualityIndCallback callback, |
| 13971 | void *pContext) |
| 13972 | { |
| 13973 | pMac->roam.linkQualityIndInfo.callback = callback; |
| 13974 | pMac->roam.linkQualityIndInfo.context = pContext; |
| 13975 | if( NULL == callback ) |
| 13976 | { |
| 13977 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being deregistered"); |
| 13978 | } |
| 13979 | else |
| 13980 | { |
| 13981 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being registered"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13982 | /* do we need to invoke the callback to notify client of initial value ?? */ |
| 13983 | } |
| 13984 | return eHAL_STATUS_SUCCESS; |
| 13985 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13986 | void csrRoamVccTrigger(tpAniSirGlobal pMac) |
| 13987 | { |
| 13988 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 13989 | tANI_U32 ul_mac_loss = 0; |
| 13990 | tANI_U32 ul_mac_loss_trigger_threshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13991 | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 13992 | /*------------------------------------------------------------------------- |
| 13993 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13994 | Check for a change in link quality and notify client if necessary |
| 13995 | -------------------------------------------------------------------------*/ |
| 13996 | ul_mac_loss_trigger_threshold = |
| 13997 | pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13998 | VOS_ASSERT( ul_mac_loss_trigger_threshold != 0 ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13999 | smsLog(pMac, LOGW, "csrRoamVccTrigger: UL_MAC_LOSS_THRESHOLD is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14000 | ul_mac_loss_trigger_threshold ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14001 | if(ul_mac_loss_trigger_threshold < ul_mac_loss) |
| 14002 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14003 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is POOR "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14004 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 14005 | } |
| 14006 | else |
| 14007 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14008 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is GOOD"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14009 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 14010 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14011 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link qual : *** UL_MAC_LOSS %d *** ", |
| 14012 | ul_mac_loss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14013 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 14014 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14015 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14016 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 14017 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14018 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14019 | newVccLinkQuality ); |
| 14020 | |
| 14021 | /* we now invoke the callback once to notify client of initial value */ |
| 14022 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 14023 | pMac->roam.linkQualityIndInfo.context ); |
| 14024 | //event: EVENT_WLAN_VCC |
| 14025 | } |
| 14026 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14027 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
| 14028 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14029 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14030 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 14031 | v_U8_t rssiNotification, |
| 14032 | void * context) |
| 14033 | { |
| 14034 | tpAniSirGlobal pMac = PMAC_STRUCT( context ); |
| 14035 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 14036 | // TODO : Session info unavailable |
| 14037 | tANI_U32 sessionId = 0; |
| 14038 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 14039 | /*------------------------------------------------------------------------- |
| 14040 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14041 | Check for a change in link quality and notify client if necessary |
| 14042 | -------------------------------------------------------------------------*/ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14043 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: RSSI trigger threshold is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14044 | pMac->roam.configParam.vccRssiThreshold); |
| 14045 | if(!csrIsConnStateConnectedInfra(pMac, sessionId)) |
| 14046 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14047 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: ignoring the indication as we are not connected"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14048 | return VOS_STATUS_SUCCESS; |
| 14049 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14050 | if(WLANTL_HO_THRESHOLD_DOWN == rssiNotification) |
| 14051 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14052 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is POOR"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14053 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 14054 | } |
| 14055 | else if(WLANTL_HO_THRESHOLD_UP == rssiNotification) |
| 14056 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14057 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is GOOD "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14058 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 14059 | } |
| 14060 | else |
| 14061 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14062 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: unknown rssi notification %d", rssiNotification); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14063 | //Set to this so the code below won't do anything |
| 14064 | newVccLinkQuality = pMac->roam.vccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14065 | VOS_ASSERT(0); |
| 14066 | } |
| 14067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14068 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 14069 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14070 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14071 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 14072 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14073 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14074 | newVccLinkQuality); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14075 | /* we now invoke the callback once to notify client of initial value */ |
| 14076 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 14077 | pMac->roam.linkQualityIndInfo.context ); |
| 14078 | //event: EVENT_WLAN_VCC |
| 14079 | } |
| 14080 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14081 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14082 | return status; |
| 14083 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14084 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 14085 | tDblLinkList *pStaList, |
| 14086 | tCsrStatsClientReqInfo *pStaEntry) |
| 14087 | { |
| 14088 | tCsrStatsClientReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14089 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14090 | //if same entity requested for same set of stats with different periodicity & |
| 14091 | // callback update it |
| 14092 | if(NULL == csrRoamChecknUpdateClientReqList(pMac, pStaEntry, TRUE)) |
| 14093 | { |
| 14094 | |
| 14095 | status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrStatsClientReqInfo)); |
| 14096 | if (!HAL_STATUS_SUCCESS(status)) |
| 14097 | { |
| 14098 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14099 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14100 | return NULL; |
| 14101 | } |
| 14102 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14103 | pNewStaEntry->callback = pStaEntry->callback; |
| 14104 | pNewStaEntry->pContext = pStaEntry->pContext; |
| 14105 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 14106 | pNewStaEntry->requesterId = pStaEntry->requesterId; |
| 14107 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 14108 | pNewStaEntry->pPeStaEntry = pStaEntry->pPeStaEntry; |
| 14109 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 14110 | pNewStaEntry->staId = pStaEntry->staId; |
| 14111 | pNewStaEntry->timerExpired = pStaEntry->timerExpired; |
| 14112 | |
| 14113 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
| 14114 | } |
| 14115 | return pNewStaEntry; |
| 14116 | } |
| 14117 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14118 | tCsrPeStatsReqInfo * csrRoamInsertEntryIntoPeStatsReqList( tpAniSirGlobal pMac, |
| 14119 | tDblLinkList *pStaList, |
| 14120 | tCsrPeStatsReqInfo *pStaEntry) |
| 14121 | { |
| 14122 | tCsrPeStatsReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14123 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14124 | status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrPeStatsReqInfo)); |
| 14125 | if (!HAL_STATUS_SUCCESS(status)) |
| 14126 | { |
| 14127 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoPeStatsReqList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14128 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14129 | return NULL; |
| 14130 | } |
| 14131 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14132 | pNewStaEntry->hPeStatsTimer = pStaEntry->hPeStatsTimer; |
| 14133 | pNewStaEntry->numClient = pStaEntry->numClient; |
| 14134 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 14135 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 14136 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 14137 | pNewStaEntry->staId = pStaEntry->staId; |
| 14138 | pNewStaEntry->timerRunning = pStaEntry->timerRunning; |
| 14139 | pNewStaEntry->rspPending = pStaEntry->rspPending; |
| 14140 | |
| 14141 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14142 | return pNewStaEntry; |
| 14143 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14144 | eHalStatus csrGetRssi(tpAniSirGlobal pMac, |
| 14145 | tCsrRssiCallback callback, |
| 14146 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 14147 | { |
| 14148 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14149 | vos_msg_t msg; |
| 14150 | tANI_U32 sessionId; |
| 14151 | |
| 14152 | tAniGetRssiReq *pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14153 | smsLog(pMac, LOG2, FL("called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14154 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetRssiReq)); |
| 14155 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 14156 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14157 | smsLog(pMac, LOGE, " csrGetRssi: failed to allocate mem for req "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14158 | return status; |
| 14159 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14160 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 14161 | |
| 14162 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_RSSI_REQ); |
| 14163 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 14164 | pMsg->sessionId = sessionId; |
| 14165 | pMsg->staId = staId; |
| 14166 | pMsg->rssiCallback = callback; |
| 14167 | pMsg->pDevContext = pContext; |
| 14168 | pMsg->pVosContext = pVosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14169 | msg.type = eWNI_SME_GET_RSSI_REQ; |
| 14170 | msg.bodyptr = pMsg; |
| 14171 | msg.reserved = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14172 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 14173 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14174 | smsLog(pMac, LOGE, " csrGetRssi failed to post msg to self "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14175 | palFreeMemory(pMac->hHdd, (void *)pMsg); |
| 14176 | status = eHAL_STATUS_FAILURE; |
| 14177 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14178 | smsLog(pMac, LOG2, FL("returned")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14179 | return status; |
| 14180 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 14181 | |
| 14182 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 14183 | eHalStatus csrGetRoamRssi(tpAniSirGlobal pMac, |
| 14184 | tCsrRssiCallback callback, |
| 14185 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 14186 | { |
| 14187 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14188 | tAniGetRssiReq *pMsg; |
| 14189 | |
| 14190 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetRssiReq)); |
| 14191 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 14192 | { |
| 14193 | smsLog(pMac, LOGE, " csrGetRoamRssi: failed to allocate mem for req"); |
| 14194 | return status; |
| 14195 | } |
| 14196 | // need to initiate a stats request to PE |
| 14197 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_ROAM_RSSI_REQ); |
| 14198 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 14199 | pMsg->staId = staId; |
| 14200 | pMsg->rssiCallback = callback; |
| 14201 | pMsg->pDevContext = pContext; |
| 14202 | pMsg->pVosContext = pVosContext; |
| 14203 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 14204 | if(!HAL_STATUS_SUCCESS(status)) |
| 14205 | { |
Tushnim Bhattacharyya | 41f7286 | 2013-04-03 21:34:01 -0700 | [diff] [blame] | 14206 | smsLog(pMac, LOG1, " csrGetRoamRssi: failed to send down the rssi req"); |
| 14207 | //pMsg is freed by palSendMBMessage |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 14208 | status = eHAL_STATUS_FAILURE; |
| 14209 | } |
| 14210 | return status; |
| 14211 | } |
| 14212 | #endif |
| 14213 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14214 | eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, |
| 14215 | tANI_U32 statsMask, |
| 14216 | tCsrStatsCallback callback, |
| 14217 | tANI_U32 periodicity, tANI_BOOLEAN cache, |
| 14218 | tANI_U8 staId, void *pContext) |
| 14219 | { |
| 14220 | tCsrStatsClientReqInfo staEntry; |
| 14221 | tCsrStatsClientReqInfo *pStaEntry = NULL; |
| 14222 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 14223 | tListElem *pEntry = NULL; |
| 14224 | tANI_BOOLEAN found = FALSE; |
| 14225 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14226 | tANI_BOOLEAN insertInClientList = FALSE; |
| 14227 | VOS_STATUS vosStatus; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14228 | WLANTL_TRANSFER_STA_TYPE *pTlStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14229 | |
| 14230 | if( csrIsAllSessionDisconnected(pMac) ) |
| 14231 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14232 | //smsLog(pMac, LOGW, "csrGetStatistics: wrong state curState(%d) not connected", pMac->roam.curState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14233 | return eHAL_STATUS_FAILURE; |
| 14234 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14235 | if((!statsMask) && (!callback)) |
| 14236 | { |
| 14237 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14238 | smsLog(pMac, LOGW, "csrGetStatistics: statsMask & callback empty in the request"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14239 | return eHAL_STATUS_FAILURE; |
| 14240 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14241 | //for the search list method for deregister |
| 14242 | staEntry.requesterId = requesterId; |
| 14243 | staEntry.statsMask = statsMask; |
| 14244 | //requester wants to deregister or just an error |
| 14245 | if((statsMask) && (!callback)) |
| 14246 | { |
| 14247 | pEntry = csrRoamChecknUpdateClientReqList(pMac, &staEntry, FALSE); |
| 14248 | if(!pEntry) |
| 14249 | { |
| 14250 | //msg |
| 14251 | smsLog(pMac, LOGW, "csrGetStatistics: callback is empty in the request & couldn't " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14252 | "find any existing request in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14253 | return eHAL_STATUS_FAILURE; |
| 14254 | } |
| 14255 | else |
| 14256 | { |
| 14257 | //clean up & return |
| 14258 | pStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 14259 | if(NULL != pStaEntry->pPeStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14260 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14261 | pStaEntry->pPeStaEntry->numClient--; |
| 14262 | //check if we need to delete the entry from peStatsReqList too |
| 14263 | if(!pStaEntry->pPeStaEntry->numClient) |
| 14264 | { |
| 14265 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pStaEntry->pPeStaEntry); |
| 14266 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14267 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 14268 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14269 | //check if we need to stop the tl stats timer too |
| 14270 | pMac->roam.tlStatsReqInfo.numClient--; |
| 14271 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 14272 | { |
| 14273 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 14274 | { |
| 14275 | status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 14276 | if(!HAL_STATUS_SUCCESS(status)) |
| 14277 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14278 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14279 | return eHAL_STATUS_FAILURE; |
| 14280 | } |
| 14281 | } |
| 14282 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 14283 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 14284 | } |
| 14285 | vos_timer_stop( &pStaEntry->timer ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14286 | // Destroy the vos timer... |
| 14287 | vosStatus = vos_timer_destroy( &pStaEntry->timer ); |
| 14288 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14289 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14290 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14291 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14292 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 14293 | pStaEntry = NULL; |
| 14294 | return eHAL_STATUS_SUCCESS; |
| 14295 | } |
| 14296 | } |
| 14297 | |
| 14298 | if(cache && !periodicity) |
| 14299 | { |
| 14300 | //return the cached stats |
| 14301 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 14302 | } |
| 14303 | else |
| 14304 | { |
| 14305 | //add the request in the client req list |
| 14306 | staEntry.callback = callback; |
| 14307 | staEntry.pContext = pContext; |
| 14308 | staEntry.periodicity = periodicity; |
| 14309 | staEntry.pPeStaEntry = NULL; |
| 14310 | staEntry.staId = staId; |
| 14311 | staEntry.pMac = pMac; |
| 14312 | staEntry.timerExpired = FALSE; |
| 14313 | |
| 14314 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14315 | //if periodic report requested with non cached result from PE/TL |
| 14316 | if(periodicity) |
| 14317 | { |
| 14318 | |
| 14319 | //if looking for stats from PE |
| 14320 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 14321 | { |
| 14322 | |
| 14323 | //check if same request made already & waiting for rsp |
| 14324 | pPeStaEntry = csrRoamCheckPeStatsReqList(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), |
| 14325 | periodicity, &found, staId); |
| 14326 | if(!pPeStaEntry) |
| 14327 | { |
| 14328 | //bail out, maxed out on number of req for PE |
| 14329 | return eHAL_STATUS_FAILURE; |
| 14330 | } |
| 14331 | else |
| 14332 | { |
| 14333 | staEntry.pPeStaEntry = pPeStaEntry; |
| 14334 | } |
| 14335 | |
| 14336 | } |
| 14337 | //request stats from TL rightaway if requested by client, update tlStatsReqInfo if needed |
| 14338 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 14339 | { |
| 14340 | if(cache && pMac->roam.tlStatsReqInfo.numClient) |
| 14341 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14342 | smsLog(pMac, LOGE, FL("csrGetStatistics:Looking for cached stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14343 | } |
| 14344 | else |
| 14345 | { |
| 14346 | |
| 14347 | //update periodicity |
| 14348 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 14349 | { |
| 14350 | pMac->roam.tlStatsReqInfo.periodicity = |
| 14351 | CSR_ROAM_MIN(periodicity, pMac->roam.tlStatsReqInfo.periodicity); |
| 14352 | } |
| 14353 | else |
| 14354 | { |
| 14355 | pMac->roam.tlStatsReqInfo.periodicity = periodicity; |
| 14356 | } |
| 14357 | if(pMac->roam.tlStatsReqInfo.periodicity < CSR_MIN_TL_STAT_QUERY_PERIOD) |
| 14358 | { |
| 14359 | pMac->roam.tlStatsReqInfo.periodicity = CSR_MIN_TL_STAT_QUERY_PERIOD; |
| 14360 | } |
| 14361 | |
| 14362 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 14363 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14364 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 14365 | if(NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14366 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14367 | //req TL for class D stats |
| 14368 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId)) |
| 14369 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14370 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14371 | } |
| 14372 | else |
| 14373 | { |
| 14374 | //save in SME |
| 14375 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 14376 | } |
| 14377 | vos_mem_free(pTlStats); |
| 14378 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14379 | } |
| 14380 | else |
| 14381 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14382 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14383 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14384 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14385 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 14386 | { |
| 14387 | //start timer |
| 14388 | status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 14389 | pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE); |
| 14390 | if(!HAL_STATUS_SUCCESS(status)) |
| 14391 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14392 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14393 | return eHAL_STATUS_FAILURE; |
| 14394 | } |
| 14395 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 14396 | } |
| 14397 | } |
| 14398 | } |
| 14399 | pMac->roam.tlStatsReqInfo.numClient++; |
| 14400 | } |
| 14401 | |
| 14402 | insertInClientList = TRUE; |
| 14403 | } |
| 14404 | //if one time report requested with non cached result from PE/TL |
| 14405 | else if(!cache && !periodicity) |
| 14406 | { |
| 14407 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 14408 | { |
| 14409 | //send down a req |
| 14410 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 14411 | if(!HAL_STATUS_SUCCESS(status)) |
| 14412 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14413 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to send down stats req to PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14414 | } |
| 14415 | //so that when the stats rsp comes back from PE we respond to upper layer |
| 14416 | //right away |
| 14417 | staEntry.timerExpired = TRUE; |
| 14418 | insertInClientList = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14419 | } |
| 14420 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 14421 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14422 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 14423 | if(NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14424 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14425 | //req TL for class D stats |
| 14426 | if(!VOS_IS_STATUS_SUCCESS(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId))) |
| 14427 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14428 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14429 | } |
| 14430 | else |
| 14431 | { |
| 14432 | //save in SME |
| 14433 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 14434 | } |
| 14435 | vos_mem_free(pTlStats); |
| 14436 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14437 | } |
| 14438 | else |
| 14439 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14440 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14441 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14442 | |
| 14443 | } |
| 14444 | //if looking for stats from TL only |
| 14445 | if(!insertInClientList) |
| 14446 | { |
| 14447 | //return the stats |
| 14448 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 14449 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14450 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14451 | if(insertInClientList) |
| 14452 | { |
| 14453 | pStaEntry = csrRoamInsertEntryIntoList(pMac, &pMac->roam.statsClientReqList, &staEntry); |
| 14454 | if(!pStaEntry) |
| 14455 | { |
| 14456 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14457 | smsLog(pMac, LOGW, "csrGetStatistics: Failed to insert req in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14458 | return eHAL_STATUS_FAILURE; |
| 14459 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14460 | pStaEntry->periodicity = periodicity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14461 | //Init & start timer if needed |
| 14462 | if(periodicity) |
| 14463 | { |
| 14464 | vosStatus = vos_timer_init( &pStaEntry->timer, VOS_TIMER_TYPE_SW, |
| 14465 | csrRoamStatsClientTimerHandler, pStaEntry ); |
| 14466 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14467 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14468 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot init StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14469 | return eHAL_STATUS_FAILURE; |
| 14470 | } |
| 14471 | vosStatus = vos_timer_start( &pStaEntry->timer, periodicity ); |
| 14472 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14473 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14474 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14475 | return eHAL_STATUS_FAILURE; |
| 14476 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14477 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14478 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14479 | } |
| 14480 | return eHAL_STATUS_SUCCESS; |
| 14481 | } |
| 14482 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 14483 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 14484 | |
| 14485 | static tSirRetStatus |
| 14486 | csrRoamScanOffloadPopulateMacHeader(tpAniSirGlobal pMac, |
| 14487 | tANI_U8* pBD, |
| 14488 | tANI_U8 type, |
| 14489 | tANI_U8 subType, |
| 14490 | tSirMacAddr peerAddr, |
| 14491 | tSirMacAddr selfMacAddr) |
| 14492 | { |
| 14493 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 14494 | tpSirMacMgmtHdr pMacHdr; |
| 14495 | |
| 14496 | /* Prepare MAC management header */ |
| 14497 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 14498 | |
| 14499 | /* Prepare FC */ |
| 14500 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 14501 | pMacHdr->fc.type = type; |
| 14502 | pMacHdr->fc.subType = subType; |
| 14503 | |
| 14504 | /* Prepare Address 1 */ |
| 14505 | palCopyMemory( pMac->hHdd, |
| 14506 | (tANI_U8 *) pMacHdr->da, |
| 14507 | (tANI_U8 *) peerAddr, |
| 14508 | sizeof( tSirMacAddr )); |
| 14509 | |
| 14510 | sirCopyMacAddr(pMacHdr->sa,selfMacAddr); |
| 14511 | |
| 14512 | /* Prepare Address 3 */ |
| 14513 | palCopyMemory( pMac->hHdd, |
| 14514 | (tANI_U8 *) pMacHdr->bssId, |
| 14515 | (tANI_U8 *) peerAddr, |
| 14516 | sizeof( tSirMacAddr )); |
| 14517 | return statusCode; |
| 14518 | } /*** csrRoamScanOffloadPopulateMacHeader() ***/ |
| 14519 | |
| 14520 | static tSirRetStatus |
| 14521 | csrRoamScanOffloadPrepareProbeReqTemplate(tpAniSirGlobal pMac, |
| 14522 | tANI_U8 nChannelNum, |
| 14523 | tANI_U32 dot11mode, |
| 14524 | tSirMacAddr selfMacAddr, |
| 14525 | tANI_U8 *pFrame, |
| 14526 | tANI_U16 *pusLen) |
| 14527 | { |
| 14528 | tDot11fProbeRequest pr; |
| 14529 | tANI_U32 nStatus, nBytes, nPayload; |
| 14530 | tSirRetStatus nSirStatus; |
| 14531 | /*Bcast tx*/ |
| 14532 | tSirMacAddr bssId = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 14533 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 14534 | |
| 14535 | |
| 14536 | palZeroMemory( pMac->hHdd, ( tANI_U8* )&pr, sizeof( pr ) ); |
| 14537 | |
| 14538 | PopulateDot11fSuppRates( pMac, nChannelNum, &pr.SuppRates,NULL); |
| 14539 | |
| 14540 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 14541 | { |
| 14542 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 14543 | } |
| 14544 | |
| 14545 | |
| 14546 | if (IS_DOT11_MODE_HT(dot11mode)) |
| 14547 | { |
| 14548 | PopulateDot11fHTCaps( pMac, NULL, &pr.HTCaps ); |
| 14549 | } |
| 14550 | |
| 14551 | |
| 14552 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 14553 | if ( DOT11F_FAILED( nStatus ) ) |
| 14554 | { |
| 14555 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14556 | "Failed to calculate the packed size f" |
| 14557 | "or a Probe Request (0x%08x).\n", nStatus ); |
| 14558 | |
| 14559 | |
| 14560 | nPayload = sizeof( tDot11fProbeRequest ); |
| 14561 | } |
| 14562 | else if ( DOT11F_WARNED( nStatus ) ) |
| 14563 | { |
| 14564 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14565 | "There were warnings while calculating" |
| 14566 | "the packed size for a Probe Request (" |
| 14567 | "0x%08x).\n", nStatus ); |
| 14568 | } |
| 14569 | |
| 14570 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 14571 | |
| 14572 | /* Prepare outgoing frame*/ |
| 14573 | palZeroMemory( pMac->hHdd, pFrame, nBytes ); |
| 14574 | |
| 14575 | |
| 14576 | nSirStatus = csrRoamScanOffloadPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 14577 | SIR_MAC_MGMT_PROBE_REQ, bssId ,selfMacAddr); |
| 14578 | |
| 14579 | if ( eSIR_SUCCESS != nSirStatus ) |
| 14580 | { |
| 14581 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14582 | "Failed to populate the buffer descriptor for a Probe Request (%d).\n", |
| 14583 | nSirStatus ); |
| 14584 | return nSirStatus; |
| 14585 | } |
| 14586 | |
| 14587 | |
| 14588 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 14589 | sizeof( tSirMacMgmtHdr ), |
| 14590 | nPayload, &nPayload ); |
| 14591 | if ( DOT11F_FAILED( nStatus ) ) |
| 14592 | { |
| 14593 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14594 | "Failed to pack a Probe Request (0x%08x).\n", nStatus ); |
| 14595 | return eSIR_FAILURE; |
| 14596 | } |
| 14597 | else if ( DOT11F_WARNED( nStatus ) ) |
| 14598 | { |
| 14599 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14600 | "There were warnings while packing a Probe Request (0x%08x).\n" ); |
| 14601 | } |
| 14602 | |
| 14603 | *pusLen = nPayload + sizeof(tSirMacMgmtHdr); |
| 14604 | return eSIR_SUCCESS; |
| 14605 | } |
| 14606 | |
| 14607 | eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 command, tANI_U8 reason) |
| 14608 | { |
| 14609 | vos_msg_t msg; |
| 14610 | tSirRoamOffloadScanReq *pRequestBuf; |
| 14611 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 14612 | tCsrRoamSession *pSession; |
| 14613 | tANI_U8 i,num_channels = 0, ucDot11Mode; |
| 14614 | tANI_U8 *ChannelList = NULL; |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 14615 | tANI_U8 MaxDwellPeriod; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 14616 | tANI_U32 sessionId; |
| 14617 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14618 | tpCsrChannelInfo currChannelListInfo; |
| 14619 | currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 14620 | |
| 14621 | if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 14622 | { |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 14623 | smsLog( pMac, LOGE,"isRoamOffloadScanEnabled not set \n"); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 14624 | return eHAL_STATUS_FAILURE; |
| 14625 | } |
| 14626 | status = csrRoamGetSessionIdFromBSSID(pMac, |
| 14627 | (tCsrBssid *)pNeighborRoamInfo->currAPbssid, |
| 14628 | &sessionId); |
| 14629 | /*The Dynamic Config Items Update may happen even if the state is in INIT. |
| 14630 | * It is important to ensure that the command is passed down to the FW only |
| 14631 | * if the Infra Station is in a connected state.A connected station could also be |
| 14632 | * in a PREAUTH or REASSOC states.So, consider not sending the command down in INIT state. |
| 14633 | * We also have to ensure that if there is a STOP command we always have to inform Riva, |
| 14634 | * irrespective of whichever state we are in.*/ |
| 14635 | if ((pMac->roam.neighborRoamInfo.neighborRoamState == eCSR_NEIGHBOR_ROAM_STATE_INIT) && |
| 14636 | (command != ROAM_SCAN_OFFLOAD_STOP)) |
| 14637 | { |
| 14638 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Scan Command not sent to FW with state = %d and cmd = %d\n", |
| 14639 | pMac->roam.neighborRoamInfo.neighborRoamState, command); |
| 14640 | return eHAL_STATUS_FAILURE; |
| 14641 | } |
| 14642 | |
| 14643 | if ( !HAL_STATUS_SUCCESS( status ) ) |
| 14644 | { |
| 14645 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to find the sessionId for Roam Offload scan request", __func__); |
| 14646 | return eHAL_STATUS_FAILURE; |
| 14647 | } |
| 14648 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14649 | pRequestBuf = vos_mem_malloc(sizeof(tSirRoamOffloadScanReq)); |
| 14650 | if (NULL == pRequestBuf) |
| 14651 | { |
| 14652 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for Roam Offload scan request", __func__); |
| 14653 | return eHAL_STATUS_FAILED_ALLOC; |
| 14654 | } |
| 14655 | |
| 14656 | vos_mem_zero(pRequestBuf,sizeof(tSirRoamOffloadScanReq)); |
| 14657 | /* If command is STOP, then pass down ScanOffloadEnabled as Zero.This will handle the case of |
| 14658 | * host driver reloads, but Riva still up and running*/ |
| 14659 | if(command == ROAM_SCAN_OFFLOAD_STOP) |
| 14660 | pRequestBuf->RoamScanOffloadEnabled = 0; |
| 14661 | else |
| 14662 | pRequestBuf->RoamScanOffloadEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled; |
| 14663 | vos_mem_copy(pRequestBuf->ConnectedNetwork.currAPbssid, pNeighborRoamInfo->currAPbssid, |
| 14664 | sizeof(tCsrBssid)); |
| 14665 | pRequestBuf->ConnectedNetwork.ssId.length = |
| 14666 | pMac->roam.roamSession[sessionId].connectedProfile.SSID.length; |
| 14667 | vos_mem_copy(pRequestBuf->ConnectedNetwork.ssId.ssId, |
| 14668 | pMac->roam.roamSession[sessionId].connectedProfile.SSID.ssId, |
| 14669 | pRequestBuf->ConnectedNetwork.ssId.length); |
| 14670 | pRequestBuf->ConnectedNetwork.authentication = |
| 14671 | pMac->roam.roamSession[sessionId].connectedProfile.AuthType; |
| 14672 | pRequestBuf->ConnectedNetwork.encryption = |
| 14673 | pMac->roam.roamSession[sessionId].connectedProfile.EncryptionType; |
| 14674 | pRequestBuf->ConnectedNetwork.mcencryption = |
| 14675 | pMac->roam.roamSession[sessionId].connectedProfile.mcEncryptionType; |
| 14676 | pRequestBuf->LookupThreshold = |
| 14677 | (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1); |
| 14678 | pRequestBuf->RoamRssiDiff = |
| 14679 | pMac->roam.configParam.RoamRssiDiff; |
| 14680 | pRequestBuf->Command = command; |
| 14681 | pRequestBuf->StartScanReason = reason; |
| 14682 | pRequestBuf->NeighborScanTimerPeriod = |
| 14683 | pNeighborRoamInfo->cfgParams.neighborScanPeriod; |
| 14684 | pRequestBuf->NeighborRoamScanRefreshPeriod = |
| 14685 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod; |
| 14686 | pRequestBuf->NeighborScanChannelMinTime = |
| 14687 | pNeighborRoamInfo->cfgParams.minChannelScanTime; |
| 14688 | pRequestBuf->NeighborScanChannelMaxTime = |
| 14689 | pNeighborRoamInfo->cfgParams.maxChannelScanTime; |
| 14690 | pRequestBuf->EmptyRefreshScanPeriod = |
| 14691 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod; |
| 14692 | #ifdef FEATURE_WLAN_CCX |
| 14693 | pRequestBuf->IsCCXEnabled = pMac->roam.configParam.isCcxIniFeatureEnabled; |
| 14694 | #endif |
| 14695 | if ( |
| 14696 | #ifdef FEATURE_WLAN_CCX |
| 14697 | ((pNeighborRoamInfo->isCCXAssoc) && |
| 14698 | (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == |
| 14699 | eANI_BOOLEAN_FALSE)) || |
| 14700 | (pNeighborRoamInfo->isCCXAssoc == eANI_BOOLEAN_FALSE) || |
| 14701 | #endif // CCX |
| 14702 | currChannelListInfo->numOfChannels == 0) |
| 14703 | { |
| 14704 | |
| 14705 | /*Retreive the Channel Cache either from ini or from the Occupied Channels list. |
| 14706 | * Give Preference to INI Channels.*/ |
| 14707 | if (pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels) |
| 14708 | { |
| 14709 | ChannelList = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 14710 | for (i=0; i<pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels ;i++) |
| 14711 | { |
| 14712 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 14713 | { |
| 14714 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 14715 | } |
| 14716 | ChannelList++; |
| 14717 | } |
| 14718 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 14719 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_STATIC; |
| 14720 | } |
| 14721 | else{ |
| 14722 | ChannelList = pMac->scan.occupiedChannels.channelList; |
| 14723 | for(i=0; i<pMac->scan.occupiedChannels.numChannels; i++) |
| 14724 | { |
| 14725 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 14726 | { |
| 14727 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 14728 | } |
| 14729 | ChannelList++; |
| 14730 | } |
| 14731 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 14732 | /* If the profile changes as to what it was earlier, inform the FW through |
| 14733 | * FLUSH as ChannelCacheType in which case, the FW will flush the occupied channels |
| 14734 | * for the earlier profile and try to learn them afresh.*/ |
| 14735 | if (reason == REASON_FLUSH_CHANNEL_LIST) |
| 14736 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_FLUSH; |
| 14737 | else { |
| 14738 | if (csrNeighborRoamIsNewConnectedProfile(pMac)) |
| 14739 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_INIT; |
| 14740 | else |
| 14741 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE; |
| 14742 | } |
| 14743 | } |
| 14744 | } |
| 14745 | #ifdef FEATURE_WLAN_CCX |
| 14746 | else |
| 14747 | { |
| 14748 | /* If CCX is enabled, and a neighbor Report is received,then |
| 14749 | * Ignore the INI Channels or the Occupied Channel List. Consider |
| 14750 | * the channels in the neighbor list sent by the CCX AP.*/ |
| 14751 | if (currChannelListInfo->numOfChannels != 0) |
| 14752 | { |
| 14753 | ChannelList = currChannelListInfo->ChannelList; |
| 14754 | for (i=0;i<currChannelListInfo->numOfChannels;i++) |
| 14755 | { |
| 14756 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 14757 | { |
| 14758 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 14759 | } |
| 14760 | ChannelList++; |
| 14761 | } |
| 14762 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 14763 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_STATIC; |
| 14764 | } |
| 14765 | } |
| 14766 | #endif |
| 14767 | num_channels = 0; |
| 14768 | ChannelList = NULL; |
| 14769 | |
| 14770 | /* Maintain the Valid Channels List*/ |
| 14771 | if (0 == strncmp(pMac->scan.countryCodeCurrent, "KR", 2)) |
| 14772 | { |
| 14773 | ChannelList = pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.ChannelList; |
| 14774 | for(i=0; i<pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels; i++) |
| 14775 | { |
| 14776 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 14777 | { |
| 14778 | pRequestBuf->ValidChannelList[num_channels++] = *ChannelList; |
| 14779 | } |
| 14780 | ChannelList++; |
| 14781 | } |
| 14782 | pRequestBuf->ValidChannelCount = num_channels; |
| 14783 | } else { |
| 14784 | ChannelList = pMac->roam.validChannelList; |
| 14785 | for(i=0; i<pMac->roam.numValidChannels; i++) |
| 14786 | { |
| 14787 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 14788 | { |
| 14789 | pRequestBuf->ValidChannelList[num_channels++] = *ChannelList; |
| 14790 | } |
| 14791 | ChannelList++; |
| 14792 | } |
| 14793 | pRequestBuf->ValidChannelCount = num_channels; |
| 14794 | } |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 14795 | pRequestBuf->MDID.mdiePresent = |
| 14796 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent; |
| 14797 | pRequestBuf->MDID.mobilityDomain = |
| 14798 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mobilityDomain; |
| 14799 | /*Ensure that the nProbes does not fall below its MIN Value which is 2*/ |
| 14800 | if(pMac->roam.configParam.nProbes < 2) |
| 14801 | pRequestBuf->nProbes = 2; |
| 14802 | else |
| 14803 | pRequestBuf->nProbes = pMac->roam.configParam.nProbes; |
| 14804 | |
| 14805 | /*Max Dwell Period is calculated here to ensure that, |
| 14806 | * Home Away Time is atleast equal to (MaxDwellPeriod + |
| 14807 | * (2*SRF)), where SRF is the RF Switching time.The RF |
| 14808 | * switching time is considered twice to consider the |
| 14809 | * time to go off channel and return to the home channel.*/ |
| 14810 | MaxDwellPeriod = pRequestBuf->NeighborScanChannelMaxTime/pRequestBuf->nProbes; |
| 14811 | if(MaxDwellPeriod < 1) |
| 14812 | MaxDwellPeriod = 1; |
| 14813 | if(pMac->roam.configParam.nRoamScanHomeAwayTime < |
| 14814 | (MaxDwellPeriod + (2 * SIR_ROAM_SCAN_CHANNEL_SWITCH_TIME))) |
| 14815 | { |
| 14816 | pRequestBuf->HomeAwayTime = MaxDwellPeriod + (2 * SIR_ROAM_SCAN_CHANNEL_SWITCH_TIME); |
| 14817 | } else { |
| 14818 | pRequestBuf->HomeAwayTime = pMac->roam.configParam.nRoamScanHomeAwayTime; |
| 14819 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 14820 | /*Prepare a probe request for 2.4GHz band and one for 5GHz band*/ |
| 14821 | ucDot11Mode = (tANI_U8) csrTranslateToWNICfgDot11Mode(pMac, |
| 14822 | csrFindBestPhyMode( pMac, pMac->roam.configParam.phyMode )); |
| 14823 | csrRoamScanOffloadPrepareProbeReqTemplate(pMac,SIR_ROAM_SCAN_24G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, |
| 14824 | pRequestBuf->p24GProbeTemplate, &pRequestBuf->us24GProbeTemplateLen); |
| 14825 | |
| 14826 | csrRoamScanOffloadPrepareProbeReqTemplate(pMac,SIR_ROAM_SCAN_5G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, |
| 14827 | pRequestBuf->p5GProbeTemplate, &pRequestBuf->us5GProbeTemplateLen); |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 14828 | msg.type = WDA_ROAM_SCAN_OFFLOAD_REQ; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 14829 | msg.reserved = 0; |
| 14830 | msg.bodyptr = pRequestBuf; |
| 14831 | if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))) |
| 14832 | { |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 14833 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_ROAM_SCAN_OFFLOAD_REQ message to WDA", __func__); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 14834 | vos_mem_free(pRequestBuf); |
| 14835 | return eHAL_STATUS_FAILURE; |
| 14836 | } |
| 14837 | |
| 14838 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Roam Scan Offload Command %d, Reason %d", command, reason); |
| 14839 | return status; |
| 14840 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 14841 | |
| 14842 | eHalStatus csrRoamOffloadScanRspHdlr(tpAniSirGlobal pMac, tANI_U8 reason) |
| 14843 | { |
| 14844 | switch(reason) |
| 14845 | { |
| 14846 | case 0: |
| 14847 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Rsp for Roam Scan Offload with failure status"); |
| 14848 | break; |
| 14849 | case REASON_OS_REQUESTED_ROAMING_NOW: |
| 14850 | csrNeighborRoamProceedWithHandoffReq(pMac); |
| 14851 | break; |
| 14852 | default: |
| 14853 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Rsp for Roam Scan Offload with unknown Reason %d", reason); |
| 14854 | } |
| 14855 | return eHAL_STATUS_SUCCESS; |
| 14856 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 14857 | #endif |
| 14858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14859 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 14860 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId) |
| 14861 | { |
| 14862 | tANI_BOOLEAN found = FALSE; |
| 14863 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14864 | tCsrPeStatsReqInfo staEntry; |
| 14865 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
| 14866 | tListElem *pStaEntry = NULL; |
| 14867 | VOS_STATUS vosStatus; |
| 14868 | tPmcPowerState powerState; |
| 14869 | *pFound = FALSE; |
| 14870 | |
| 14871 | pStaEntry = csrRoamFindInPeStatsReqList(pMac, statsMask); |
| 14872 | if(pStaEntry) |
| 14873 | { |
| 14874 | pTempStaEntry = GET_BASE_ADDR( pStaEntry, tCsrPeStatsReqInfo, link ); |
| 14875 | if(pTempStaEntry->periodicity) |
| 14876 | { |
| 14877 | pTempStaEntry->periodicity = |
| 14878 | CSR_ROAM_MIN(periodicity, pTempStaEntry->periodicity); |
| 14879 | } |
| 14880 | else |
| 14881 | { |
| 14882 | pTempStaEntry->periodicity = periodicity; |
| 14883 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14884 | pTempStaEntry->numClient++; |
| 14885 | found = TRUE; |
| 14886 | } |
| 14887 | else |
| 14888 | { |
| 14889 | palZeroMemory(pMac->hHdd, &staEntry, sizeof(tCsrPeStatsReqInfo)); |
| 14890 | staEntry.numClient = 1; |
| 14891 | staEntry.periodicity = periodicity; |
| 14892 | staEntry.pMac = pMac; |
| 14893 | staEntry.rspPending = FALSE; |
| 14894 | staEntry.staId = staId; |
| 14895 | staEntry.statsMask = statsMask; |
| 14896 | staEntry.timerRunning = FALSE; |
| 14897 | pTempStaEntry = csrRoamInsertEntryIntoPeStatsReqList(pMac, &pMac->roam.peStatsReqList, &staEntry); |
| 14898 | if(!pTempStaEntry) |
| 14899 | { |
| 14900 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14901 | smsLog(pMac, LOGW, "csrRoamCheckPeStatsReqList: Failed to insert req in peStatsReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14902 | return NULL; |
| 14903 | } |
| 14904 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14905 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 14906 | if(ePMC_FULL_POWER == powerState) |
| 14907 | { |
| 14908 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 14909 | { |
| 14910 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 14911 | } |
| 14912 | } |
| 14913 | else |
| 14914 | { |
| 14915 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 14916 | { |
| 14917 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 14918 | } |
| 14919 | } |
| 14920 | if(!pTempStaEntry->timerRunning) |
| 14921 | { |
| 14922 | //send down a req in case of one time req, for periodic ones wait for timer to expire |
| 14923 | if(!pTempStaEntry->rspPending && |
| 14924 | !pTempStaEntry->periodicity) |
| 14925 | { |
| 14926 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 14927 | if(!HAL_STATUS_SUCCESS(status)) |
| 14928 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14929 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:failed to send down stats req to PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14930 | } |
| 14931 | else |
| 14932 | { |
| 14933 | pTempStaEntry->rspPending = TRUE; |
| 14934 | } |
| 14935 | } |
| 14936 | if(pTempStaEntry->periodicity) |
| 14937 | { |
| 14938 | if(!found) |
| 14939 | { |
| 14940 | |
| 14941 | vosStatus = vos_timer_init( &pTempStaEntry->hPeStatsTimer, VOS_TIMER_TYPE_SW, |
| 14942 | csrRoamPeStatsTimerHandler, pTempStaEntry ); |
| 14943 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14944 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14945 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot init hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14946 | return NULL; |
| 14947 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14948 | } |
| 14949 | //start timer |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14950 | smsLog(pMac, LOG1, "csrRoamCheckPeStatsReqList:peStatsTimer period %d", pTempStaEntry->periodicity); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14951 | vosStatus = vos_timer_start( &pTempStaEntry->hPeStatsTimer, pTempStaEntry->periodicity ); |
| 14952 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14953 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14954 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14955 | return NULL; |
| 14956 | } |
| 14957 | pTempStaEntry->timerRunning = TRUE; |
| 14958 | } |
| 14959 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14960 | *pFound = found; |
| 14961 | return pTempStaEntry; |
| 14962 | } |
| 14963 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14964 | /* |
| 14965 | pStaEntry is no longer invalid upon the return of this function. |
| 14966 | */ |
| 14967 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry) |
| 14968 | { |
| 14969 | if(pEntry) |
| 14970 | { |
| 14971 | if(csrLLRemoveEntry(&pMac->roam.statsClientReqList, pEntry, LL_ACCESS_LOCK)) |
| 14972 | { |
| 14973 | palFreeMemory(pMac->hHdd, GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14974 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14975 | } |
| 14976 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14977 | |
| 14978 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry) |
| 14979 | { |
| 14980 | tListElem *pEntry; |
| 14981 | tCsrPeStatsReqInfo *pTempStaEntry; |
| 14982 | VOS_STATUS vosStatus; |
| 14983 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14984 | if(!pEntry) |
| 14985 | { |
| 14986 | //list empty |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14987 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: List empty, no stats req for PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14988 | return; |
| 14989 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14990 | while( pEntry ) |
| 14991 | { |
| 14992 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14993 | if( pTempStaEntry && pTempStaEntry->statsMask == pPeStaEntry->statsMask) |
| 14994 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14995 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14996 | if(pTempStaEntry->timerRunning) |
| 14997 | { |
| 14998 | vosStatus = vos_timer_stop( &pTempStaEntry->hPeStatsTimer ); |
| 14999 | /* If we are not able to stop the timer here, just remove |
| 15000 | * the entry from the linked list. Destroy the timer object |
| 15001 | * and free the memory in the timer CB |
| 15002 | */ |
| 15003 | if( vosStatus == VOS_STATUS_SUCCESS ) |
| 15004 | { |
| 15005 | /* the timer is successfully stopped */ |
| 15006 | pTempStaEntry->timerRunning = FALSE; |
| 15007 | |
| 15008 | /* Destroy the timer */ |
| 15009 | vosStatus = vos_timer_destroy( &pTempStaEntry->hPeStatsTimer ); |
| 15010 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15011 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15012 | smsLog(pMac, LOGE, FL("csrRoamRemoveEntryFromPeStatsReqList:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15013 | } |
| 15014 | } |
| 15015 | else |
| 15016 | { |
| 15017 | // the timer could not be stopped. Hence destroy and free the |
| 15018 | // memory for the PE stat entry in the timer CB. |
| 15019 | pTempStaEntry->timerStopFailed = TRUE; |
| 15020 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15021 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15022 | |
| 15023 | if(csrLLRemoveEntry(&pMac->roam.peStatsReqList, pEntry, LL_ACCESS_LOCK)) |
| 15024 | { |
| 15025 | // Only free the memory if we could stop the timer successfully |
| 15026 | if(!pTempStaEntry->timerStopFailed) |
| 15027 | { |
| 15028 | palFreeMemory(pMac->hHdd, pTempStaEntry); |
| 15029 | pTempStaEntry = NULL; |
| 15030 | } |
| 15031 | break; |
| 15032 | } |
| 15033 | |
| 15034 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 15035 | } |
| 15036 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15037 | return; |
| 15038 | } |
| 15039 | |
| 15040 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15041 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15042 | { |
| 15043 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15044 | pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = pTlStats->rxBcntCRCok; |
| 15045 | pMac->roam.classDStatsInfo.rx_bc_byte_cnt = pTlStats->rxBCBcnt; |
| 15046 | pMac->roam.classDStatsInfo.rx_bc_frm_cnt = pTlStats->rxBCFcnt; |
| 15047 | pMac->roam.classDStatsInfo.rx_byte_cnt = pTlStats->rxBcnt; |
| 15048 | pMac->roam.classDStatsInfo.rx_mc_byte_cnt = pTlStats->rxMCBcnt; |
| 15049 | pMac->roam.classDStatsInfo.rx_mc_frm_cnt = pTlStats->rxMCFcnt; |
| 15050 | pMac->roam.classDStatsInfo.rx_rate = pTlStats->rxRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15051 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15052 | pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = pTlStats->rxUCBcnt; |
| 15053 | pMac->roam.classDStatsInfo.rx_uc_frm_cnt = pTlStats->rxUCFcnt; |
| 15054 | pMac->roam.classDStatsInfo.tx_bc_byte_cnt = pTlStats->txBCBcnt; |
| 15055 | pMac->roam.classDStatsInfo.tx_bc_frm_cnt = pTlStats->txBCFcnt; |
| 15056 | pMac->roam.classDStatsInfo.tx_mc_byte_cnt = pTlStats->txMCBcnt; |
| 15057 | pMac->roam.classDStatsInfo.tx_mc_frm_cnt = pTlStats->txMCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15058 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15059 | pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = pTlStats->txUCBcnt; |
| 15060 | pMac->roam.classDStatsInfo.tx_uc_frm_cnt = pTlStats->txUCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15061 | |
| 15062 | } |
| 15063 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15064 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 15065 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext) |
| 15066 | { |
| 15067 | tANI_U8 stats[500]; |
| 15068 | tANI_U8 *pStats = NULL; |
| 15069 | tANI_U32 tempMask = 0; |
| 15070 | tANI_U8 counter = 0; |
| 15071 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15072 | if(!callback) |
| 15073 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15074 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report callback NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15075 | return; |
| 15076 | } |
| 15077 | if(!statsMask) |
| 15078 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15079 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report statsMask is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15080 | return; |
| 15081 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15082 | pStats = stats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15083 | tempMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15084 | while(tempMask) |
| 15085 | { |
| 15086 | if(tempMask & 1) |
| 15087 | { |
| 15088 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 15089 | switch(counter) |
| 15090 | { |
| 15091 | case eCsrSummaryStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15092 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15093 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 15094 | sizeof(tCsrSummaryStatsInfo)); |
| 15095 | if(!HAL_STATUS_SUCCESS(status)) |
| 15096 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15097 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15098 | } |
| 15099 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 15100 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15101 | case eCsrGlobalClassAStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15102 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15103 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 15104 | sizeof(tCsrGlobalClassAStatsInfo)); |
| 15105 | if(!HAL_STATUS_SUCCESS(status)) |
| 15106 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15107 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15108 | } |
| 15109 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15110 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15111 | case eCsrGlobalClassBStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15112 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15113 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 15114 | sizeof(tCsrGlobalClassBStatsInfo)); |
| 15115 | if(!HAL_STATUS_SUCCESS(status)) |
| 15116 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15117 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15118 | } |
| 15119 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15120 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15121 | case eCsrGlobalClassCStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15122 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15123 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 15124 | sizeof(tCsrGlobalClassCStatsInfo)); |
| 15125 | if(!HAL_STATUS_SUCCESS(status)) |
| 15126 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15127 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15128 | } |
| 15129 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15130 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15131 | case eCsrGlobalClassDStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15132 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassD stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15133 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classDStatsInfo, |
| 15134 | sizeof(tCsrGlobalClassDStatsInfo)); |
| 15135 | if(!HAL_STATUS_SUCCESS(status)) |
| 15136 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15137 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassD stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15138 | } |
| 15139 | pStats += sizeof(tCsrGlobalClassDStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15140 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15141 | case eCsrPerStaStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15142 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15143 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.perStaStatsInfo[staId], |
| 15144 | sizeof(tCsrPerStaStatsInfo)); |
| 15145 | if(!HAL_STATUS_SUCCESS(status)) |
| 15146 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15147 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15148 | } |
| 15149 | pStats += sizeof(tCsrPerStaStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15150 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15151 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15152 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:unknown stats type")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15153 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15154 | } |
| 15155 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15156 | tempMask >>=1; |
| 15157 | counter++; |
| 15158 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15159 | callback(stats, pContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15160 | } |
| 15161 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15162 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac) |
| 15163 | { |
| 15164 | tListElem *pEntry = NULL; |
| 15165 | tListElem *pPrevEntry = NULL; |
| 15166 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 15167 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15168 | VOS_STATUS vosStatus; |
| 15169 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15170 | if(!pEntry) |
| 15171 | { |
| 15172 | //list empty |
| 15173 | smsLog(pMac, LOGW, "csrRoamDeregStatisticsReq: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15174 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15175 | return status; |
| 15176 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15177 | while( pEntry ) |
| 15178 | { |
| 15179 | if(pPrevEntry) |
| 15180 | { |
| 15181 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 15182 | //send up the stats report |
| 15183 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 15184 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 15185 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 15186 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15187 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15188 | if (pTempStaEntry->pPeStaEntry) //pPeStaEntry can be NULL |
| 15189 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15190 | pTempStaEntry->pPeStaEntry->numClient--; |
| 15191 | //check if we need to delete the entry from peStatsReqList too |
| 15192 | if(!pTempStaEntry->pPeStaEntry->numClient) |
| 15193 | { |
| 15194 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry); |
| 15195 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15196 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15197 | //check if we need to stop the tl stats timer too |
| 15198 | pMac->roam.tlStatsReqInfo.numClient--; |
| 15199 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 15200 | { |
| 15201 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 15202 | { |
| 15203 | status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 15204 | if(!HAL_STATUS_SUCCESS(status)) |
| 15205 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15206 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15207 | //we will continue |
| 15208 | } |
| 15209 | } |
| 15210 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 15211 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 15212 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15213 | if (pTempStaEntry->periodicity) |
| 15214 | { |
| 15215 | //While creating StaEntry in csrGetStatistics, |
| 15216 | //Initializing and starting timer only when periodicity is set. |
| 15217 | //So Stop and Destroy timer only when periodicity is set. |
| 15218 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15219 | vos_timer_stop( &pTempStaEntry->timer ); |
| 15220 | // Destroy the vos timer... |
| 15221 | vosStatus = vos_timer_destroy( &pTempStaEntry->timer ); |
| 15222 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15223 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15224 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15225 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15226 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15227 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15228 | |
| 15229 | pPrevEntry = pEntry; |
| 15230 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 15231 | } |
| 15232 | //the last one |
| 15233 | if(pPrevEntry) |
| 15234 | { |
| 15235 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 15236 | //send up the stats report |
| 15237 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 15238 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 15239 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 15240 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15241 | return status; |
| 15242 | |
| 15243 | } |
| 15244 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15245 | eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 15246 | tRequestFullPowerReason *pReason, |
| 15247 | tANI_BOOLEAN *pfNeedPower ) |
| 15248 | { |
| 15249 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 15250 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
| 15251 | tPmcState pmcState; |
| 15252 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15253 | // TODO : Session info unavailable |
| 15254 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15255 | if( pfNeedPower ) |
| 15256 | { |
| 15257 | *pfNeedPower = eANI_BOOLEAN_FALSE; |
| 15258 | } |
| 15259 | //We only handle CSR commands |
| 15260 | if( !(eSmeCsrCommandMask & pCommand->command) ) |
| 15261 | { |
| 15262 | return eHAL_STATUS_SUCCESS; |
| 15263 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15264 | //Check PMC state first |
| 15265 | pmcState = pmcGetPmcState( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15266 | switch( pmcState ) |
| 15267 | { |
| 15268 | case REQUEST_IMPS: |
| 15269 | case IMPS: |
| 15270 | if( eSmeCommandScan == pCommand->command ) |
| 15271 | { |
| 15272 | switch( pCommand->u.scanCmd.reason ) |
| 15273 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15274 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 15275 | case eCsrScanGetLfrResult: |
| 15276 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15277 | case eCsrScanGetResult: |
| 15278 | case eCsrScanBGScanAbort: |
| 15279 | case eCsrScanBGScanEnable: |
| 15280 | case eCsrScanGetScanChnInfo: |
| 15281 | //Internal process, no need for full power |
| 15282 | fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 15283 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15284 | default: |
| 15285 | //Other scans are real scan, ask for power |
| 15286 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15287 | break; |
| 15288 | } //switch |
| 15289 | } |
| 15290 | else |
| 15291 | { |
| 15292 | //ask for power for roam and status change |
| 15293 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15294 | } |
| 15295 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15296 | case REQUEST_BMPS: |
| 15297 | case BMPS: |
| 15298 | case REQUEST_START_UAPSD: |
| 15299 | case UAPSD: |
| 15300 | //We treat WOWL same as BMPS |
| 15301 | case REQUEST_ENTER_WOWL: |
| 15302 | case WOWL: |
| 15303 | if( eSmeCommandRoam == pCommand->command ) |
| 15304 | { |
| 15305 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 15306 | tCsrScanResult *pScanResult; |
| 15307 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15308 | switch ( pCommand->u.roamCmd.roamReason ) |
| 15309 | { |
| 15310 | case eCsrForcedDisassoc: |
| 15311 | case eCsrForcedDisassocMICFailure: |
| 15312 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 15313 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15314 | break; |
| 15315 | case eCsrSmeIssuedDisassocForHandoff: |
| 15316 | case eCsrForcedDeauth: |
| 15317 | case eCsrHddIssuedReassocToSameAP: |
| 15318 | case eCsrSmeIssuedReassocToSameAP: |
| 15319 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15320 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15321 | case eCsrCapsChange: |
| 15322 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15323 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15324 | default: |
| 15325 | //Check whether the profile is already connected. If so, no need for full power |
| 15326 | //Note: IBSS is ignored for now because we don't support powersave in IBSS |
| 15327 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && pBSSList ) |
| 15328 | { |
| 15329 | //Only need to check the first one |
| 15330 | pEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 15331 | if( pEntry ) |
| 15332 | { |
| 15333 | pScanResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link); |
| 15334 | #if 0 |
| 15335 | // TODO : Session Specific info pConnectBssDesc |
| 15336 | if( csrIsBssIdEqual( pMac, &pScanResult->Result.BssDescriptor, pMac->roam.pConnectBssDesc ) && |
| 15337 | csrIsSsidEqual( pMac, pMac->roam.pConnectBssDesc, |
| 15338 | &pScanResult->Result.BssDescriptor, (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ) ) ) |
| 15339 | { |
| 15340 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 15341 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 15342 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 15343 | // a new Association. |
| 15344 | if(csrIsSameProfile(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 15345 | { |
| 15346 | if(csrRoamIsSameProfileKeys(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 15347 | { |
| 15348 | //Done, eventually, the command reaches eCsrReassocToSelfNoCapChange; |
| 15349 | //No need for full power |
| 15350 | //Set the flag so the code later can avoid to do the above |
| 15351 | //check again. |
| 15352 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_TRUE; |
| 15353 | break; |
| 15354 | } |
| 15355 | } |
| 15356 | } |
| 15357 | #endif |
| 15358 | } |
| 15359 | } |
| 15360 | //If we are here, full power is needed |
| 15361 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15362 | break; |
| 15363 | } |
| 15364 | } |
| 15365 | else if( eSmeCommandWmStatusChange == pCommand->command ) |
| 15366 | { |
| 15367 | //need full power for all |
| 15368 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15369 | reason = eSME_LINK_DISCONNECTED_BY_OTHER; |
| 15370 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15371 | #ifdef FEATURE_WLAN_TDLS |
| 15372 | else if( eSmeCommandTdlsAddPeer == pCommand->command ) |
| 15373 | { |
| 15374 | //TDLS link is getting established. need full power |
| 15375 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15376 | reason = eSME_FULL_PWR_NEEDED_BY_TDLS_PEER_SETUP; |
| 15377 | } |
| 15378 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15379 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15380 | case REQUEST_STOP_UAPSD: |
| 15381 | case REQUEST_EXIT_WOWL: |
| 15382 | if( eSmeCommandRoam == pCommand->command ) |
| 15383 | { |
| 15384 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15385 | switch ( pCommand->u.roamCmd.roamReason ) |
| 15386 | { |
| 15387 | case eCsrForcedDisassoc: |
| 15388 | case eCsrForcedDisassocMICFailure: |
| 15389 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 15390 | break; |
| 15391 | default: |
| 15392 | break; |
| 15393 | } |
| 15394 | } |
| 15395 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15396 | case STOPPED: |
| 15397 | case REQUEST_STANDBY: |
| 15398 | case STANDBY: |
| 15399 | case LOW_POWER: |
| 15400 | //We are not supposed to do anything |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15401 | smsLog( pMac, LOGE, FL( " cannot process because PMC is in stopped/standby state %d" ), pmcState ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15402 | status = eHAL_STATUS_FAILURE; |
| 15403 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15404 | case FULL_POWER: |
| 15405 | case REQUEST_FULL_POWER: |
| 15406 | default: |
| 15407 | //No need to ask for full power. This has to be FULL_POWER state |
| 15408 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15409 | } //switch |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15410 | if( pReason ) |
| 15411 | { |
| 15412 | *pReason = reason; |
| 15413 | } |
| 15414 | if( pfNeedPower ) |
| 15415 | { |
| 15416 | *pfNeedPower = fNeedFullPower; |
| 15417 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15418 | return ( status ); |
| 15419 | } |
| 15420 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15421 | static eHalStatus csrRequestFullPower( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 15422 | { |
| 15423 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15424 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 15425 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15426 | status = csrIsFullPowerNeeded( pMac, pCommand, &reason, &fNeedFullPower ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15427 | if( fNeedFullPower && HAL_STATUS_SUCCESS( status ) ) |
| 15428 | { |
| 15429 | status = pmcRequestFullPower(pMac, csrFullPowerCallback, pMac, reason); |
| 15430 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15431 | return ( status ); |
| 15432 | } |
| 15433 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15434 | tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac ) |
| 15435 | { |
| 15436 | tSmeCmd *pCmd = smeGetCommandBuffer( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15437 | if( pCmd ) |
| 15438 | { |
| 15439 | pMac->roam.sPendingCommands++; |
| 15440 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15441 | return ( pCmd ); |
| 15442 | } |
| 15443 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15444 | void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 15445 | { |
| 15446 | if (pMac->roam.sPendingCommands > 0) |
| 15447 | { |
| 15448 | //All command allocated through csrGetCommandBuffer need to |
| 15449 | //decrement the pending count when releasing. |
| 15450 | pMac->roam.sPendingCommands--; |
| 15451 | smeReleaseCommand( pMac, pCommand ); |
| 15452 | } |
| 15453 | else |
| 15454 | { |
| 15455 | smsLog(pMac, LOGE, FL( "no pending commands")); |
| 15456 | VOS_ASSERT(0); |
| 15457 | } |
| 15458 | } |
| 15459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15460 | //Return SUCCESS is the command is queued, failed |
| 15461 | eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority ) |
| 15462 | { |
| 15463 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15464 | if( (eSmeCommandScan == pCommand->command) && pMac->scan.fDropScanCmd ) |
| 15465 | { |
| 15466 | smsLog(pMac, LOGW, FL(" drop scan (scan reason %d) command"), |
| 15467 | pCommand->u.scanCmd.reason); |
| 15468 | return eHAL_STATUS_CSR_WRONG_STATE; |
| 15469 | } |
| 15470 | |
| 15471 | //We can call request full power first before putting the command into pending Q |
| 15472 | //because we are holding SME lock at this point. |
| 15473 | status = csrRequestFullPower( pMac, pCommand ); |
| 15474 | if( HAL_STATUS_SUCCESS( status ) ) |
| 15475 | { |
| 15476 | tANI_BOOLEAN fNoCmdPending; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15477 | //make sure roamCmdPendingList is not empty first |
| 15478 | fNoCmdPending = csrLLIsListEmpty( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_FALSE ); |
| 15479 | if( fNoCmdPending ) |
| 15480 | { |
| 15481 | smePushCommand( pMac, pCommand, fHighPriority ); |
| 15482 | } |
| 15483 | else |
| 15484 | { |
| 15485 | //Other commands are waiting for PMC callback, queue the new command to the pending Q |
| 15486 | //no list lock is needed since SME lock is held |
| 15487 | if( !fHighPriority ) |
| 15488 | { |
| 15489 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 15490 | } |
| 15491 | else { |
| 15492 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 15493 | } |
| 15494 | } |
| 15495 | } |
| 15496 | else if( eHAL_STATUS_PMC_PENDING == status ) |
| 15497 | { |
| 15498 | //no list lock is needed since SME lock is held |
| 15499 | if( !fHighPriority ) |
| 15500 | { |
| 15501 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 15502 | } |
| 15503 | else { |
| 15504 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 15505 | } |
| 15506 | //Let caller know the command is queue |
| 15507 | status = eHAL_STATUS_SUCCESS; |
| 15508 | } |
| 15509 | else |
| 15510 | { |
| 15511 | //Not to decrease pMac->roam.sPendingCommands here. Caller will decrease it when it |
| 15512 | //release the command. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15513 | smsLog( pMac, LOGE, FL( " cannot queue command %d" ), pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15514 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15515 | return ( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15516 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15517 | eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs* pAPWPSIES ) |
| 15518 | { |
| 15519 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15520 | tSirUpdateAPWPSIEsReq *pMsg; |
| 15521 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 15522 | |
| 15523 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15524 | if (NULL == pSession) |
| 15525 | { |
| 15526 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 15527 | return eHAL_STATUS_FAILURE; |
| 15528 | } |
| 15529 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15530 | do |
| 15531 | { |
| 15532 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPSIEsReq) ); |
| 15533 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 15534 | palZeroMemory( pMac->hHdd, pMsg, sizeof(tSirUpdateAPWPSIEsReq) ); |
| 15535 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPDATE_APWPSIE_REQ); |
| 15536 | |
| 15537 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 15538 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15539 | // transactionId |
| 15540 | *pBuf = 0; |
| 15541 | *( pBuf + 1 ) = 0; |
| 15542 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15543 | // bssId |
| 15544 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 15545 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15546 | //sessionId |
| 15547 | *pBuf++ = (tANI_U8)sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15548 | // APWPSIEs |
| 15549 | palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *)pBuf, pAPWPSIES, sizeof(tSirAPWPSIEs)); |
| 15550 | pBuf += sizeof(tSirAPWPSIEs); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15551 | 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] | 15552 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15553 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15554 | return ( status ); |
| 15555 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15556 | eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie) |
| 15557 | { |
| 15558 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15559 | tSirUpdateAPWPARSNIEsReq *pMsg; |
| 15560 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15561 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15562 | if (NULL == pSession) |
| 15563 | { |
| 15564 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 15565 | return eHAL_STATUS_FAILURE; |
| 15566 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15567 | do |
| 15568 | { |
| 15569 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPARSNIEsReq) ); |
| 15570 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 15571 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirUpdateAPWPARSNIEsReq ) ); |
| 15572 | 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] | 15573 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 15574 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15575 | // transactionId |
| 15576 | *pBuf = 0; |
| 15577 | *( pBuf + 1 ) = 0; |
| 15578 | pBuf += sizeof(tANI_U16); |
| 15579 | |
| 15580 | // bssId |
| 15581 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 15582 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15583 | // sessionId |
| 15584 | *pBuf++ = (tANI_U8)sessionId; |
| 15585 | |
| 15586 | // APWPARSNIEs |
| 15587 | palCopyMemory( pMac->hHdd, (tSirRSNie *)pBuf, pAPSirRSNie, sizeof(tSirRSNie)); |
| 15588 | pBuf += sizeof(tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15589 | 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] | 15590 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15591 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15592 | return ( status ); |
| 15593 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15594 | |
| 15595 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 15596 | //eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tCsrBssid preAuthBssid, tANI_U8 channelId) |
| 15597 | eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription) |
| 15598 | { |
| 15599 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 15600 | tpSirFTPreAuthReq pftPreAuthReq; |
| 15601 | tANI_U16 auth_req_len = 0; |
| 15602 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15603 | auth_req_len = sizeof(tSirFTPreAuthReq); |
| 15604 | pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len); |
| 15605 | if (pftPreAuthReq == NULL) |
| 15606 | { |
| 15607 | smsLog(pMac, LOGE, FL("Memory allocation for FT Preauth request failed")); |
| 15608 | return eHAL_STATUS_RESOURCES; |
| 15609 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15610 | // Save the SME Session ID here. We need it while processing the preauth response |
| 15611 | pMac->ft.ftSmeContext.smeSessionId = sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15612 | vos_mem_zero(pftPreAuthReq, auth_req_len); |
| 15613 | |
| 15614 | pftPreAuthReq->pbssDescription = (tpSirBssDescription)vos_mem_malloc( |
| 15615 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 15616 | |
| 15617 | pftPreAuthReq->messageType = pal_cpu_to_be16(eWNI_SME_FT_PRE_AUTH_REQ); |
| 15618 | |
| 15619 | pftPreAuthReq->preAuthchannelNum = pBssDescription->channelId; |
| 15620 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15621 | palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->currbssId, (void *)pSession->connectedProfile.bssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15622 | palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->preAuthbssId, (void *)pBssDescription->bssId, sizeof(tSirMacAddr)); |
| 15623 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15624 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 15625 | if (csrRoamIs11rAssoc(pMac) && |
| 15626 | (pMac->roam.roamSession[sessionId].connectedProfile.AuthType != eCSR_AUTH_TYPE_OPEN_SYSTEM)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15627 | { |
| 15628 | pftPreAuthReq->ft_ies_length = (tANI_U16)pMac->ft.ftSmeContext.auth_ft_ies_length; |
| 15629 | palCopyMemory(pMac->hHdd, pftPreAuthReq->ft_ies, pMac->ft.ftSmeContext.auth_ft_ies, |
| 15630 | pMac->ft.ftSmeContext.auth_ft_ies_length); |
| 15631 | } |
| 15632 | else |
| 15633 | #endif |
| 15634 | { |
| 15635 | pftPreAuthReq->ft_ies_length = 0; |
| 15636 | } |
Madan Mohan Koyyalamudi | 613b0a4 | 2012-10-31 15:55:53 -0700 | [diff] [blame] | 15637 | vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription, |
| 15638 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 15639 | pftPreAuthReq->length = pal_cpu_to_be16(auth_req_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15640 | return palSendMBMessage(pMac->hHdd, pftPreAuthReq); |
| 15641 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15642 | /*-------------------------------------------------------------------------- |
| 15643 | * This will receive and process the FT Pre Auth Rsp from the current |
| 15644 | * associated ap. |
| 15645 | * |
| 15646 | * This will invoke the hdd call back. This is so that hdd can now |
| 15647 | * send the FTIEs from the Auth Rsp (Auth Seq 2) to the supplicant. |
| 15648 | ------------------------------------------------------------------------*/ |
| 15649 | void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp ) |
| 15650 | { |
| 15651 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 15652 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15653 | #ifdef FEATURE_WLAN_LFR |
| 15654 | tCsrRoamInfo roamInfo; |
| 15655 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15656 | |
| 15657 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 15658 | smsLog( pMac, LOGE, FL("Preauth response status code 0x%x"), pFTPreAuthRsp->status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15659 | #endif |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 15660 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 15661 | status = csrNeighborRoamPreauthRspHandler(pMac, pFTPreAuthRsp->status); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 15662 | if (status != eHAL_STATUS_SUCCESS) { |
| 15663 | /* |
| 15664 | * Bail out if pre-auth was not even processed. |
| 15665 | */ |
| 15666 | smsLog(pMac, LOGW, FL("Preauth was not processed: %d"), status); |
| 15667 | return; |
| 15668 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15669 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15670 | /* The below function calls/timers should be invoked only if the pre-auth is successful */ |
| 15671 | if (VOS_STATUS_SUCCESS != (VOS_STATUS)pFTPreAuthRsp->status) |
| 15672 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15673 | // Implies a success |
| 15674 | pMac->ft.ftSmeContext.FTState = eFT_AUTH_COMPLETE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15675 | // Indicate SME QoS module the completion of Preauth success. This will trigger the creation of RIC IEs |
| 15676 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = pFTPreAuthRsp; |
| 15677 | 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] | 15678 | /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, |
| 15679 | * actual transition from the current to handoff AP is triggered */ |
| 15680 | status = palTimerStart(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer, |
| 15681 | 60 * PAL_TIMER_TO_MS_UNIT, |
| 15682 | eANI_BOOLEAN_FALSE); |
| 15683 | if (eHAL_STATUS_SUCCESS != status) |
| 15684 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15685 | smsLog(pMac, LOGE, FL("Preauth reassoc interval timer start failed to start with status %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15686 | return; |
| 15687 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15688 | // Save the received response |
| 15689 | palCopyMemory(pMac->hHdd, (void *)&pMac->ft.ftSmeContext.preAuthbssId, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 15690 | if (csrRoamIs11rAssoc(pMac)) |
| 15691 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, NULL, 0, |
| 15692 | eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE); |
| 15693 | |
| 15694 | // Currently we dont do anything special for CCX connection. |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15695 | #ifdef FEATURE_WLAN_LFR |
| 15696 | // If Legacy Fast Roaming is enabled, signal the supplicant |
| 15697 | // So he can send us a PMK-ID for this candidate AP. |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 15698 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15699 | { |
| 15700 | // Save the bssid from the received response |
| 15701 | palCopyMemory(pMac->hHdd, (void *)&roamInfo.bssid, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 15702 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_PMK_NOTIFY, 0); |
| 15703 | } |
| 15704 | |
| 15705 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15706 | |
| 15707 | // Done with it, init it. |
| 15708 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL; |
| 15709 | } |
| 15710 | #endif |
| 15711 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 15712 | void csrRoamJoinRetryTimerHandler(void *pv) |
| 15713 | { |
| 15714 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 15715 | tpAniSirGlobal pMac = pInfo->pMac; |
| 15716 | tANI_U32 sessionId = pInfo->sessionId; |
| 15717 | tCsrRoamSession *pSession; |
| 15718 | |
| 15719 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 15720 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15721 | smsLog( pMac, LOGE, FL( " retrying the last roam profile on session %d" ), sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15722 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15723 | if(pSession->pCurRoamProfile && csrIsConnStateDisconnected(pMac, sessionId)) |
| 15724 | { |
| 15725 | if( !HAL_STATUS_SUCCESS(csrRoamJoinLastProfile(pMac, sessionId)) ) |
| 15726 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15727 | smsLog( pMac, LOGE, FL( " fail to retry the last roam profile" ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15728 | } |
| 15729 | } |
| 15730 | } |
| 15731 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15732 | eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 15733 | { |
| 15734 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15735 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15736 | |
| 15737 | if(pSession->pCurRoamProfile && pSession->maxRetryCount) |
| 15738 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15739 | smsLog(pMac, LOGE, FL(" call sessionId %d retry count %d left"), sessionId, pSession->maxRetryCount); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15740 | pSession->maxRetryCount--; |
| 15741 | pSession->joinRetryTimerInfo.pMac = pMac; |
| 15742 | pSession->joinRetryTimerInfo.sessionId = (tANI_U8)sessionId; |
| 15743 | status = palTimerStart(pMac->hHdd, pSession->hTimerJoinRetry, interval, eANI_BOOLEAN_FALSE); |
| 15744 | if(!HAL_STATUS_SUCCESS(status)) |
| 15745 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15746 | smsLog(pMac, LOGE, FL(" fail to start timer status %s"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15747 | } |
| 15748 | } |
| 15749 | else |
| 15750 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15751 | smsLog(pMac, LOGE, FL(" not to start timer due to no profile or reach mac ret (%d)"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15752 | pSession->maxRetryCount); |
| 15753 | } |
| 15754 | |
| 15755 | return (status); |
| 15756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15757 | eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 15758 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15759 | smsLog(pMac, LOGE, " csrRoamStopJoinRetryTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15760 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 15761 | { |
| 15762 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerJoinRetry)); |
| 15763 | } |
| 15764 | |
| 15765 | return eHAL_STATUS_SUCCESS; |
| 15766 | } |
| 15767 | #endif |
| 15768 | |
| 15769 | |
| 15770 | /* |
| 15771 | pBuf points to the beginning of the message |
| 15772 | LIM packs disassoc rsp as below, |
| 15773 | messageType - 2 bytes |
| 15774 | messageLength - 2 bytes |
| 15775 | sessionId - 1 byte |
| 15776 | transactionId - 2 bytes (tANI_U16) |
| 15777 | reasonCode - 4 bytes (sizeof(tSirResultCodes)) |
| 15778 | peerMacAddr - 6 bytes |
| 15779 | The rest is conditionally defined of (WNI_POLARIS_FW_PRODUCT == AP) and not used |
| 15780 | */ |
| 15781 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp) |
| 15782 | { |
| 15783 | if(pBuf && pRsp) |
| 15784 | { |
| 15785 | pBuf += 4; //skip type and length |
| 15786 | pRsp->sessionId = *pBuf++; |
| 15787 | pal_get_U16( pBuf, (tANI_U16 *)&pRsp->transactionId ); |
| 15788 | pBuf += 2; |
| 15789 | pal_get_U32( pBuf, (tANI_U32 *)&pRsp->statusCode ); |
| 15790 | pBuf += 4; |
| 15791 | vos_mem_copy(pRsp->peerMacAddr, pBuf, 6); |
| 15792 | } |
| 15793 | } |
| 15794 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 15795 | eHalStatus csrGetDefaultCountryCodeFrmNv(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 15796 | { |
| 15797 | static uNvTables nvTables; |
| 15798 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15799 | VOS_STATUS vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 15800 | |
| 15801 | /* read the country code from NV and use it */ |
| 15802 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 15803 | { |
| 15804 | palCopyMemory( pMac->hHdd, pCountry, |
| 15805 | nvTables.defaultCountryTable.countryCode, |
| 15806 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 15807 | return status; |
| 15808 | } |
| 15809 | else |
| 15810 | { |
| 15811 | palCopyMemory( pMac->hHdd, pCountry, |
| 15812 | "XXX", |
| 15813 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 15814 | status = eHAL_STATUS_FAILURE; |
| 15815 | return status; |
| 15816 | } |
| 15817 | } |
| 15818 | |
| 15819 | eHalStatus csrGetCurrentCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 15820 | { |
| 15821 | palCopyMemory( pMac->hHdd, pCountry, |
| 15822 | pMac->scan.countryCode11d, |
| 15823 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 15824 | return eHAL_STATUS_SUCCESS; |
| 15825 | } |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 15826 | |
| 15827 | eHalStatus csrSetTxPower(tpAniSirGlobal pMac, v_U8_t sessionId, v_U8_t mW) |
| 15828 | { |
| 15829 | tSirSetTxPowerReq *pMsg = NULL; |
| 15830 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15831 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 15832 | |
| 15833 | if (!pSession) |
| 15834 | { |
| 15835 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 15836 | return eHAL_STATUS_FAILURE; |
| 15837 | } |
| 15838 | |
| 15839 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tSirSetTxPowerReq)); |
| 15840 | if (HAL_STATUS_SUCCESS(status)) |
| 15841 | { |
| 15842 | palZeroMemory(pMac->hHdd, (void *)pMsg, sizeof(tSirSetTxPowerReq)); |
| 15843 | pMsg->messageType = eWNI_SME_SET_TX_POWER_REQ; |
| 15844 | pMsg->length = sizeof(tSirSetTxPowerReq); |
| 15845 | pMsg->mwPower = mW; |
| 15846 | palCopyMemory( pMac->hHdd, |
| 15847 | (tSirMacAddr *)pMsg->bssId, |
| 15848 | &pSession->selfMacAddr, |
| 15849 | sizeof(tSirMacAddr) ); |
| 15850 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 15851 | if (!HAL_STATUS_SUCCESS(status)) |
| 15852 | { |
| 15853 | smsLog(pMac, LOGE, FL(" csr set TX Power Post MSG Fail %d "), status); |
Tushnim Bhattacharyya | 41f7286 | 2013-04-03 21:34:01 -0700 | [diff] [blame] | 15854 | //pMsg is freed by palSendMBMessage |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 15855 | } |
| 15856 | } |
| 15857 | return status; |
| 15858 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15859 | |
| 15860 | /* Returns whether a session is in VOS_STA_MODE...or not */ |
| 15861 | tANI_BOOLEAN csrRoamIsStaMode(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 15862 | { |
| 15863 | tCsrRoamSession *pSession = NULL; |
| 15864 | pSession = CSR_GET_SESSION ( pMac, sessionId ); |
| 15865 | if(!pSession) |
| 15866 | { |
| 15867 | smsLog(pMac, LOGE, FL(" %s: session %d not found "), __func__, sessionId); |
| 15868 | return eANI_BOOLEAN_FALSE; |
| 15869 | } |
| 15870 | if ( !CSR_IS_SESSION_VALID ( pMac, sessionId ) ) |
| 15871 | { |
| 15872 | smsLog(pMac, LOGE, FL(" %s: Inactive session"), __func__); |
| 15873 | return eANI_BOOLEAN_FALSE; |
| 15874 | } |
| 15875 | if ( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 15876 | { |
| 15877 | return eANI_BOOLEAN_FALSE; |
| 15878 | } |
| 15879 | /* There is a possibility that the above check may fail,because |
| 15880 | * P2P CLI also uses the same BSSType (eCSR_BSS_TYPE_INFRASTRUCTURE) |
| 15881 | * when it is connected.So,we may sneak through the above check even |
| 15882 | * if we are not a STA mode INFRA station. So, if we sneak through |
| 15883 | * the above condition, we can use the following check if we are |
| 15884 | * really in STA Mode.*/ |
| 15885 | |
| 15886 | if ( NULL != pSession->pCurRoamProfile ) |
| 15887 | { |
| 15888 | if ( pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE ) |
| 15889 | { |
| 15890 | return eANI_BOOLEAN_TRUE; |
| 15891 | } else { |
| 15892 | smsLog(pMac, LOGE, FL(" %s: pCurRoamProfile is NULL\n"), __func__); |
| 15893 | return eANI_BOOLEAN_FALSE; |
| 15894 | } |
| 15895 | } |
| 15896 | |
| 15897 | return eANI_BOOLEAN_FALSE; |
| 15898 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 15899 | |
| 15900 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 15901 | eHalStatus csrHandoffRequest(tpAniSirGlobal pMac, |
| 15902 | tCsrHandoffRequest *pHandoffInfo) |
| 15903 | { |
| 15904 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15905 | vos_msg_t msg; |
| 15906 | |
| 15907 | tAniHandoffReq *pMsg; |
| 15908 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniHandoffReq)); |
| 15909 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 15910 | { |
| 15911 | smsLog(pMac, LOGE, " csrHandoffRequest: failed to allocate mem for req "); |
| 15912 | return status; |
| 15913 | } |
| 15914 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_HANDOFF_REQ); |
| 15915 | pMsg->msgLen = (tANI_U16)sizeof(tAniHandoffReq); |
| 15916 | pMsg->sessionId = pMac->roam.neighborRoamInfo.csrSessionId; |
| 15917 | pMsg->channel = pHandoffInfo->channel; |
| 15918 | palCopyMemory(pMac->hHdd, pMsg->bssid, |
| 15919 | pHandoffInfo->bssid, |
| 15920 | 6); |
| 15921 | msg.type = eWNI_SME_HANDOFF_REQ; |
| 15922 | msg.bodyptr = pMsg; |
| 15923 | msg.reserved = 0; |
| 15924 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 15925 | { |
| 15926 | smsLog(pMac, LOGE, " csrHandoffRequest failed to post msg to self "); |
| 15927 | palFreeMemory(pMac->hHdd, (void *)pMsg); |
| 15928 | status = eHAL_STATUS_FAILURE; |
| 15929 | } |
| 15930 | return status; |
| 15931 | } |
| 15932 | #endif /* WLAN_FEATURE_ROAM_SCAN_OFFLOAD */ |