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 | csrRoamClose(pMac); |
| 446 | csrScanClose(pMac); |
| 447 | csrLLClose(&pMac->roam.statsClientReqList); |
| 448 | csrLLClose(&pMac->roam.peStatsReqList); |
| 449 | csrLLClose(&pMac->roam.roamCmdPendingList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 450 | /* DeInit Globals */ |
| 451 | csrRoamDeInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 452 | return (status); |
| 453 | } |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 454 | |
| 455 | eHalStatus csrUpdateChannelList(tCsrScanStruct *pScan) |
| 456 | { |
| 457 | tSirUpdateChanList *pChanList; |
| 458 | tANI_U8 numChan = pScan->base20MHzChannels.numChannels; |
| 459 | tANI_U32 bufLen = sizeof(tSirUpdateChanList) + |
| 460 | (sizeof(tSirUpdateChanParam) * (numChan - 1)); |
| 461 | vos_msg_t msg; |
| 462 | tANI_U8 i; |
| 463 | |
| 464 | pChanList = (tSirUpdateChanList *) vos_mem_malloc(bufLen); |
| 465 | if (!pChanList) |
| 466 | { |
| 467 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 468 | "Failed to allocate memory for tSirUpdateChanList"); |
| 469 | return eHAL_STATUS_FAILED_ALLOC; |
| 470 | } |
| 471 | |
| 472 | msg.type = WDA_UPDATE_CHAN_LIST_REQ; |
| 473 | msg.reserved = 0; |
| 474 | msg.bodyptr = pChanList; |
| 475 | pChanList->numChan = numChan; |
| 476 | for (i = 0; i < pChanList->numChan; i++) |
| 477 | { |
| 478 | pChanList->chanParam[i].chanId = pScan->defaultPowerTable[i].chanId; |
| 479 | pChanList->chanParam[i].pwr = pScan->defaultPowerTable[i].pwr; |
| 480 | } |
| 481 | |
| 482 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 483 | { |
| 484 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
| 485 | "%s: Failed to post msg to WDA", __func__); |
| 486 | vos_mem_free(pChanList); |
| 487 | return eHAL_STATUS_FAILURE; |
| 488 | } |
| 489 | |
| 490 | return eHAL_STATUS_SUCCESS; |
| 491 | } |
| 492 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 493 | eHalStatus csrStart(tpAniSirGlobal pMac) |
| 494 | { |
| 495 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 496 | tANI_U32 i; |
| 497 | |
| 498 | do |
| 499 | { |
| 500 | //save the global vos context |
| 501 | pMac->roam.gVosContext = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 502 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 503 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, i ); |
| 504 | |
| 505 | status = csrRoamStart(pMac); |
| 506 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 507 | pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE; |
| 508 | status = pmcRegisterPowerSaveCheck(pMac, csrCheckPSReady, pMac); |
| 509 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 510 | pMac->roam.sPendingCommands = 0; |
| 511 | csrScanEnable(pMac); |
| 512 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 513 | status = csrNeighborRoamInit(pMac); |
| 514 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
| 515 | pMac->roam.tlStatsReqInfo.numClient = 0; |
| 516 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 517 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 518 | //init the link quality indication also |
| 519 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND; |
| 520 | if(!HAL_STATUS_SUCCESS(status)) |
| 521 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 522 | smsLog(pMac, LOGW, " csrStart: Couldn't Init HO control blk "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 523 | break; |
| 524 | } |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 525 | |
| 526 | if (pMac->fScanOffload) |
| 527 | { |
| 528 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 529 | "Scan offload is enabled, update default chan list"); |
| 530 | status = csrUpdateChannelList(&pMac->scan); |
| 531 | } |
| 532 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 533 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 534 | #if defined(ANI_LOGDUMP) |
| 535 | csrDumpInit(pMac); |
| 536 | #endif //#if defined(ANI_LOGDUMP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 537 | return (status); |
| 538 | } |
| 539 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 540 | eHalStatus csrStop(tpAniSirGlobal pMac) |
| 541 | { |
| 542 | tANI_U32 sessionId; |
| 543 | tANI_U32 i; |
| 544 | |
| 545 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 546 | { |
| 547 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 548 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 549 | csrScanDisable(pMac); |
| 550 | pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE; |
| 551 | pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 552 | csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE ); |
| 553 | |
| 554 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 555 | csrNeighborRoamClose(pMac); |
| 556 | #endif |
| 557 | csrScanFlushResult(pMac); //Do we want to do this? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 558 | // deregister from PMC since we register during csrStart() |
| 559 | // (ignore status since there is nothing we can do if it fails) |
| 560 | (void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 561 | //Reset the domain back to the deault |
| 562 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 563 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 564 | |
| 565 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 566 | { |
| 567 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP ,i ); |
| 568 | pMac->roam.curSubState[i] = eCSR_ROAM_SUBSTATE_NONE; |
| 569 | } |
| 570 | |
| 571 | return (eHAL_STATUS_SUCCESS); |
| 572 | } |
| 573 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 574 | eHalStatus csrReady(tpAniSirGlobal pMac) |
| 575 | { |
| 576 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 577 | csrScanGetSupportedChannels( pMac ); |
| 578 | //WNI_CFG_VALID_CHANNEL_LIST should be set by this time |
| 579 | //use it to init the background scan list |
| 580 | csrInitBGScanChannelList(pMac); |
| 581 | /* HDD issues the init scan */ |
| 582 | csrScanStartResultAgingTimer(pMac); |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 583 | /* If the gScanAgingTime is set to '0' then scan results aging timeout |
| 584 | based on timer feature is not enabled*/ |
| 585 | if(0 != pMac->scan.scanResultCfgAgingTime ) |
| 586 | { |
| 587 | csrScanStartResultCfgAgingTimer(pMac); |
| 588 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 589 | //Store the AC weights in TL for later use |
| 590 | WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 591 | status = csrInitChannelList( pMac ); |
| 592 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 593 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 594 | smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 595 | status ); |
| 596 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 597 | return (status); |
| 598 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 599 | void csrSetDefaultDot11Mode( tpAniSirGlobal pMac ) |
| 600 | { |
| 601 | v_U32_t wniDot11mode = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 602 | wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode); |
| 603 | ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE); |
| 604 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 605 | void csrSetGlobalCfgs( tpAniSirGlobal pMac ) |
| 606 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 607 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 608 | ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 609 | ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 610 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 611 | ((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled), |
| 612 | NULL, eANI_BOOLEAN_FALSE); |
| 613 | 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] | 614 | /* 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 |
| 615 | * Once session is established we will use the session related params stored in PE session for CB mode |
| 616 | */ |
| 617 | 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] | 618 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE); |
| 619 | |
| 620 | //Update the operating mode to configured value during initialization, |
| 621 | //So that client can advertise full capabilities in Probe request frame. |
| 622 | csrSetDefaultDot11Mode( pMac ); |
| 623 | } |
| 624 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 625 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac) |
| 626 | { |
| 627 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 628 | tANI_U32 i; |
| 629 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 630 | do |
| 631 | { |
| 632 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 633 | { |
| 634 | pSession = CSR_GET_SESSION( pMac, i ); |
| 635 | pSession->roamingTimerInfo.pMac = pMac; |
| 636 | pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 637 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 638 | pMac->roam.WaitForKeyTimerInfo.pMac = pMac; |
| 639 | pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 640 | status = palTimerAlloc(pMac->hHdd, &pMac->roam.hTimerWaitForKey, csrRoamWaitForKeyTimeOutHandler, |
| 641 | &pMac->roam.WaitForKeyTimerInfo); |
| 642 | if(!HAL_STATUS_SUCCESS(status)) |
| 643 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 644 | smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 645 | break; |
| 646 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 647 | status = palTimerAlloc(pMac->hHdd, &pMac->roam.tlStatsReqInfo.hTlStatsTimer, csrRoamTlStatsTimerHandler, pMac); |
| 648 | if(!HAL_STATUS_SUCCESS(status)) |
| 649 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 650 | smsLog(pMac, LOGE, FL("cannot allocate memory for summary Statistics timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 651 | return eHAL_STATUS_FAILURE; |
| 652 | } |
| 653 | }while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 654 | return (status); |
| 655 | } |
| 656 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 657 | eHalStatus csrRoamClose(tpAniSirGlobal pMac) |
| 658 | { |
| 659 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 660 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 661 | { |
| 662 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 663 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 664 | palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey); |
| 665 | palTimerFree(pMac->hHdd, pMac->roam.hTimerWaitForKey); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 666 | palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 667 | palTimerFree(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 668 | return (eHAL_STATUS_SUCCESS); |
| 669 | } |
| 670 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 671 | eHalStatus csrRoamStart(tpAniSirGlobal pMac) |
| 672 | { |
| 673 | (void)pMac; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 674 | return (eHAL_STATUS_SUCCESS); |
| 675 | } |
| 676 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 677 | void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 678 | { |
| 679 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 680 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 681 | csrRoamDeregStatisticsReq(pMac); |
| 682 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 683 | eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState) |
| 684 | { |
| 685 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Srinivas Girigowda | c84c57c | 2013-02-19 17:41:56 -0800 | [diff] [blame] | 686 | if ( CSR_IS_SESSION_VALID(pMac, sessionId) && (NULL != pState) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 687 | { |
| 688 | status = eHAL_STATUS_SUCCESS; |
| 689 | *pState = pMac->roam.roamSession[sessionId].connectState; |
| 690 | } |
| 691 | return (status); |
| 692 | } |
| 693 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 694 | eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 695 | { |
| 696 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 697 | tANI_U32 size = 0; |
| 698 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 699 | |
| 700 | if(!pSession) |
| 701 | { |
| 702 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 703 | return eHAL_STATUS_FAILURE; |
| 704 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 705 | |
| 706 | if(pProfile) |
| 707 | { |
| 708 | if(pSession->pConnectBssDesc) |
| 709 | { |
| 710 | do |
| 711 | { |
| 712 | size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length); |
| 713 | if(size) |
| 714 | { |
| 715 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile->pBssDesc, size); |
| 716 | if(HAL_STATUS_SUCCESS(status)) |
| 717 | { |
| 718 | palCopyMemory(pMac->hHdd, pProfile->pBssDesc, pSession->pConnectBssDesc, size); |
| 719 | } |
| 720 | else |
| 721 | break; |
| 722 | } |
| 723 | else |
| 724 | { |
| 725 | pProfile->pBssDesc = NULL; |
| 726 | } |
| 727 | pProfile->AuthType = pSession->connectedProfile.AuthType; |
| 728 | pProfile->EncryptionType = pSession->connectedProfile.EncryptionType; |
| 729 | pProfile->mcEncryptionType = pSession->connectedProfile.mcEncryptionType; |
| 730 | pProfile->BSSType = pSession->connectedProfile.BSSType; |
| 731 | pProfile->operationChannel = pSession->connectedProfile.operationChannel; |
| 732 | pProfile->CBMode = pSession->connectedProfile.CBMode; |
| 733 | palCopyMemory(pMac->hHdd, &pProfile->bssid, &pSession->connectedProfile.bssid, sizeof(tCsrBssid)); |
| 734 | palCopyMemory(pMac->hHdd, &pProfile->SSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid)); |
| 735 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 736 | if (pSession->connectedProfile.MDID.mdiePresent) |
| 737 | { |
| 738 | pProfile->MDID.mdiePresent = 1; |
| 739 | pProfile->MDID.mobilityDomain = pSession->connectedProfile.MDID.mobilityDomain; |
| 740 | } |
| 741 | else |
| 742 | { |
| 743 | pProfile->MDID.mdiePresent = 0; |
| 744 | pProfile->MDID.mobilityDomain = 0; |
| 745 | } |
| 746 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 747 | #ifdef FEATURE_WLAN_CCX |
| 748 | pProfile->isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 749 | if (csrIsAuthTypeCCX(pSession->connectedProfile.AuthType)) |
| 750 | { |
| 751 | palCopyMemory( pMac->hHdd, pProfile->ccxCckmInfo.krk, |
| 752 | pSession->connectedProfile.ccxCckmInfo.krk, CSR_KRK_KEY_LEN ); |
| 753 | pProfile->ccxCckmInfo.reassoc_req_num= |
| 754 | pSession->connectedProfile.ccxCckmInfo.reassoc_req_num; |
| 755 | pProfile->ccxCckmInfo.krk_plumbed = |
| 756 | pSession->connectedProfile.ccxCckmInfo.krk_plumbed; |
| 757 | } |
| 758 | #endif |
| 759 | }while(0); |
| 760 | } |
| 761 | } |
| 762 | |
| 763 | return (status); |
| 764 | } |
| 765 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 766 | eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 767 | { |
| 768 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | fec1ecb | 2013-05-03 08:10:33 -0700 | [diff] [blame] | 769 | |
| 770 | if((csrIsConnStateConnected(pMac, sessionId)) || |
| 771 | (csrIsConnStateIbss(pMac, sessionId))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 772 | { |
| 773 | if(pProfile) |
| 774 | { |
| 775 | status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile); |
| 776 | } |
| 777 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 778 | return (status); |
| 779 | } |
Jeff Johnson | fec1ecb | 2013-05-03 08:10:33 -0700 | [diff] [blame] | 780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 781 | eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile) |
| 782 | { |
| 783 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 784 | |
| 785 | if(pProfile->pBssDesc) |
| 786 | { |
| 787 | palFreeMemory(pMac->hHdd, pProfile->pBssDesc); |
| 788 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 789 | if(pProfile->pAddIEAssoc) |
| 790 | { |
| 791 | palFreeMemory(pMac->hHdd, pProfile->pAddIEAssoc); |
| 792 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 793 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamConnectedProfile)); |
| 794 | pProfile->AuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 795 | return (status); |
| 796 | } |
| 797 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 798 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ) |
| 799 | { |
| 800 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 801 | if( pConnectedInfo->pbFrames ) |
| 802 | { |
| 803 | palFreeMemory( pMac->hHdd, pConnectedInfo->pbFrames ); |
| 804 | pConnectedInfo->pbFrames = NULL; |
| 805 | } |
| 806 | pConnectedInfo->nBeaconLength = 0; |
| 807 | pConnectedInfo->nAssocReqLength = 0; |
| 808 | pConnectedInfo->nAssocRspLength = 0; |
| 809 | pConnectedInfo->staId = 0; |
| 810 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 811 | pConnectedInfo->nRICRspLength = 0; |
| 812 | #endif |
| 813 | #ifdef FEATURE_WLAN_CCX |
| 814 | pConnectedInfo->nTspecIeLength = 0; |
| 815 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 816 | return ( status ); |
| 817 | } |
| 818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 819 | |
| 820 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 821 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 822 | void csrReleaseCommandPreauth(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 823 | { |
| 824 | csrReinitPreauthCmd(pMac, pCommand); |
| 825 | csrReleaseCommand( pMac, pCommand ); |
| 826 | } |
| 827 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 828 | void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 829 | { |
| 830 | csrReinitRoamCmd(pMac, pCommand); |
| 831 | csrReleaseCommand( pMac, pCommand ); |
| 832 | } |
| 833 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 834 | void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 835 | { |
| 836 | csrReinitScanCmd(pMac, pCommand); |
| 837 | csrReleaseCommand( pMac, pCommand ); |
| 838 | } |
| 839 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 840 | void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 841 | { |
| 842 | csrReinitWmStatusChangeCmd(pMac, pCommand); |
| 843 | csrReleaseCommand( pMac, pCommand ); |
| 844 | } |
| 845 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 846 | void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 847 | { |
| 848 | palZeroMemory(pMac->hHdd, &pCommand->u.setKeyCmd, sizeof(tSetKeyCmd)); |
| 849 | } |
| 850 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 851 | void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 852 | { |
| 853 | palZeroMemory(pMac->hHdd, &pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd)); |
| 854 | } |
| 855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 856 | void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 857 | { |
| 858 | csrReinitSetKeyCmd(pMac, pCommand); |
| 859 | csrReleaseCommand( pMac, pCommand ); |
| 860 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 861 | void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 862 | { |
| 863 | csrReinitRemoveKeyCmd(pMac, pCommand); |
| 864 | csrReleaseCommand( pMac, pCommand ); |
| 865 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping ) |
| 867 | { |
| 868 | |
| 869 | if( eSmeCsrCommandMask & pCommand->command ) |
| 870 | { |
| 871 | switch (pCommand->command) |
| 872 | { |
| 873 | case eSmeCommandScan: |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 874 | // We need to inform the requester before dropping the scan command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 875 | smsLog( pMac, LOGW, "%s: Drop scan reason %d callback 0x%X", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 876 | __func__, pCommand->u.scanCmd.reason, (unsigned int)pCommand->u.scanCmd.callback); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 877 | if (NULL != pCommand->u.scanCmd.callback) |
| 878 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 879 | smsLog( pMac, LOGW, "%s callback scan requester", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 880 | csrScanCallCallback(pMac, pCommand, eCSR_SCAN_ABORT); |
| 881 | } |
| 882 | csrReleaseCommandScan( pMac, pCommand ); |
| 883 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 884 | case eSmeCommandRoam: |
| 885 | csrReleaseCommandRoam( pMac, pCommand ); |
| 886 | break; |
| 887 | |
| 888 | case eSmeCommandWmStatusChange: |
| 889 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 890 | break; |
| 891 | |
| 892 | case eSmeCommandSetKey: |
| 893 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 894 | break; |
| 895 | |
| 896 | case eSmeCommandRemoveKey: |
| 897 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 898 | break; |
| 899 | |
| 900 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 901 | smsLog( pMac, LOGW, " CSR abort standard command %d", pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 902 | csrReleaseCommand( pMac, pCommand ); |
| 903 | break; |
| 904 | } |
| 905 | } |
| 906 | } |
| 907 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 908 | void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId) |
| 909 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 910 | smsLog( pMac, LOG1, " CSR RoamSubstate: [ %d <== %d ]", NewSubstate, pMac->roam.curSubState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 912 | if(pMac->roam.curSubState[sessionId] == NewSubstate) |
| 913 | { |
| 914 | return; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 915 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 916 | pMac->roam.curSubState[sessionId] = NewSubstate; |
| 917 | } |
| 918 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 919 | eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId) |
| 920 | { |
| 921 | eCsrRoamState PreviousState; |
| 922 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 923 | smsLog( pMac, LOG1, "CSR RoamState: [ %d <== %d ]", NewRoamState, pMac->roam.curState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 924 | |
| 925 | PreviousState = pMac->roam.curState[sessionId]; |
| 926 | |
| 927 | if ( NewRoamState != pMac->roam.curState[sessionId] ) |
| 928 | { |
| 929 | // Whenever we transition OUT of the Roaming state, clear the Roaming substate... |
| 930 | if ( CSR_IS_ROAM_JOINING(pMac, sessionId) ) |
| 931 | { |
| 932 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 933 | } |
| 934 | |
| 935 | pMac->roam.curState[sessionId] = NewRoamState; |
| 936 | } |
| 937 | return( PreviousState ); |
| 938 | } |
| 939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 940 | void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset) |
| 941 | { |
| 942 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 943 | if(catOffset) |
| 944 | { |
| 945 | pMac->roam.configParam.bCatRssiOffset = catOffset; |
| 946 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 947 | { |
| 948 | pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)CSR_BEST_RSSI_VALUE - (int)(i * catOffset); |
| 949 | } |
| 950 | } |
| 951 | } |
| 952 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 953 | static void initConfigParam(tpAniSirGlobal pMac) |
| 954 | { |
| 955 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 956 | pMac->roam.configParam.agingCount = CSR_AGING_COUNT; |
| 957 | pMac->roam.configParam.channelBondingMode24GHz = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 958 | pMac->roam.configParam.channelBondingMode5GHz = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 959 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 960 | pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 961 | pMac->roam.configParam.eBand = eCSR_BAND_ALL; |
| 962 | pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 963 | pMac->roam.configParam.FragmentationThreshold = eCSR_DOT11_FRAG_THRESH_DEFAULT; |
| 964 | pMac->roam.configParam.HeartbeatThresh24 = 40; |
| 965 | pMac->roam.configParam.HeartbeatThresh50 = 40; |
| 966 | pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE; |
| 967 | pMac->roam.configParam.Is11dSupportEnabledOriginal = eANI_BOOLEAN_FALSE; |
| 968 | pMac->roam.configParam.Is11eSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 969 | pMac->roam.configParam.Is11hSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 970 | pMac->roam.configParam.RTSThreshold = 2346; |
| 971 | pMac->roam.configParam.shortSlotTime = eANI_BOOLEAN_TRUE; |
| 972 | pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto; |
| 973 | pMac->roam.configParam.ProprietaryRatesEnabled = eANI_BOOLEAN_TRUE; |
| 974 | pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO; |
| 975 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 976 | pMac->roam.configParam.scanAgeTimeNCNPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS; |
| 977 | pMac->roam.configParam.scanAgeTimeNCPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS; |
| 978 | pMac->roam.configParam.scanAgeTimeCNPS = CSR_SCAN_AGING_TIME_CONNECT_NO_PS; |
| 979 | pMac->roam.configParam.scanAgeTimeCPS = CSR_SCAN_AGING_TIME_CONNECT_W_PS; |
| 980 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 981 | { |
| 982 | pMac->roam.configParam.BssPreferValue[i] = i; |
| 983 | } |
| 984 | csrAssignRssiForCategory(pMac, CSR_DEFAULT_RSSI_DB_GAP); |
| 985 | pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME; |
| 986 | pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE; |
| 987 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 988 | pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE; |
| 989 | pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE; |
| 990 | pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; |
| 991 | pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; |
| 992 | pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME; |
| 993 | pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME; |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 994 | pMac->roam.configParam.nActiveMaxChnTimeBtc = CSR_ACTIVE_MAX_CHANNEL_TIME_BTC; |
| 995 | pMac->roam.configParam.nActiveMinChnTimeBtc = CSR_ACTIVE_MIN_CHANNEL_TIME_BTC; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 996 | pMac->roam.configParam.disableAggWithBtc = eANI_BOOLEAN_TRUE; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 997 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 998 | pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC; |
| 999 | pMac->roam.configParam.nActiveMinChnTimeConc = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC; |
| 1000 | pMac->roam.configParam.nPassiveMaxChnTimeConc = CSR_PASSIVE_MAX_CHANNEL_TIME_CONC; |
| 1001 | pMac->roam.configParam.nPassiveMinChnTimeConc = CSR_PASSIVE_MIN_CHANNEL_TIME_CONC; |
| 1002 | pMac->roam.configParam.nRestTimeConc = CSR_REST_TIME_CONC; |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1003 | pMac->roam.configParam.nNumStaChanCombinedConc = CSR_NUM_STA_CHAN_COMBINED_CONC; |
| 1004 | pMac->roam.configParam.nNumP2PChanCombinedConc = CSR_NUM_P2P_CHAN_COMBINED_CONC; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1005 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1006 | pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default |
| 1007 | pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; |
| 1008 | pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; |
| 1009 | pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1010 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1011 | pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0; |
| 1012 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1013 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1014 | pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3; |
| 1015 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120; |
| 1016 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = 125; |
| 1017 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20; |
| 1018 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40; |
| 1019 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = 200; |
| 1020 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels = 3; |
| 1021 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[0] = 1; |
| 1022 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[1] = 6; |
| 1023 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11; |
| 1024 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1025 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1026 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1027 | #ifdef WLAN_FEATURE_11AC |
| 1028 | pMac->roam.configParam.nVhtChannelWidth = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1; |
| 1029 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1030 | |
| 1031 | pMac->roam.configParam.addTSWhenACMIsOff = 0; |
| 1032 | pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE; |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1033 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1034 | //Remove this code once SLM_Sessionization is supported |
| 1035 | //BMPS_WORKAROUND_NOT_NEEDED |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1036 | pMac->roam.configParam.doBMPSWorkaround = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1037 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1038 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1039 | eCsrBand csrGetCurrentBand(tHalHandle hHal) |
| 1040 | { |
| 1041 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1042 | return pMac->roam.configParam.bandCapability; |
| 1043 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1044 | |
| 1045 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1046 | tANI_BOOLEAN csrIsChannelInCountryValidList(tpAniSirGlobal pMac, tANI_U8 channel) |
| 1047 | { |
| 1048 | /* Get country code from CFG */ |
| 1049 | tANI_U8 *pCountryCode = pMac->scan.countryCodeCurrent; |
| 1050 | tANI_U8 i = 0; |
| 1051 | v_BOOL_t retVal = FALSE; |
| 1052 | tANI_U8 *pCountryValidChannelList = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList; |
| 1053 | tANI_U8 *pNumChannels = &pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels; |
| 1054 | |
| 1055 | /* Compare against KR valid list */ |
| 1056 | if ((0 == strncmp(pCountryCode, "KR", 2)) && |
| 1057 | (NULL != pCountryValidChannelList)) |
| 1058 | { |
| 1059 | for (i = 0; i <(*pNumChannels); i++) |
| 1060 | { |
| 1061 | if (channel == pCountryValidChannelList[i]) |
| 1062 | { |
| 1063 | retVal = TRUE; |
| 1064 | break; |
| 1065 | } |
| 1066 | } |
| 1067 | } |
| 1068 | else |
| 1069 | { |
| 1070 | retVal = csrRoamIsChannelValid(pMac, channel); |
| 1071 | } |
| 1072 | |
| 1073 | return retVal; |
| 1074 | } |
| 1075 | |
| 1076 | void csr_SetRevision(tpAniSirGlobal pMac, tANI_U8 revision) |
| 1077 | { |
| 1078 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1079 | pNeighborRoamInfo->cfgParams.countryChannelInfo.revision = revision; |
| 1080 | } |
| 1081 | |
| 1082 | /* |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1083 | This function flushes the roam scan cache |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1084 | */ |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1085 | eHalStatus csrFlushBgScanRoamChannelList(tpAniSirGlobal pMac) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1086 | { |
| 1087 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1088 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1089 | |
| 1090 | /* Free up the memory first (if required) */ |
| 1091 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1092 | { |
| 1093 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 1094 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1095 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1096 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1097 | return status; |
| 1098 | } |
| 1099 | |
| 1100 | |
| 1101 | |
| 1102 | /* |
| 1103 | This function flushes the roam scan cache and creates fresh cache |
| 1104 | based on the input channel list |
| 1105 | */ |
| 1106 | eHalStatus csrCreateBgScanRoamChannelList(tpAniSirGlobal pMac, |
| 1107 | const tANI_U8 *pChannelList, |
| 1108 | const tANI_U8 numChannels) |
| 1109 | { |
| 1110 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1111 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1112 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1113 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = numChannels; |
| 1114 | |
| 1115 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = |
| 1116 | vos_mem_malloc(pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
| 1117 | |
| 1118 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1119 | { |
| 1120 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 1121 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
| 1122 | return eHAL_STATUS_RESOURCES; |
| 1123 | } |
| 1124 | |
| 1125 | /* Update the roam global structure */ |
| 1126 | palCopyMemory(pMac->hHdd, pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
| 1127 | pChannelList, |
| 1128 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
| 1129 | return status; |
| 1130 | } |
| 1131 | |
| 1132 | /* This function modifies the bgscan channel list set via config ini or |
| 1133 | runtime, whenever the band changes. |
| 1134 | if the band is auto, then no operation is performed on the channel list |
| 1135 | if the band is 2.4G, then make sure channel list contains only 2.4G valid channels |
| 1136 | if the band is 5G, then make sure channel list contains only 5G valid channels |
| 1137 | */ |
| 1138 | eHalStatus csrUpdateBgScanConfigIniChannelList(tpAniSirGlobal pMac, |
| 1139 | eCsrBand eBand) |
| 1140 | { |
| 1141 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1142 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1143 | tANI_U8 outNumChannels = 0; |
| 1144 | tANI_U8 inNumChannels = 0; |
| 1145 | tANI_U8 *inPtr = NULL; |
| 1146 | tANI_U8 i = 0; |
| 1147 | tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1148 | |
| 1149 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1150 | |
| 1151 | { |
| 1152 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1153 | "No update required for channel list " |
| 1154 | "either cfg.ini channel list is not set up or " |
| 1155 | "auto band (Band %d)", eBand); |
| 1156 | return status; |
| 1157 | } |
| 1158 | |
| 1159 | inNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
| 1160 | inPtr = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 1161 | if (eCSR_BAND_24 == eBand) |
| 1162 | { |
| 1163 | for (i = 0; i < inNumChannels; i++) |
| 1164 | { |
| 1165 | if (CSR_IS_CHANNEL_24GHZ(inPtr[i]) && csrIsChannelInCountryValidList(pMac, inPtr[i])) |
| 1166 | { |
| 1167 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1168 | } |
| 1169 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1170 | csrFlushBgScanRoamChannelList(pMac); |
| 1171 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1172 | } |
| 1173 | else if (eCSR_BAND_5G == eBand) |
| 1174 | { |
| 1175 | for (i = 0; i < inNumChannels; i++) |
| 1176 | { |
| 1177 | /* Add 5G Non-DFS channel */ |
| 1178 | if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) && |
| 1179 | csrIsChannelInCountryValidList(pMac, inPtr[i]) && |
| 1180 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1181 | { |
| 1182 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1183 | } |
| 1184 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1185 | csrFlushBgScanRoamChannelList(pMac); |
| 1186 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1187 | } |
| 1188 | else if (eCSR_BAND_ALL == eBand) |
| 1189 | { |
| 1190 | for (i = 0; i < inNumChannels; i++) |
| 1191 | { |
| 1192 | if (csrIsChannelInCountryValidList(pMac, inPtr[i]) && |
| 1193 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1194 | { |
| 1195 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1196 | } |
| 1197 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1198 | csrFlushBgScanRoamChannelList(pMac); |
| 1199 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1200 | } |
| 1201 | else |
| 1202 | { |
| 1203 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 1204 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 1205 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 1206 | } |
| 1207 | |
| 1208 | return status; |
| 1209 | } |
| 1210 | |
| 1211 | /* |
| 1212 | This function initializes the valid channel list based on country code |
| 1213 | */ |
| 1214 | eHalStatus csrInitCountryValidChannelList(tpAniSirGlobal pMac, |
| 1215 | tANI_U8 Revision) |
| 1216 | { |
| 1217 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1218 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Jeff Johnson | bc4396f | 2013-04-03 18:26:56 -0700 | [diff] [blame] | 1219 | tANI_U8 **pOutChannelList = &pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.ChannelList; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1220 | tANI_U8 *pNumChannels = &pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels; |
| 1221 | const tANI_U8 *pChannelList = NULL; |
| 1222 | |
| 1223 | if (SME_KR_3 == Revision) |
| 1224 | { |
| 1225 | pChannelList = KR_3; |
| 1226 | *pNumChannels = sizeof(KR_3)/sizeof(KR_3[0]); |
| 1227 | } |
| 1228 | else if (SME_KR_24 == Revision) |
| 1229 | { |
| 1230 | pChannelList = KR_24; |
| 1231 | *pNumChannels = sizeof(KR_24)/sizeof(KR_24[0]); |
| 1232 | } |
| 1233 | else if (SME_KR_25 == Revision) |
| 1234 | { |
| 1235 | pChannelList = KR_25; |
| 1236 | *pNumChannels = sizeof(KR_25)/sizeof(KR_25[0]); |
| 1237 | } |
| 1238 | else |
| 1239 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1240 | |
Jeff Johnson | bc4396f | 2013-04-03 18:26:56 -0700 | [diff] [blame] | 1241 | /* Free any existing channel list */ |
| 1242 | vos_mem_free(*pOutChannelList); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1243 | |
Jeff Johnson | bc4396f | 2013-04-03 18:26:56 -0700 | [diff] [blame] | 1244 | *pOutChannelList = vos_mem_malloc(*pNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1245 | |
Jeff Johnson | bc4396f | 2013-04-03 18:26:56 -0700 | [diff] [blame] | 1246 | if (NULL == *pOutChannelList) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1247 | { |
| 1248 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 1249 | *pNumChannels = 0; |
| 1250 | return eHAL_STATUS_RESOURCES; |
| 1251 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1252 | /* Update the roam global structure */ |
Jeff Johnson | bc4396f | 2013-04-03 18:26:56 -0700 | [diff] [blame] | 1253 | palCopyMemory(pMac->hHdd, *pOutChannelList, pChannelList, *pNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1254 | return status; |
| 1255 | } |
| 1256 | |
| 1257 | #endif |
| 1258 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1259 | eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand) |
| 1260 | { |
| 1261 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1262 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1263 | if (CSR_IS_PHY_MODE_A_ONLY(pMac) && |
| 1264 | (eBand == eCSR_BAND_24)) |
| 1265 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1266 | /* DOT11 mode configured to 11a only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1267 | request to change the band to 2.4 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1268 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1269 | "failed to set band cfg80211 = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1270 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1271 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1272 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1273 | if ((CSR_IS_PHY_MODE_B_ONLY(pMac) || |
| 1274 | CSR_IS_PHY_MODE_G_ONLY(pMac)) && |
| 1275 | (eBand == eCSR_BAND_5G)) |
| 1276 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1277 | /* DOT11 mode configured to 11b/11g only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1278 | request to change the band to 5 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1279 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1280 | "failed to set band dot11mode = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1281 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1282 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1283 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1284 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1285 | "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] | 1286 | pMac->roam.configParam.eBand = eBand; |
| 1287 | pMac->roam.configParam.bandCapability = eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1288 | csrScanGetSupportedChannels( pMac ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1289 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1290 | csrUpdateBgScanConfigIniChannelList( pMac, eBand ); |
| 1291 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1292 | status = csrInitGetChannels( pMac ); |
| 1293 | if (eHAL_STATUS_SUCCESS == status) |
| 1294 | csrInitChannelList( hHal ); |
| 1295 | return status; |
| 1296 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1297 | |
| 1298 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1299 | /* The funcns csrConvertCBIniValueToPhyCBState and csrConvertPhyCBStateToIniValue have been |
| 1300 | * introduced to convert the ini value to the ENUM used in csr and MAC for CB state |
| 1301 | * Ideally we should have kept the ini value and enum value same and representing the same |
| 1302 | * cb values as in 11n standard i.e. |
| 1303 | * Set to 1 (SCA) if the secondary channel is above the primary channel |
| 1304 | * Set to 3 (SCB) if the secondary channel is below the primary channel |
| 1305 | * Set to 0 (SCN) if no secondary channel is present |
| 1306 | * However, since our driver is already distributed we will keep the ini definition as it is which is: |
| 1307 | * 0 - secondary none |
| 1308 | * 1 - secondary LOW |
| 1309 | * 2 - secondary HIGH |
| 1310 | * and convert to enum value used within the driver in csrChangeDefaultConfigParam using this funcn |
| 1311 | * The enum values are as follows: |
| 1312 | * PHY_SINGLE_CHANNEL_CENTERED = 0 |
| 1313 | * PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1 |
| 1314 | * PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 1315 | */ |
| 1316 | ePhyChanBondState csrConvertCBIniValueToPhyCBState(v_U32_t cbIniValue) |
| 1317 | { |
| 1318 | |
| 1319 | ePhyChanBondState phyCbState; |
| 1320 | switch (cbIniValue) { |
| 1321 | // secondary none |
| 1322 | case 0: |
| 1323 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1324 | break; |
| 1325 | // secondary LOW |
| 1326 | case 1: |
| 1327 | phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 1328 | break; |
| 1329 | // secondary HIGH |
| 1330 | case 2: |
| 1331 | phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 1332 | break; |
| 1333 | #ifdef WLAN_FEATURE_11AC |
| 1334 | case 3: |
| 1335 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
| 1336 | break; |
| 1337 | case 4: |
| 1338 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1339 | break; |
| 1340 | case 5: |
| 1341 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1342 | break; |
| 1343 | case 6: |
| 1344 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
| 1345 | break; |
| 1346 | case 7: |
| 1347 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
| 1348 | break; |
| 1349 | case 8: |
| 1350 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 1351 | break; |
| 1352 | case 9: |
| 1353 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
| 1354 | break; |
| 1355 | #endif |
| 1356 | default: |
| 1357 | // If an invalid value is passed, disable CHANNEL BONDING |
| 1358 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1359 | break; |
| 1360 | } |
| 1361 | return phyCbState; |
| 1362 | } |
| 1363 | |
| 1364 | v_U32_t csrConvertPhyCBStateToIniValue(ePhyChanBondState phyCbState) |
| 1365 | { |
| 1366 | |
| 1367 | v_U32_t cbIniValue; |
| 1368 | switch (phyCbState) { |
| 1369 | // secondary none |
| 1370 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 1371 | cbIniValue = 0; |
| 1372 | break; |
| 1373 | // secondary LOW |
| 1374 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 1375 | cbIniValue = 1; |
| 1376 | break; |
| 1377 | // secondary HIGH |
| 1378 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 1379 | cbIniValue = 2; |
| 1380 | break; |
| 1381 | #ifdef WLAN_FEATURE_11AC |
| 1382 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 1383 | cbIniValue = 3; |
| 1384 | break; |
| 1385 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 1386 | cbIniValue = 4; |
| 1387 | break; |
| 1388 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 1389 | cbIniValue = 5; |
| 1390 | break; |
| 1391 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 1392 | cbIniValue = 6; |
| 1393 | break; |
| 1394 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 1395 | cbIniValue = 7; |
| 1396 | break; |
| 1397 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 1398 | cbIniValue = 8; |
| 1399 | break; |
| 1400 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 1401 | cbIniValue = 9; |
| 1402 | break; |
| 1403 | #endif |
| 1404 | default: |
| 1405 | // return some invalid value |
| 1406 | cbIniValue = 10; |
| 1407 | break; |
| 1408 | } |
| 1409 | return cbIniValue; |
| 1410 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1411 | |
| 1412 | eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1413 | { |
| 1414 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1415 | |
| 1416 | if(pParam) |
| 1417 | { |
| 1418 | pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode; |
| 1419 | pMac->roam.configParam.Is11eSupportEnabled = pParam->Is11eSupportEnabled; |
| 1420 | pMac->roam.configParam.FragmentationThreshold = pParam->FragmentationThreshold; |
| 1421 | pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled; |
| 1422 | pMac->roam.configParam.Is11dSupportEnabledOriginal = pParam->Is11dSupportEnabled; |
| 1423 | pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled; |
| 1424 | |
| 1425 | pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode; |
Mohit Khanna | 7ed53f0 | 2012-09-11 17:52:10 -0700 | [diff] [blame] | 1426 | pMac->roam.configParam.fAllowMCCGODiffBI = pParam->fAllowMCCGODiffBI; |
| 1427 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1428 | /* channelBondingMode5GHz plays a dual role right now |
| 1429 | * 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 |
| 1430 | * This is how channelBondingMode5GHz works now and this is kept intact to avoid any cfg.ini change |
| 1431 | */ |
| 1432 | if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI) |
| 1433 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1434 | 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] | 1435 | } |
| 1436 | pMac->roam.configParam.channelBondingMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode24GHz); |
| 1437 | if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI) |
| 1438 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1439 | 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] | 1440 | } |
| 1441 | pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1442 | pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold; |
| 1443 | pMac->roam.configParam.phyMode = pParam->phyMode; |
| 1444 | pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime; |
| 1445 | pMac->roam.configParam.HeartbeatThresh24 = pParam->HeartbeatThresh24; |
| 1446 | pMac->roam.configParam.HeartbeatThresh50 = pParam->HeartbeatThresh50; |
| 1447 | pMac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled; |
| 1448 | pMac->roam.configParam.TxRate = pParam->TxRate; |
| 1449 | pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; |
| 1450 | pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; |
| 1451 | pMac->roam.configParam.bandCapability = pParam->bandCapability; |
| 1452 | pMac->roam.configParam.cbChoice = pParam->cbChoice; |
| 1453 | pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 1454 | pMac->roam.configParam.disableAggWithBtc = pParam->disableAggWithBtc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1455 | //if HDD passed down non zero values then only update, |
| 1456 | //otherwise keep using the defaults |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1457 | if (pParam->nActiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1458 | { |
| 1459 | pMac->roam.configParam.nActiveMaxChnTime = pParam->nActiveMaxChnTime; |
| 1460 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1461 | if (pParam->nActiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1462 | { |
| 1463 | pMac->roam.configParam.nActiveMinChnTime = pParam->nActiveMinChnTime; |
| 1464 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1465 | if (pParam->nPassiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1466 | { |
| 1467 | pMac->roam.configParam.nPassiveMaxChnTime = pParam->nPassiveMaxChnTime; |
| 1468 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1469 | if (pParam->nPassiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1470 | { |
| 1471 | pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime; |
| 1472 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1473 | if (pParam->nActiveMaxChnTimeBtc) |
| 1474 | { |
| 1475 | pMac->roam.configParam.nActiveMaxChnTimeBtc = pParam->nActiveMaxChnTimeBtc; |
| 1476 | } |
| 1477 | if (pParam->nActiveMinChnTimeBtc) |
| 1478 | { |
| 1479 | pMac->roam.configParam.nActiveMinChnTimeBtc = pParam->nActiveMinChnTimeBtc; |
| 1480 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1481 | #ifdef WLAN_AP_STA_CONCURRENCY |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1482 | if (pParam->nActiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1483 | { |
| 1484 | pMac->roam.configParam.nActiveMaxChnTimeConc = pParam->nActiveMaxChnTimeConc; |
| 1485 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1486 | if (pParam->nActiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1487 | { |
| 1488 | pMac->roam.configParam.nActiveMinChnTimeConc = pParam->nActiveMinChnTimeConc; |
| 1489 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1490 | if (pParam->nPassiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1491 | { |
| 1492 | pMac->roam.configParam.nPassiveMaxChnTimeConc = pParam->nPassiveMaxChnTimeConc; |
| 1493 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1494 | if (pParam->nPassiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1495 | { |
| 1496 | pMac->roam.configParam.nPassiveMinChnTimeConc = pParam->nPassiveMinChnTimeConc; |
| 1497 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1498 | if (pParam->nRestTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1499 | { |
| 1500 | pMac->roam.configParam.nRestTimeConc = pParam->nRestTimeConc; |
| 1501 | } |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1502 | if (pParam->nNumStaChanCombinedConc) |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1503 | { |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1504 | pMac->roam.configParam.nNumStaChanCombinedConc = pParam->nNumStaChanCombinedConc; |
| 1505 | } |
| 1506 | if (pParam->nNumP2PChanCombinedConc) |
| 1507 | { |
| 1508 | pMac->roam.configParam.nNumP2PChanCombinedConc = pParam->nNumP2PChanCombinedConc; |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1509 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1510 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1511 | //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] | 1512 | if (pParam->impsSleepTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1513 | { |
| 1514 | //Change the unit from second to microsecond |
| 1515 | tANI_U32 impsSleepTime = pParam->impsSleepTime * PAL_TIMER_TO_SEC_UNIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1516 | if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime) |
| 1517 | { |
| 1518 | pMac->roam.configParam.impsSleepTime = impsSleepTime; |
| 1519 | } |
| 1520 | else |
| 1521 | { |
| 1522 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 1523 | } |
| 1524 | } |
| 1525 | else |
| 1526 | { |
| 1527 | pMac->roam.configParam.impsSleepTime = 0; |
| 1528 | } |
| 1529 | pMac->roam.configParam.eBand = pParam->eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1530 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, pMac->roam.configParam.phyMode, |
| 1531 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1532 | //if HDD passed down non zero values for age params, then only update, |
| 1533 | //otherwise keep using the defaults |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1534 | if (pParam->nScanResultAgeCount) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1535 | { |
| 1536 | pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount; |
| 1537 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1538 | if(pParam->scanAgeTimeNCNPS) |
| 1539 | { |
| 1540 | pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS; |
| 1541 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1542 | if(pParam->scanAgeTimeNCPS) |
| 1543 | { |
| 1544 | pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS; |
| 1545 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1546 | if(pParam->scanAgeTimeCNPS) |
| 1547 | { |
| 1548 | pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS; |
| 1549 | } |
| 1550 | if(pParam->scanAgeTimeCPS) |
| 1551 | { |
| 1552 | pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS; |
| 1553 | } |
| 1554 | |
| 1555 | csrAssignRssiForCategory(pMac, pParam->bCatRssiOffset); |
| 1556 | pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime; |
| 1557 | pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels; |
| 1558 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority; |
| 1559 | pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch; |
| 1560 | pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1561 | pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold; |
| 1562 | pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1563 | pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled; |
| 1564 | pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity; |
| 1565 | pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS; |
| 1566 | //Assign this before calling CsrInit11dInfo |
| 1567 | pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1568 | if( csrIs11dSupported( pMac ) ) |
| 1569 | { |
| 1570 | status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo); |
| 1571 | } |
| 1572 | else |
| 1573 | { |
| 1574 | pMac->scan.curScanType = eSIR_ACTIVE_SCAN; |
| 1575 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1576 | |
| 1577 | /* Initialize the power + channel information if 11h is enabled. |
| 1578 | If 11d is enabled this information has already been initialized */ |
| 1579 | if( csrIs11hSupported( pMac ) && !csrIs11dSupported( pMac ) ) |
| 1580 | { |
| 1581 | csrInitChannelPowerList(pMac, &pParam->Csr11dinfo); |
| 1582 | } |
| 1583 | |
| 1584 | |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 1585 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1586 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.csr11rConfig, &pParam->csr11rConfig, sizeof(tCsr11rConfigParams) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1587 | smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1588 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1589 | #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] | 1590 | pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1591 | pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1592 | pMac->roam.configParam.nImmediateRoamRssiDiff = pParam->nImmediateRoamRssiDiff; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1593 | smsLog( pMac, LOG1, "nImmediateRoamRssiDiff = %d", |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1594 | pMac->roam.configParam.nImmediateRoamRssiDiff ); |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 1595 | pMac->roam.configParam.nRoamPrefer5GHz = pParam->nRoamPrefer5GHz; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 1596 | pMac->roam.configParam.nRoamIntraBand = pParam->nRoamIntraBand; |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 1597 | pMac->roam.configParam.nProbes = pParam->nProbes; |
| 1598 | pMac->roam.configParam.nRoamScanHomeAwayTime = pParam->nRoamScanHomeAwayTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1599 | #endif |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1600 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1601 | pMac->roam.configParam.isRoamOffloadScanEnabled = pParam->isRoamOffloadScanEnabled; |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1602 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = pParam->bFastRoamInConIniFeatureEnabled; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1603 | #endif |
| 1604 | #ifdef FEATURE_WLAN_LFR |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1605 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled; |
| 1606 | #endif |
| 1607 | |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 1608 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1609 | pMac->roam.configParam.isCcxIniFeatureEnabled = pParam->isCcxIniFeatureEnabled; |
| 1610 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1611 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1612 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.neighborRoamConfig, &pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1613 | smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod); |
| 1614 | smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold); |
| 1615 | smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold); |
| 1616 | smsLog( pMac, LOG1, "nNeighborScanMinChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime); |
| 1617 | smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime); |
| 1618 | smsLog( pMac, LOG1, "nMaxNeighborRetries = %d", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries); |
| 1619 | smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod); |
| 1620 | smsLog( pMac, LOG1, "nEmptyScanRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1621 | { |
| 1622 | int i; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1623 | 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] | 1624 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1625 | { |
| 1626 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1627 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1628 | smsLog( pMac, LOG1, ""); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1629 | } |
| 1630 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1631 | pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff; |
| 1632 | pMac->scan.fValidateList = pParam->fValidateList; |
| 1633 | pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d; |
| 1634 | pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan; |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 1635 | pMac->scan.scanResultCfgAgingTime = pParam->scanCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1636 | pMac->roam.configParam.fScanTwice = pParam->fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1637 | pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl; |
| 1638 | /* This parameter is not available in cfg and not passed from upper layers. Instead it is initialized here |
| 1639 | * This paramtere is used in concurrency to determine if there are concurrent active sessions. |
| 1640 | * Is used as a temporary fix to disconnect all active sessions when BMPS enabled so the active session if Infra STA |
| 1641 | * will automatically connect back and resume BMPS since resume BMPS is not working when moving from concurrent to |
| 1642 | * single session |
| 1643 | */ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1644 | //Remove this code once SLM_Sessionization is supported |
| 1645 | //BMPS_WORKAROUND_NOT_NEEDED |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1646 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 1647 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1648 | #ifdef WLAN_FEATURE_11AC |
| 1649 | pMac->roam.configParam.nVhtChannelWidth = pParam->nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1650 | pMac->roam.configParam.txBFEnable= pParam->enableTxBF; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1651 | pMac->roam.configParam.txBFCsnValue = pParam->txBFCsnValue; |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 1652 | pMac->roam.configParam.enableVhtFor24GHz = pParam->enableVhtFor24GHz; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1653 | #endif |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1654 | pMac->roam.configParam.txLdpcEnable = pParam->enableTxLdpc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1655 | } |
| 1656 | |
| 1657 | return status; |
| 1658 | } |
| 1659 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1660 | eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1661 | { |
| 1662 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1663 | if(pParam) |
| 1664 | { |
| 1665 | pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode; |
| 1666 | pParam->Is11eSupportEnabled = pMac->roam.configParam.Is11eSupportEnabled; |
| 1667 | pParam->FragmentationThreshold = pMac->roam.configParam.FragmentationThreshold; |
| 1668 | pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled; |
| 1669 | pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 1670 | pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1671 | pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz); |
| 1672 | pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1673 | pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold; |
| 1674 | pParam->phyMode = pMac->roam.configParam.phyMode; |
| 1675 | pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 1676 | pParam->HeartbeatThresh24 = pMac->roam.configParam.HeartbeatThresh24; |
| 1677 | pParam->HeartbeatThresh50 = pMac->roam.configParam.HeartbeatThresh50; |
| 1678 | pParam->ProprietaryRatesEnabled = pMac->roam.configParam.ProprietaryRatesEnabled; |
| 1679 | pParam->TxRate = pMac->roam.configParam.TxRate; |
| 1680 | pParam->AdHocChannel24 = pMac->roam.configParam.AdHocChannel24; |
| 1681 | pParam->AdHocChannel5G = pMac->roam.configParam.AdHocChannel5G; |
| 1682 | pParam->bandCapability = pMac->roam.configParam.bandCapability; |
| 1683 | pParam->cbChoice = pMac->roam.configParam.cbChoice; |
| 1684 | pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1685 | pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime; |
| 1686 | pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime; |
| 1687 | pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; |
| 1688 | pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 1689 | pParam->nActiveMaxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; |
| 1690 | pParam->nActiveMinChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; |
| 1691 | pParam->disableAggWithBtc = pMac->roam.configParam.disableAggWithBtc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1692 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1693 | pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc; |
| 1694 | pParam->nActiveMinChnTimeConc = pMac->roam.configParam.nActiveMinChnTimeConc; |
| 1695 | pParam->nPassiveMaxChnTimeConc = pMac->roam.configParam.nPassiveMaxChnTimeConc; |
| 1696 | pParam->nPassiveMinChnTimeConc = pMac->roam.configParam.nPassiveMinChnTimeConc; |
| 1697 | pParam->nRestTimeConc = pMac->roam.configParam.nRestTimeConc; |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1698 | pParam->nNumStaChanCombinedConc = pMac->roam.configParam.nNumStaChanCombinedConc; |
| 1699 | pParam->nNumP2PChanCombinedConc = pMac->roam.configParam.nNumP2PChanCombinedConc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1700 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1701 | //Change the unit from microsecond to second |
| 1702 | pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT; |
| 1703 | pParam->eBand = pMac->roam.configParam.eBand; |
| 1704 | pParam->nScanResultAgeCount = pMac->roam.configParam.agingCount; |
| 1705 | pParam->scanAgeTimeNCNPS = pMac->roam.configParam.scanAgeTimeNCNPS; |
| 1706 | pParam->scanAgeTimeNCPS = pMac->roam.configParam.scanAgeTimeNCPS; |
| 1707 | pParam->scanAgeTimeCNPS = pMac->roam.configParam.scanAgeTimeCNPS; |
| 1708 | pParam->scanAgeTimeCPS = pMac->roam.configParam.scanAgeTimeCPS; |
| 1709 | pParam->bCatRssiOffset = pMac->roam.configParam.bCatRssiOffset; |
| 1710 | pParam->nRoamingTime = pMac->roam.configParam.nRoamingTime; |
| 1711 | pParam->fEnforce11dChannels = pMac->roam.configParam.fEnforce11dChannels; |
| 1712 | pParam->fSupplicantCountryCodeHasPriority = pMac->roam.configParam.fSupplicantCountryCodeHasPriority; |
| 1713 | pParam->fEnforceCountryCodeMatch = pMac->roam.configParam.fEnforceCountryCodeMatch; |
| 1714 | pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain; |
| 1715 | pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold; |
| 1716 | pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1717 | pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled; |
| 1718 | pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap; |
| 1719 | pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 1720 | pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1721 | pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff; |
| 1722 | pParam->fValidateList = pMac->roam.configParam.fValidateList; |
| 1723 | pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d; |
| 1724 | pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan; |
| 1725 | pParam->fScanTwice = pMac->roam.configParam.fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1726 | pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl; |
Madan Mohan Koyyalamudi | ed41951 | 2012-11-29 15:53:46 -0800 | [diff] [blame] | 1727 | pParam->fEnableMCCMode = pMac->roam.configParam.fenableMCCMode; |
Madan Mohan Koyyalamudi | 057bd80 | 2012-11-29 16:02:39 -0800 | [diff] [blame] | 1728 | pParam->fAllowMCCGODiffBI = pMac->roam.configParam.fAllowMCCGODiffBI; |
Sunil Ravi | 39b2e53 | 2013-01-20 23:45:53 -0800 | [diff] [blame] | 1729 | pParam->scanCfgAgingTime = pMac->scan.scanResultCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1730 | |
| 1731 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1732 | palCopyMemory( pMac->hHdd, &pParam->neighborRoamConfig, &pMac->roam.configParam.neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
| 1733 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1734 | #ifdef WLAN_FEATURE_11AC |
| 1735 | pParam->nVhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1736 | pParam->enableTxBF = pMac->roam.configParam.txBFEnable; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1737 | pParam->txBFCsnValue = pMac->roam.configParam.txBFCsnValue; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1738 | #endif |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1739 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1740 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.csr11rConfig, &pParam->csr11rConfig, sizeof(tCsr11rConfigParams) ); |
| 1741 | #endif |
| 1742 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1743 | pParam->isFastTransitionEnabled = pMac->roam.configParam.isFastTransitionEnabled; |
| 1744 | pParam->RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff; |
| 1745 | pParam->nImmediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff; |
| 1746 | pParam->nRoamPrefer5GHz = pMac->roam.configParam.nRoamPrefer5GHz; |
| 1747 | pParam->nRoamIntraBand = pMac->roam.configParam.nRoamIntraBand; |
Srinivas Girigowda | 6cf0b82 | 2013-06-27 14:00:20 -0700 | [diff] [blame] | 1748 | pParam->nProbes = pMac->roam.configParam.nProbes; |
| 1749 | pParam->nRoamScanHomeAwayTime = pMac->roam.configParam.nRoamScanHomeAwayTime; |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1750 | #endif |
| 1751 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1752 | pParam->isRoamOffloadScanEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled; |
| 1753 | pParam->bFastRoamInConIniFeatureEnabled = pMac->roam.configParam.bFastRoamInConIniFeatureEnabled; |
| 1754 | #endif |
| 1755 | #ifdef FEATURE_WLAN_LFR |
| 1756 | pParam->isFastRoamIniFeatureEnabled = pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
| 1757 | #endif |
| 1758 | |
| 1759 | #ifdef FEATURE_WLAN_CCX |
| 1760 | pParam->isCcxIniFeatureEnabled = pMac->roam.configParam.isCcxIniFeatureEnabled; |
| 1761 | #endif |
| 1762 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1763 | palCopyMemory( pMac->hHdd, &pParam->neighborRoamConfig, &pMac->roam.configParam.neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
| 1764 | { |
| 1765 | int i; |
| 1766 | smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
| 1767 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1768 | { |
| 1769 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1770 | } |
| 1771 | smsLog( pMac, LOG1, ""); |
| 1772 | } |
| 1773 | #endif |
| 1774 | |
Venkata Prathyusha Kuntupalli | f2695c1 | 2013-04-17 15:41:23 -0700 | [diff] [blame] | 1775 | pParam->enableTxLdpc = pMac->roam.configParam.txLdpcEnable; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1776 | csrSetChannels(pMac, pParam); |
| 1777 | |
| 1778 | status = eHAL_STATUS_SUCCESS; |
| 1779 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1780 | return (status); |
| 1781 | } |
| 1782 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1783 | eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded) |
| 1784 | { |
| 1785 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 1786 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1787 | tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE; |
| 1788 | eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1789 | do |
| 1790 | { |
| 1791 | if(eCSR_BAND_24 == eBand) |
| 1792 | { |
| 1793 | if(CSR_IS_RADIO_A_ONLY(pMac)) break; |
| 1794 | if((eCSR_DOT11_MODE_11a & phyMode) || (eCSR_DOT11_MODE_11a_ONLY & phyMode)) break; |
| 1795 | } |
| 1796 | if(eCSR_BAND_5G == eBand) |
| 1797 | { |
| 1798 | if(CSR_IS_RADIO_BG_ONLY(pMac)) break; |
| 1799 | if((eCSR_DOT11_MODE_11b & phyMode) || (eCSR_DOT11_MODE_11b_ONLY & phyMode) || |
| 1800 | (eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1801 | ) |
| 1802 | { |
| 1803 | break; |
| 1804 | } |
| 1805 | } |
| 1806 | if((0 == phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode)) |
| 1807 | { |
| 1808 | newPhyMode = eCSR_DOT11_MODE_TAURUS; |
| 1809 | } |
| 1810 | else if(eCSR_DOT11_MODE_AUTO & phyMode) |
| 1811 | { |
| 1812 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1813 | } |
| 1814 | else |
| 1815 | { |
| 1816 | //Check for dual band and higher capability first |
| 1817 | if(eCSR_DOT11_MODE_11n_ONLY & phyMode) |
| 1818 | { |
| 1819 | if(eCSR_DOT11_MODE_11n_ONLY != phyMode) break; |
| 1820 | newPhyMode = eCSR_DOT11_MODE_11n_ONLY; |
| 1821 | } |
| 1822 | else if(eCSR_DOT11_MODE_11a_ONLY & phyMode) |
| 1823 | { |
| 1824 | if(eCSR_DOT11_MODE_11a_ONLY != phyMode) break; |
| 1825 | if(eCSR_BAND_24 == eBand) break; |
| 1826 | newPhyMode = eCSR_DOT11_MODE_11a_ONLY; |
| 1827 | eBand = eCSR_BAND_5G; |
| 1828 | } |
| 1829 | else if(eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1830 | { |
| 1831 | if(eCSR_DOT11_MODE_11g_ONLY != phyMode) break; |
| 1832 | if(eCSR_BAND_5G == eBand) break; |
| 1833 | newPhyMode = eCSR_DOT11_MODE_11g_ONLY; |
| 1834 | eBand = eCSR_BAND_24; |
| 1835 | } |
| 1836 | else if(eCSR_DOT11_MODE_11b_ONLY & phyMode) |
| 1837 | { |
| 1838 | if(eCSR_DOT11_MODE_11b_ONLY != phyMode) break; |
| 1839 | if(eCSR_BAND_5G == eBand) break; |
| 1840 | newPhyMode = eCSR_DOT11_MODE_11b_ONLY; |
| 1841 | eBand = eCSR_BAND_24; |
| 1842 | } |
| 1843 | else if(eCSR_DOT11_MODE_11n & phyMode) |
| 1844 | { |
| 1845 | newPhyMode = eCSR_DOT11_MODE_11n; |
| 1846 | } |
| 1847 | else if(eCSR_DOT11_MODE_abg & phyMode) |
| 1848 | { |
| 1849 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1850 | } |
| 1851 | else if(eCSR_DOT11_MODE_11a & phyMode) |
| 1852 | { |
| 1853 | if((eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11b & phyMode)) |
| 1854 | { |
| 1855 | if(eCSR_BAND_ALL == eBand) |
| 1856 | { |
| 1857 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1858 | } |
| 1859 | else |
| 1860 | { |
| 1861 | //bad setting |
| 1862 | break; |
| 1863 | } |
| 1864 | } |
| 1865 | else |
| 1866 | { |
| 1867 | newPhyMode = eCSR_DOT11_MODE_11a; |
| 1868 | eBand = eCSR_BAND_5G; |
| 1869 | } |
| 1870 | } |
| 1871 | else if(eCSR_DOT11_MODE_11g & phyMode) |
| 1872 | { |
| 1873 | newPhyMode = eCSR_DOT11_MODE_11g; |
| 1874 | eBand = eCSR_BAND_24; |
| 1875 | } |
| 1876 | else if(eCSR_DOT11_MODE_11b & phyMode) |
| 1877 | { |
| 1878 | newPhyMode = eCSR_DOT11_MODE_11b; |
| 1879 | eBand = eCSR_BAND_24; |
| 1880 | } |
| 1881 | else |
| 1882 | { |
| 1883 | //We will never be here |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1884 | smsLog( pMac, LOGE, FL(" cannot recognize the phy mode 0x%08X"), phyMode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1885 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1886 | } |
| 1887 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1888 | //Done validating |
| 1889 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1890 | //Now we need to check whether a restart is needed. |
| 1891 | if(eBand != pMac->roam.configParam.eBand) |
| 1892 | { |
| 1893 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1894 | break; |
| 1895 | } |
| 1896 | if(newPhyMode != pMac->roam.configParam.phyMode) |
| 1897 | { |
| 1898 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1899 | break; |
| 1900 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1901 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1902 | if(HAL_STATUS_SUCCESS(status)) |
| 1903 | { |
| 1904 | pMac->roam.configParam.eBand = eBand; |
| 1905 | pMac->roam.configParam.phyMode = newPhyMode; |
| 1906 | if(pfRestartNeeded) |
| 1907 | { |
| 1908 | *pfRestartNeeded = fRestartNeeded; |
| 1909 | } |
| 1910 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1911 | return (status); |
| 1912 | } |
| 1913 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1914 | void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList ) |
| 1915 | { |
| 1916 | tANI_U8 Index; |
| 1917 | tANI_U8 cChannels; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1918 | // for dual band NICs, don't need to trim the channel list.... |
| 1919 | if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) ) |
| 1920 | { |
| 1921 | // 2.4 GHz band operation requires the channel list to be trimmed to |
| 1922 | // the 2.4 GHz channels only... |
| 1923 | if ( CSR_IS_24_BAND_ONLY( pMac ) ) |
| 1924 | { |
| 1925 | for( Index = 0, cChannels = 0; Index < pChannelList->numChannels; |
| 1926 | Index++ ) |
| 1927 | { |
| 1928 | if ( CSR_IS_CHANNEL_24GHZ(pChannelList->channelList[ Index ]) ) |
| 1929 | { |
| 1930 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 1931 | cChannels++; |
| 1932 | } |
| 1933 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1934 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 1935 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 1936 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 1937 | // only if we need to. |
| 1938 | // |
| 1939 | // The amount of memory to clear is the number of channesl that we trimmed |
| 1940 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 1941 | |
| 1942 | if ( pChannelList->numChannels > cChannels ) |
| 1943 | { |
| 1944 | palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ], |
| 1945 | sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) ); |
| 1946 | |
| 1947 | } |
| 1948 | |
| 1949 | pChannelList->numChannels = cChannels; |
| 1950 | } |
| 1951 | else if ( CSR_IS_5G_BAND_ONLY( pMac ) ) |
| 1952 | { |
| 1953 | for ( Index = 0, cChannels = 0; Index < pChannelList->numChannels; Index++ ) |
| 1954 | { |
| 1955 | if ( CSR_IS_CHANNEL_5GHZ(pChannelList->channelList[ Index ]) ) |
| 1956 | { |
| 1957 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 1958 | cChannels++; |
| 1959 | } |
| 1960 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1961 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 1962 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 1963 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 1964 | // only if we need to. |
| 1965 | // |
| 1966 | // The amount of memory to clear is the number of channesl that we trimmed |
| 1967 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 1968 | if ( pChannelList->numChannels > cChannels ) |
| 1969 | { |
| 1970 | palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ], |
| 1971 | sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) ); |
| 1972 | } |
| 1973 | |
| 1974 | pChannelList->numChannels = cChannels; |
| 1975 | } |
| 1976 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1977 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1978 | #define INFRA_AP_DEFAULT_CHANNEL 6 |
| 1979 | eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum) |
| 1980 | { |
| 1981 | tANI_U8 index= 0; |
| 1982 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1983 | for (index=0; index < pMac->scan.base20MHzChannels.numChannels ;index++) |
| 1984 | { |
| 1985 | if(pMac->scan.base20MHzChannels.channelList[ index ] == chnNum){ |
| 1986 | status = eHAL_STATUS_SUCCESS; |
| 1987 | break; |
| 1988 | } |
| 1989 | } |
| 1990 | return status; |
| 1991 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 1992 | |
| 1993 | eHalStatus csrGet5GChannels(tpAniSirGlobal pMac) |
| 1994 | { |
| 1995 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1996 | tANI_U8 num20MHzChannelsFound = 0; |
| 1997 | VOS_STATUS vosStatus; |
| 1998 | tANI_U8 num40MHzChannelsFound = 0; |
| 1999 | tANI_U8 Index = 0; |
| 2000 | tANI_U8 channelList = 0; |
| 2001 | |
| 2002 | // Updating the defaultpower Table for changed Domain Id |
| 2003 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 2004 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 2005 | |
| 2006 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 2007 | { |
| 2008 | smsLog( pMac, LOGE, FL("failed to get channels")); |
| 2009 | status = eHAL_STATUS_FAILURE; |
| 2010 | } |
| 2011 | else |
| 2012 | { |
| 2013 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 2014 | { |
| 2015 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2016 | } |
| 2017 | |
| 2018 | // Move the only 5GHZ channel list to the global data, |
| 2019 | // As 2.4GHZ list coming from the AP for the changed domain |
| 2020 | // structure -- this will be used as the scan list |
| 2021 | for(channelList = 0; channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN; channelList++) |
| 2022 | { |
| 2023 | // If Channel is 5GHz just break the for loop |
| 2024 | if(!(pMac->scan.base20MHzChannels.channelList[ channelList ] > 0 && pMac->scan.base20MHzChannels.channelList[ channelList ] <= 14)) |
| 2025 | break; |
| 2026 | } |
| 2027 | // Update the 5G channels from nv.bin |
| 2028 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 2029 | { |
| 2030 | if(pMac->scan.defaultPowerTable[Index].chanId >= 36 && pMac->scan.defaultPowerTable[Index].chanId <= 165) |
| 2031 | { |
Krunal Soni | a75019a | 2013-05-01 01:08:22 -0700 | [diff] [blame] | 2032 | if (channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 2033 | { |
| 2034 | pMac->scan.base20MHzChannels.channelList[ channelList ] = pMac->scan.defaultPowerTable[Index].chanId; |
| 2035 | channelList++; |
| 2036 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2037 | } |
| 2038 | } |
| 2039 | |
| 2040 | pMac->scan.numChannelsDefault = (num20MHzChannelsFound > channelList) ? num20MHzChannelsFound : channelList; |
| 2041 | pMac->scan.base20MHzChannels.numChannels = (num20MHzChannelsFound > channelList) ? num20MHzChannelsFound : channelList; |
| 2042 | // Filling the remaining index as Zero Just for causion |
| 2043 | for(Index = pMac->scan.base20MHzChannels.numChannels; Index < WNI_CFG_VALID_CHANNEL_LIST_LEN; Index++) |
| 2044 | pMac->scan.base20MHzChannels.channelList[ Index ] = 0; |
| 2045 | } |
| 2046 | return status; |
| 2047 | } |
| 2048 | |
| 2049 | eHalStatus csrGet24GChannels(tpAniSirGlobal pMac) |
| 2050 | { |
| 2051 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2052 | tANI_U8 num20MHzChannelsFound = 0; |
| 2053 | VOS_STATUS vosStatus; |
| 2054 | tANI_U8 Index = 0; |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2055 | tANI_U8 numChan = 0; |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2056 | tANI_U8 num40MHzChannelsFound = 0; |
| 2057 | tANI_U8 channelList5GBackup[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}, nuum5GchannelListBackup; |
| 2058 | tANI_U8 channelList = 0; |
| 2059 | |
| 2060 | // Read the scan channel list (including the power limit) from EEPROM |
| 2061 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 2062 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 2063 | |
| 2064 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 2065 | { |
| 2066 | smsLog( pMac, LOGE, FL("failed to get channels \n")); |
| 2067 | status = eHAL_STATUS_FAILURE; |
| 2068 | } |
| 2069 | else |
| 2070 | { |
| 2071 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 2072 | { |
| 2073 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2074 | } |
| 2075 | |
| 2076 | // Move the 2.4GHZ channel list only to the global data, |
| 2077 | // As 5GHz list been provided by AP as part of 11d IE |
| 2078 | // structure -- this will be used as the scan list |
| 2079 | for(channelList = 0, nuum5GchannelListBackup = 0; channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN; channelList++) |
| 2080 | { |
| 2081 | if(pMac->scan.base20MHzChannels.channelList[ channelList ] >= 36 && pMac->scan.base20MHzChannels.channelList[ channelList ] <= 165) |
| 2082 | { |
| 2083 | // First taking the 5GHz channel list backup |
| 2084 | channelList5GBackup[nuum5GchannelListBackup] = pMac->scan.base20MHzChannels.channelList[ channelList ]; |
| 2085 | nuum5GchannelListBackup++; |
| 2086 | } |
| 2087 | } |
| 2088 | // Updating the 2.4GHz list |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2089 | for ( Index = 0, numChan = 0; Index < num20MHzChannelsFound; Index++) |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2090 | { |
| 2091 | if(pMac->scan.defaultPowerTable[Index].chanId > 0 && pMac->scan.defaultPowerTable[Index].chanId <= 14) |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2092 | { |
| 2093 | pMac->scan.base20MHzChannels.channelList[ numChan ] = pMac->scan.defaultPowerTable[Index].chanId; |
| 2094 | numChan++; |
| 2095 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2096 | } |
| 2097 | // Restoring the Backed up 5 GHZ channels |
| 2098 | for(channelList = 0;channelList < nuum5GchannelListBackup; channelList++ ) |
| 2099 | { |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2100 | if (numChan < WNI_CFG_VALID_CHANNEL_LIST_LEN) |
Krunal Soni | a75019a | 2013-05-01 01:08:22 -0700 | [diff] [blame] | 2101 | { |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2102 | pMac->scan.base20MHzChannels.channelList[ numChan ] = channelList5GBackup[channelList]; |
| 2103 | numChan++; |
Krunal Soni | a75019a | 2013-05-01 01:08:22 -0700 | [diff] [blame] | 2104 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2105 | } |
| 2106 | |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2107 | pMac->scan.numChannelsDefault = (num20MHzChannelsFound > numChan) ? num20MHzChannelsFound : numChan; |
| 2108 | pMac->scan.base20MHzChannels.numChannels = (num20MHzChannelsFound > numChan) ? num20MHzChannelsFound : numChan; |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2109 | } |
| 2110 | return (status); |
| 2111 | } |
| 2112 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2113 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac) |
| 2114 | { |
| 2115 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2116 | tANI_U8 num20MHzChannelsFound = 0; |
| 2117 | VOS_STATUS vosStatus; |
| 2118 | tANI_U8 Index = 0; |
| 2119 | tANI_U8 num40MHzChannelsFound = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2120 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2121 | |
| 2122 | //TODO: this interface changed to include the 40MHz channel list |
| 2123 | // this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation |
| 2124 | // Read the scan channel list (including the power limit) from EEPROM |
| 2125 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 2126 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 2127 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 2128 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2129 | smsLog( pMac, LOGE, FL("failed to get channels ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2130 | status = eHAL_STATUS_FAILURE; |
| 2131 | } |
| 2132 | else |
| 2133 | { |
| 2134 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 2135 | { |
| 2136 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2137 | } |
| 2138 | pMac->scan.numChannelsDefault = num20MHzChannelsFound; |
| 2139 | // Move the channel list to the global data |
| 2140 | // structure -- this will be used as the scan list |
| 2141 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 2142 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2143 | pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[ Index ].chanId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2144 | } |
| 2145 | pMac->scan.base20MHzChannels.numChannels = num20MHzChannelsFound; |
| 2146 | if(num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 2147 | { |
| 2148 | num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2149 | } |
| 2150 | for ( Index = 0; Index < num40MHzChannelsFound; Index++) |
| 2151 | { |
| 2152 | pMac->scan.base40MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable40MHz[ Index ].chanId; |
| 2153 | } |
| 2154 | pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound; |
| 2155 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2156 | return (status); |
| 2157 | } |
| 2158 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2159 | eHalStatus csrInitChannelList( tHalHandle hHal ) |
| 2160 | { |
| 2161 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2162 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2163 | csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels); |
| 2164 | csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels); |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 2165 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_FALSE); |
| 2166 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2167 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2168 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2169 | |
| 2170 | return (status); |
| 2171 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2172 | eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, |
| 2173 | tCsrUpdateConfigParam *pUpdateConfigParam) |
| 2174 | { |
| 2175 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2176 | tCsr11dinfo *ps11dinfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2177 | ps11dinfo = &pUpdateConfigParam->Csr11dinfo; |
| 2178 | status = CsrInit11dInfo(pMac, ps11dinfo); |
| 2179 | return status; |
| 2180 | } |
| 2181 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2182 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2183 | { |
| 2184 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2185 | tANI_U8 index; |
| 2186 | tANI_U32 count=0; |
| 2187 | tSirMacChanInfo *pChanInfo; |
| 2188 | tSirMacChanInfo *pChanInfoStart; |
| 2189 | tANI_BOOLEAN applyConfig = TRUE; |
| 2190 | |
| 2191 | if(!ps11dinfo) |
| 2192 | { |
| 2193 | return (status); |
| 2194 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2195 | if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) ) |
| 2196 | { |
| 2197 | pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels; |
| 2198 | status = palCopyMemory(pMac->hHdd, pMac->scan.base20MHzChannels.channelList, |
| 2199 | ps11dinfo->Channels.channelList, ps11dinfo->Channels.numChannels); |
| 2200 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
| 2201 | } |
| 2202 | else |
| 2203 | { |
| 2204 | //No change |
| 2205 | return (eHAL_STATUS_SUCCESS); |
| 2206 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2207 | //legacy maintenance |
| 2208 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, |
| 2209 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 2210 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2211 | //Tush: at csropen get this initialized with default, during csr reset if this |
| 2212 | // already set with some value no need initilaize with default again |
| 2213 | if(0 == pMac->scan.countryCodeCurrent[0]) |
| 2214 | { |
| 2215 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 2216 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 2217 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
| 2218 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2219 | // need to add the max power channel list |
| 2220 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN))) |
| 2221 | { |
| 2222 | palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2223 | pChanInfoStart = pChanInfo; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2224 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2225 | { |
| 2226 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2227 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2228 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2229 | pChanInfo++; |
| 2230 | count++; |
| 2231 | } |
| 2232 | if(count) |
| 2233 | { |
| 2234 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2235 | } |
| 2236 | palFreeMemory(pMac->hHdd, pChanInfoStart); |
| 2237 | } |
| 2238 | //Only apply them to CFG when not in STOP state. Otherwise they will be applied later |
| 2239 | if( HAL_STATUS_SUCCESS(status) ) |
| 2240 | { |
| 2241 | for( index = 0; index < CSR_ROAM_SESSION_MAX; index++ ) |
| 2242 | { |
| 2243 | if((CSR_IS_SESSION_VALID(pMac, index)) && CSR_IS_ROAM_STOP(pMac, index)) |
| 2244 | { |
| 2245 | applyConfig = FALSE; |
| 2246 | } |
| 2247 | } |
| 2248 | |
| 2249 | if(TRUE == applyConfig) |
| 2250 | { |
| 2251 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2252 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2253 | } |
| 2254 | |
| 2255 | } |
| 2256 | return (status); |
| 2257 | } |
| 2258 | /* Initialize the Channel + Power List in the local cache and in the CFG */ |
| 2259 | eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2260 | { |
| 2261 | tANI_U8 index; |
| 2262 | tANI_U32 count=0; |
| 2263 | tSirMacChanInfo *pChanInfo; |
| 2264 | tSirMacChanInfo *pChanInfoStart; |
| 2265 | |
| 2266 | if(!ps11dinfo || !pMac) |
| 2267 | { |
| 2268 | return eHAL_STATUS_FAILURE; |
| 2269 | } |
| 2270 | |
| 2271 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN))) |
| 2272 | { |
| 2273 | palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2274 | pChanInfoStart = pChanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2275 | |
| 2276 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2277 | { |
| 2278 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2279 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2280 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2281 | pChanInfo++; |
| 2282 | count++; |
| 2283 | } |
| 2284 | if(count) |
| 2285 | { |
| 2286 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2287 | } |
| 2288 | palFreeMemory(pMac->hHdd, pChanInfoStart); |
| 2289 | } |
| 2290 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2291 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2292 | } |
| 2293 | |
| 2294 | //pCommand may be NULL |
| 2295 | //Pass in sessionId in case pCommand is NULL. sessionId is not used in case pCommand is not NULL. |
| 2296 | void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason) |
| 2297 | { |
| 2298 | tListElem *pEntry, *pNextEntry; |
| 2299 | tSmeCmd *pDupCommand; |
| 2300 | tDblLinkList localList; |
| 2301 | |
| 2302 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 2303 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 2304 | { |
| 2305 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 2306 | return; |
| 2307 | } |
| 2308 | csrLLLock( &pMac->sme.smeCmdPendingList ); |
| 2309 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK ); |
| 2310 | while( pEntry ) |
| 2311 | { |
| 2312 | pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ); |
| 2313 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2314 | // Remove the previous command if.. |
| 2315 | // - the new roam command is for the same RoamReason... |
| 2316 | // - the new roam command is a NewProfileList. |
| 2317 | // - the new roam command is a Forced Dissoc |
| 2318 | // - the new roam command is from an 802.11 OID (OID_SSID or OID_BSSID). |
| 2319 | if ( |
| 2320 | (pCommand && ( pCommand->sessionId == pDupCommand->sessionId ) && |
| 2321 | ((pCommand->command == pDupCommand->command) && |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 2322 | /* This peermac check is requried for Softap/GO scenarios |
| 2323 | * For STA scenario below OR check will suffice as pCommand will |
| 2324 | * always be NULL for STA scenarios |
| 2325 | */ |
| 2326 | (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] | 2327 | (pCommand->u.roamCmd.roamReason == pDupCommand->u.roamCmd.roamReason || |
| 2328 | eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason || |
| 2329 | eCsrHddIssued == pCommand->u.roamCmd.roamReason))) |
| 2330 | || |
| 2331 | //below the pCommand is NULL |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2332 | ( (sessionId == pDupCommand->sessionId) && |
| 2333 | (eSmeCommandRoam == pDupCommand->command) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2334 | ((eCsrForcedDisassoc == eRoamReason) || |
| 2335 | (eCsrHddIssued == eRoamReason)) |
| 2336 | ) |
| 2337 | ) |
| 2338 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2339 | smsLog(pMac, LOGW, FL(" roamReason = %d"), pDupCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2340 | // Remove the 'stale' roam command from the pending list... |
| 2341 | if(csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK )) |
| 2342 | { |
| 2343 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 2344 | } |
| 2345 | } |
| 2346 | pEntry = pNextEntry; |
| 2347 | } |
| 2348 | csrLLUnlock( &pMac->sme.smeCmdPendingList ); |
| 2349 | |
| 2350 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 2351 | { |
| 2352 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 2353 | //Tell caller that the command is cancelled |
| 2354 | csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL, pDupCommand->u.roamCmd.roamId, |
| 2355 | eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE); |
| 2356 | csrReleaseCommandRoam(pMac, pDupCommand); |
| 2357 | } |
| 2358 | csrLLClose(&localList); |
| 2359 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2360 | eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, |
| 2361 | tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2) |
| 2362 | { |
| 2363 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2364 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2365 | WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type); |
| 2366 | #endif |
| 2367 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2368 | if( CSR_IS_SESSION_VALID( pMac, sessionId) ) |
| 2369 | { |
| 2370 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2371 | } |
| 2372 | else |
| 2373 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2374 | smsLog(pMac, LOGE, "Session ID:%d is not valid", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2375 | VOS_ASSERT(0); |
| 2376 | return eHAL_STATUS_FAILURE; |
| 2377 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2378 | if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo) |
| 2379 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2380 | 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] | 2381 | } |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 2382 | if ((u1 == eCSR_ROAM_FT_REASSOC_FAILED) && (pSession->bRefAssocStartCnt)) { |
| 2383 | /* |
| 2384 | * Decrement bRefAssocStartCnt for FT reassoc failure. |
| 2385 | * Reason: For FT reassoc failures, we first call |
| 2386 | * csrRoamCallCallback before notifying a failed roam |
| 2387 | * completion through csrRoamComplete. The latter in |
| 2388 | * turn calls csrRoamProcessResults which tries to |
| 2389 | * once again call csrRoamCallCallback if bRefAssocStartCnt |
| 2390 | * is non-zero. Since this is redundant for FT reassoc |
| 2391 | * failure, decrement bRefAssocStartCnt. |
| 2392 | */ |
| 2393 | pSession->bRefAssocStartCnt--; |
| 2394 | } |
| 2395 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2396 | if ( (pSession == NULL) || |
| 2397 | (eANI_BOOLEAN_FALSE == pSession->sessionActive) ) |
| 2398 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2399 | smsLog(pMac, LOG1, "Session ID is not valid"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2400 | return eHAL_STATUS_FAILURE; |
| 2401 | } |
| 2402 | |
| 2403 | if(NULL != pSession->callback) |
| 2404 | { |
| 2405 | if( pRoamInfo ) |
| 2406 | { |
| 2407 | pRoamInfo->sessionId = (tANI_U8)sessionId; |
| 2408 | } |
| 2409 | |
| 2410 | /* avoid holding the global lock when making the roaming callback , original change came |
| 2411 | from a raised CR (CR304874). Since this callback is in HDD a potential deadlock |
| 2412 | is possible on other OS ports where the callback may need to take locks to protect |
| 2413 | HDD state |
| 2414 | UPDATE : revert this change but keep the comments here. Need to revisit as there are callbacks |
| 2415 | that may actually depend on the lock being held */ |
| 2416 | // TODO: revisit: sme_ReleaseGlobalLock( &pMac->sme ); |
| 2417 | status = pSession->callback(pSession->pContext, pRoamInfo, roamId, u1, u2); |
| 2418 | // TODO: revisit: sme_AcquireGlobalLock( &pMac->sme ); |
| 2419 | } |
| 2420 | //EVENT_WLAN_STATUS: eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 2421 | // eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED, |
| 2422 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2423 | palZeroMemory(pMac->hHdd, &connectionStatus, sizeof(vos_event_wlan_status_payload_type)); |
| 2424 | if((eCSR_ROAM_ASSOCIATION_COMPLETION == u1) && (eCSR_ROAM_RESULT_ASSOCIATED == u2)) |
| 2425 | { |
| 2426 | connectionStatus.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 2427 | connectionStatus.bssType = pRoamInfo->u.pConnectedProfile->BSSType; |
| 2428 | if(NULL != pRoamInfo->pBssDesc) |
| 2429 | { |
| 2430 | connectionStatus.rssi = pRoamInfo->pBssDesc->rssi * (-1); |
| 2431 | connectionStatus.channel = pRoamInfo->pBssDesc->channelId; |
| 2432 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2433 | connectionStatus.qosCapability = pRoamInfo->u.pConnectedProfile->qosConnection; |
| 2434 | connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType); |
| 2435 | connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType); |
| 2436 | palCopyMemory(pMac->hHdd, connectionStatus.ssid, pRoamInfo->u.pConnectedProfile->SSID.ssId, 6); |
| 2437 | connectionStatus.reason = eCSR_REASON_UNSPECIFIED; |
| 2438 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2439 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2440 | if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2)) |
| 2441 | { |
| 2442 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2443 | connectionStatus.reason = eCSR_REASON_MIC_ERROR; |
| 2444 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2445 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2446 | if(eCSR_ROAM_RESULT_FORCED == u2) |
| 2447 | { |
| 2448 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2449 | connectionStatus.reason = eCSR_REASON_USER_REQUESTED; |
| 2450 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2451 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2452 | if(eCSR_ROAM_RESULT_DISASSOC_IND == u2) |
| 2453 | { |
| 2454 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2455 | connectionStatus.reason = eCSR_REASON_DISASSOC; |
| 2456 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2457 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2458 | if(eCSR_ROAM_RESULT_DEAUTH_IND == u2) |
| 2459 | { |
| 2460 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2461 | connectionStatus.reason = eCSR_REASON_DEAUTH; |
| 2462 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2463 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2464 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2465 | |
| 2466 | return (status); |
| 2467 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2468 | // Returns whether handoff is currently in progress or not |
| 2469 | tANI_BOOLEAN csrRoamIsHandoffInProgress(tpAniSirGlobal pMac) |
| 2470 | { |
| 2471 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 2472 | return csrNeighborRoamIsHandoffInProgress(pMac); |
| 2473 | #else |
| 2474 | return eANI_BOOLEAN_FALSE; |
| 2475 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2476 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2477 | eHalStatus csrRoamIssueDisassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2478 | eCsrRoamSubState NewSubstate, tANI_BOOLEAN fMICFailure ) |
| 2479 | { |
| 2480 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2481 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2482 | tANI_U16 reasonCode; |
| 2483 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2484 | |
| 2485 | if(!pSession) |
| 2486 | { |
| 2487 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2488 | return eHAL_STATUS_FAILURE; |
| 2489 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2490 | |
| 2491 | //Restore AC weight in case we change it |
| 2492 | if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 2493 | { |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 2494 | 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] | 2495 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 2496 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 2497 | } |
| 2498 | |
| 2499 | if ( fMICFailure ) |
| 2500 | { |
| 2501 | reasonCode = eSIR_MAC_MIC_FAILURE_REASON; |
| 2502 | } |
| 2503 | else if (NewSubstate == eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF) |
| 2504 | { |
| 2505 | reasonCode = eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2506 | } |
| 2507 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2508 | { |
| 2509 | reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 2510 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2511 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2512 | if ( (csrRoamIsHandoffInProgress(pMac)) && |
| 2513 | (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF)) |
| 2514 | { |
| 2515 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2516 | palCopyMemory(pMac->hHdd, &bssId, pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, sizeof(tSirMacAddr)); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2517 | } |
| 2518 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2519 | #endif |
| 2520 | if(pSession->pConnectBssDesc) |
| 2521 | { |
| 2522 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2523 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2524 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2525 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 2526 | smsLog( pMac, LOG2, "CSR Attempting to Disassociate Bssid=%02x-%02x-%02x-%02x-%02x-%02x" |
| 2527 | "subState = %d reason=%d", bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], bssId[ 3 ], |
| 2528 | bssId[ 4 ], bssId[ 5 ], NewSubstate, reasonCode); |
| 2529 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2530 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2531 | |
| 2532 | status = csrSendMBDisassocReqMsg( pMac, sessionId, bssId, reasonCode ); |
| 2533 | |
| 2534 | if(HAL_STATUS_SUCCESS(status)) |
| 2535 | { |
| 2536 | csrRoamLinkDown(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2537 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2538 | //no need to tell QoS that we are disassociating, it will be taken care off in assoc req for HO |
| 2539 | if(eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate) |
| 2540 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2541 | //notify QoS module that disassoc happening |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2542 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 2543 | } |
| 2544 | #endif |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2545 | } |
| 2546 | else |
| 2547 | { |
| 2548 | smsLog(pMac, LOGW, FL("csrSendMBDisassocReqMsg failed with status %d"), status); |
| 2549 | } |
| 2550 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2551 | return (status); |
| 2552 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2553 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2554 | /* --------------------------------------------------------------------------- |
| 2555 | \fn csrRoamIssueDisassociateStaCmd |
| 2556 | \brief csr function that HDD calls to disassociate a associated station |
| 2557 | \param sessionId - session Id for Soft AP |
| 2558 | \param pPeerMacAddr - MAC of associated station to delete |
| 2559 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2560 | \return eHalStatus |
| 2561 | ---------------------------------------------------------------------------*/ |
| 2562 | eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, |
| 2563 | tANI_U32 sessionId, |
| 2564 | tANI_U8 *pPeerMacAddr, |
| 2565 | tANI_U32 reason) |
| 2566 | { |
| 2567 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2568 | tSmeCmd *pCommand; |
| 2569 | |
| 2570 | do |
| 2571 | { |
| 2572 | pCommand = csrGetCommandBuffer( pMac ); |
| 2573 | if ( !pCommand ) |
| 2574 | { |
| 2575 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2576 | status = eHAL_STATUS_RESOURCES; |
| 2577 | break; |
| 2578 | } |
| 2579 | pCommand->command = eSmeCommandRoam; |
| 2580 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2581 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocSta; |
| 2582 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2583 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2584 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2585 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2586 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2587 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2588 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2589 | } |
| 2590 | }while(0); |
| 2591 | |
| 2592 | return status; |
| 2593 | } |
| 2594 | |
| 2595 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2596 | /* --------------------------------------------------------------------------- |
| 2597 | \fn csrRoamIssueDeauthSta |
| 2598 | \brief csr function that HDD calls to delete a associated station |
| 2599 | \param sessionId - session Id for Soft AP |
| 2600 | \param pPeerMacAddr - MAC of associated station to delete |
| 2601 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2602 | \return eHalStatus |
| 2603 | ---------------------------------------------------------------------------*/ |
| 2604 | eHalStatus csrRoamIssueDeauthStaCmd( tpAniSirGlobal pMac, |
| 2605 | tANI_U32 sessionId, |
| 2606 | tANI_U8 *pPeerMacAddr, |
| 2607 | tANI_U32 reason) |
| 2608 | { |
| 2609 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2610 | tSmeCmd *pCommand; |
| 2611 | |
| 2612 | do |
| 2613 | { |
| 2614 | pCommand = csrGetCommandBuffer( pMac ); |
| 2615 | if ( !pCommand ) |
| 2616 | { |
| 2617 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2618 | status = eHAL_STATUS_RESOURCES; |
| 2619 | break; |
| 2620 | } |
| 2621 | pCommand->command = eSmeCommandRoam; |
| 2622 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2623 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 2624 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2625 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2626 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2627 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2628 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2629 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2630 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2631 | } |
| 2632 | }while(0); |
| 2633 | |
| 2634 | return status; |
| 2635 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2636 | eHalStatus |
| 2637 | csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2638 | tANI_BOOLEAN bEnable ) |
| 2639 | { |
| 2640 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2641 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2642 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2643 | if (!pSession) |
| 2644 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2645 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2646 | return (status); |
| 2647 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2648 | if (pSession->pConnectBssDesc) |
| 2649 | { |
| 2650 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2651 | } |
| 2652 | else |
| 2653 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2654 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2655 | return (status); |
| 2656 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2657 | 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] | 2658 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2659 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] , bEnable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2660 | status = csrSendMBTkipCounterMeasuresReqMsg( pMac, sessionId, bEnable, bssId ); |
| 2661 | return (status); |
| 2662 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2663 | eHalStatus |
| 2664 | csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2665 | VOS_MODULE_ID modId, void *pUsrContext, |
| 2666 | void *pfnSapEventCallback, v_U8_t *pAssocStasBuf ) |
| 2667 | { |
| 2668 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2669 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2670 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2671 | if (!pSession) |
| 2672 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2673 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2674 | return (status); |
| 2675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2676 | if(pSession->pConnectBssDesc) |
| 2677 | { |
| 2678 | palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) ); |
| 2679 | } |
| 2680 | else |
| 2681 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2682 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2683 | return (status); |
| 2684 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2685 | 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] | 2686 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2687 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2688 | status = csrSendMBGetAssociatedStasReqMsg( pMac, sessionId, modId, bssId, pUsrContext, pfnSapEventCallback, pAssocStasBuf ); |
| 2689 | return (status); |
| 2690 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2691 | eHalStatus |
| 2692 | csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2693 | void *pUsrContext, void *pfnSapEventCallback, v_MACADDR_t pRemoveMac ) |
| 2694 | { |
| 2695 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2696 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2697 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2698 | |
| 2699 | if (!pSession) |
| 2700 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2701 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2702 | return (status); |
| 2703 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2704 | if(pSession->pConnectBssDesc) |
| 2705 | { |
| 2706 | palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) ); |
| 2707 | } |
| 2708 | else |
| 2709 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2710 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2711 | return (status); |
| 2712 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2713 | 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] | 2714 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2715 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
| 2716 | |
| 2717 | status = csrSendMBGetWPSPBCSessions( pMac, sessionId, bssId, pUsrContext, pfnSapEventCallback, pRemoveMac); |
| 2718 | |
| 2719 | return (status); |
| 2720 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2721 | eHalStatus csrRoamIssueDeauth( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 2722 | { |
| 2723 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2724 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2725 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2726 | |
| 2727 | if (!pSession) |
| 2728 | { |
| 2729 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2730 | return eHAL_STATUS_FAILURE; |
| 2731 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2732 | |
| 2733 | if(pSession->pConnectBssDesc) |
| 2734 | { |
| 2735 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2736 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2737 | 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] | 2738 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2739 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2740 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2741 | |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2742 | status = csrSendMBDeauthReqMsg( pMac, sessionId, bssId, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2743 | if(!HAL_STATUS_SUCCESS(status)) |
| 2744 | { |
| 2745 | smsLog(pMac, LOGW, FL("csrSendMBDeauthReqMsg failed with status %d"), status); |
| 2746 | } |
| 2747 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2748 | return (status); |
| 2749 | } |
| 2750 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2751 | eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc ) |
| 2752 | { |
| 2753 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2754 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2755 | tANI_U32 size; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2756 | |
| 2757 | if(!pSession) |
| 2758 | { |
| 2759 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2760 | return eHAL_STATUS_FAILURE; |
| 2761 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2762 | |
| 2763 | // If no BSS description was found in this connection (happens with start IBSS), then |
| 2764 | // nix the BSS description that we keep around for the connected BSS) and get out... |
| 2765 | if(NULL == pBssDesc) |
| 2766 | { |
| 2767 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2768 | } |
| 2769 | else |
| 2770 | { |
| 2771 | size = pBssDesc->length + sizeof( pBssDesc->length ); |
| 2772 | if(NULL != pSession->pConnectBssDesc) |
| 2773 | { |
| 2774 | if(((pSession->pConnectBssDesc->length) + sizeof(pSession->pConnectBssDesc->length)) < size) |
| 2775 | { |
| 2776 | //not enough room for the new BSS, pMac->roam.pConnectBssDesc is freed inside |
| 2777 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2778 | } |
| 2779 | } |
| 2780 | if(NULL == pSession->pConnectBssDesc) |
| 2781 | { |
| 2782 | status = palAllocateMemory( pMac->hHdd, (void **)&pSession->pConnectBssDesc, size); |
| 2783 | } |
| 2784 | if ( HAL_STATUS_SUCCESS(status) && pSession->pConnectBssDesc ) |
| 2785 | { |
| 2786 | palCopyMemory( pMac->hHdd, pSession->pConnectBssDesc, pBssDesc, size ); |
| 2787 | } |
| 2788 | } |
| 2789 | |
| 2790 | return (status); |
| 2791 | } |
| 2792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2793 | eHalStatus csrRoamPrepareBssConfig(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2794 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 2795 | tDot11fBeaconIEs *pIes) |
| 2796 | { |
| 2797 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2798 | eCsrCfgDot11Mode cfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2799 | VOS_ASSERT( pIes != NULL ); |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 2800 | if (pIes == NULL) |
| 2801 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2802 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2803 | do |
| 2804 | { |
| 2805 | palCopyMemory(pMac->hHdd, &pBssConfig->BssCap, &pBssDesc->capabilityInfo, sizeof(tSirMacCapabilityInfo)); |
| 2806 | //get qos |
| 2807 | pBssConfig->qosType = csrGetQoSFromBssDesc(pMac, pBssDesc, pIes); |
| 2808 | //get SSID |
| 2809 | if(pIes->SSID.present) |
| 2810 | { |
| 2811 | palCopyMemory(pMac->hHdd, &pBssConfig->SSID.ssId, pIes->SSID.ssid, pIes->SSID.num_ssid); |
| 2812 | pBssConfig->SSID.length = pIes->SSID.num_ssid; |
| 2813 | } |
| 2814 | else |
| 2815 | pBssConfig->SSID.length = 0; |
| 2816 | if(csrIsNULLSSID(pBssConfig->SSID.ssId, pBssConfig->SSID.length)) |
| 2817 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2818 | smsLog(pMac, LOGW, " BSS desc SSID is a wildcard"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2819 | //Return failed if profile doesn't have an SSID either. |
| 2820 | if(pProfile->SSIDs.numOfSSIDs == 0) |
| 2821 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2822 | smsLog(pMac, LOGW, " Both BSS desc and profile doesn't have SSID"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2823 | status = eHAL_STATUS_FAILURE; |
| 2824 | break; |
| 2825 | } |
| 2826 | } |
| 2827 | if(CSR_IS_CHANNEL_5GHZ(pBssDesc->channelId)) |
| 2828 | { |
| 2829 | pBssConfig->eBand = eCSR_BAND_5G; |
| 2830 | } |
| 2831 | else |
| 2832 | { |
| 2833 | pBssConfig->eBand = eCSR_BAND_24; |
| 2834 | } |
| 2835 | //phymode |
| 2836 | if(csrIsPhyModeMatch( pMac, pProfile->phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes )) |
| 2837 | { |
| 2838 | pBssConfig->uCfgDot11Mode = cfgDot11Mode; |
| 2839 | } |
| 2840 | else |
| 2841 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2842 | smsLog(pMac, LOGW, " Can not find match phy mode"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2843 | //force it |
| 2844 | if(eCSR_BAND_24 == pBssConfig->eBand) |
| 2845 | { |
| 2846 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2847 | } |
| 2848 | else |
| 2849 | { |
| 2850 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2851 | } |
| 2852 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2853 | //Qos |
| 2854 | if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) && |
| 2855 | (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos)) |
| 2856 | { |
| 2857 | //Joining BSS is not 11n capable and WMM is disabled on client. |
| 2858 | //Disable QoS and WMM |
| 2859 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2860 | } |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2861 | |
| 2862 | if (((pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11N) || |
Pratik Bhalgat | 8d46164 | 2012-11-22 16:55:42 +0530 | [diff] [blame] | 2863 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC)) && |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2864 | ((pBssConfig->qosType != eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP) || |
| 2865 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_HCF) || |
| 2866 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_eDCF) )) |
| 2867 | { |
| 2868 | //Joining BSS is 11n capable and WMM is disabled on AP. |
| 2869 | //Assume all HT AP's are QOS AP's and enable WMM |
| 2870 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2871 | } |
| 2872 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2873 | //auth type |
| 2874 | switch( pProfile->negotiatedAuthType ) |
| 2875 | { |
| 2876 | default: |
| 2877 | case eCSR_AUTH_TYPE_WPA: |
| 2878 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2879 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2880 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2881 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2882 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2883 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2884 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2885 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2886 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2887 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2888 | break; |
| 2889 | } |
| 2890 | //short slot time |
| 2891 | if( eCSR_CFG_DOT11_MODE_11B != cfgDot11Mode ) |
| 2892 | { |
| 2893 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2894 | } |
| 2895 | else |
| 2896 | { |
| 2897 | pBssConfig->uShortSlotTime = 0; |
| 2898 | } |
| 2899 | if(pBssConfig->BssCap.ibss) |
| 2900 | { |
| 2901 | //We don't support 11h on IBSS |
| 2902 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2903 | } |
| 2904 | else |
| 2905 | { |
| 2906 | pBssConfig->f11hSupport = pMac->roam.configParam.Is11hSupportEnabled; |
| 2907 | } |
| 2908 | //power constraint |
| 2909 | pBssConfig->uPowerLimit = csrGet11hPowerConstraint(pMac, &pIes->PowerConstraints); |
| 2910 | //heartbeat |
| 2911 | if ( CSR_IS_11A_BSS( pBssDesc ) ) |
| 2912 | { |
| 2913 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2914 | } |
| 2915 | else |
| 2916 | { |
| 2917 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 2918 | } |
| 2919 | //Join timeout |
| 2920 | // 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] | 2921 | // be 10 x the BeaconInterval. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2922 | if ( pBssDesc->beaconInterval ) |
| 2923 | { |
| 2924 | //Make sure it is bigger than the minimal |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2925 | 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] | 2926 | } |
| 2927 | else |
| 2928 | { |
| 2929 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
| 2930 | } |
| 2931 | //validate CB |
| 2932 | pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes); |
| 2933 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2934 | return (status); |
| 2935 | } |
| 2936 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2937 | static eHalStatus csrRoamPrepareBssConfigFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2938 | tBssConfigParam *pBssConfig, tSirBssDescription *pBssDesc) |
| 2939 | { |
| 2940 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2941 | tANI_U8 operationChannel = 0; |
| 2942 | tANI_U8 qAPisEnabled = FALSE; |
| 2943 | //SSID |
| 2944 | pBssConfig->SSID.length = 0; |
| 2945 | if(pProfile->SSIDs.numOfSSIDs) |
| 2946 | { |
| 2947 | //only use the first one |
| 2948 | palCopyMemory(pMac->hHdd, &pBssConfig->SSID, &pProfile->SSIDs.SSIDList[0].SSID, sizeof(tSirMacSSid)); |
| 2949 | } |
| 2950 | else |
| 2951 | { |
| 2952 | //SSID must present |
| 2953 | return eHAL_STATUS_FAILURE; |
| 2954 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2955 | //Settomg up the capabilities |
| 2956 | if( csrIsBssTypeIBSS(pProfile->BSSType) ) |
| 2957 | { |
| 2958 | pBssConfig->BssCap.ibss = 1; |
| 2959 | } |
| 2960 | else |
| 2961 | { |
| 2962 | pBssConfig->BssCap.ess = 1; |
| 2963 | } |
| 2964 | if( eCSR_ENCRYPT_TYPE_NONE != pProfile->EncryptionType.encryptionType[0] ) |
| 2965 | { |
| 2966 | pBssConfig->BssCap.privacy = 1; |
| 2967 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2968 | pBssConfig->eBand = pMac->roam.configParam.eBand; |
| 2969 | //phymode |
| 2970 | if(pProfile->ChannelInfo.ChannelList) |
| 2971 | { |
| 2972 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 2973 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2974 | pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, operationChannel, |
| 2975 | &pBssConfig->eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2976 | //QOS |
| 2977 | //Is this correct to always set to this //*** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2978 | if ( pBssConfig->BssCap.ess == 1 ) |
| 2979 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2980 | /*For Softap case enable WMM*/ |
| 2981 | if(CSR_IS_INFRA_AP(pProfile) && (eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode )){ |
| 2982 | qAPisEnabled = TRUE; |
| 2983 | } |
| 2984 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2985 | if (csrRoamGetQosInfoFromBss(pMac, pBssDesc) == eHAL_STATUS_SUCCESS) { |
| 2986 | qAPisEnabled = TRUE; |
| 2987 | } else { |
| 2988 | qAPisEnabled = FALSE; |
| 2989 | } |
| 2990 | } else { |
| 2991 | qAPisEnabled = TRUE; |
| 2992 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2993 | if (( eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && qAPisEnabled) || |
| 2994 | (( eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && qAPisEnabled) || |
| 2995 | ( eCSR_CFG_DOT11_MODE_TAURUS == pBssConfig->uCfgDot11Mode ) ) //For 11n, need QoS |
| 2996 | ) |
| 2997 | { |
| 2998 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2999 | } else { |
| 3000 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 3001 | } |
| 3002 | |
| 3003 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 3004 | switch( pProfile->AuthType.authType[0] ) //Take the preferred Auth type. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3005 | { |
| 3006 | default: |
| 3007 | case eCSR_AUTH_TYPE_WPA: |
| 3008 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 3009 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 3010 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3011 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 3012 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3013 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 3014 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 3015 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3016 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 3017 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 3018 | break; |
| 3019 | } |
| 3020 | //short slot time |
| 3021 | if( WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode ) |
| 3022 | { |
| 3023 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 3024 | } |
| 3025 | else |
| 3026 | { |
| 3027 | pBssConfig->uShortSlotTime = 0; |
| 3028 | } |
| 3029 | //power constraint. We don't support 11h on IBSS |
| 3030 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 3031 | pBssConfig->uPowerLimit = 0; |
| 3032 | //heartbeat |
| 3033 | if ( eCSR_BAND_5G == pBssConfig->eBand ) |
| 3034 | { |
| 3035 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 3036 | } |
| 3037 | else |
| 3038 | { |
| 3039 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 3040 | } |
| 3041 | //Join timeout |
| 3042 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3043 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3044 | return (status); |
| 3045 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3046 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc) |
| 3047 | { |
| 3048 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3049 | tDot11fBeaconIEs *pIes = NULL; |
| 3050 | |
| 3051 | do |
| 3052 | { |
| 3053 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 3054 | { |
| 3055 | //err msg |
| 3056 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3057 | "csrRoamGetQosInfoFromBss() failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3058 | break; |
| 3059 | } |
| 3060 | //check if the AP is QAP & it supports APSD |
| 3061 | if( CSR_IS_QOS_BSS(pIes) ) |
| 3062 | { |
| 3063 | return eHAL_STATUS_SUCCESS; |
| 3064 | } |
| 3065 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3066 | return status; |
| 3067 | } |
| 3068 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3069 | void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy ) |
| 3070 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3071 | // !! Note: the only difference between this function and the csrSetCfgPrivacyFromProfile() is the |
| 3072 | // setting of the privacy CFG based on the advertised privacy setting from the AP for WPA associations. |
| 3073 | // See !!Note: below in this function... |
| 3074 | tANI_U32 PrivacyEnabled = 0; |
| 3075 | tANI_U32 RsnEnabled = 0; |
| 3076 | tANI_U32 WepDefaultKeyId = 0; |
| 3077 | tANI_U32 WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; /* default 40 bits */ |
| 3078 | tANI_U32 Key0Length = 0; |
| 3079 | tANI_U32 Key1Length = 0; |
| 3080 | tANI_U32 Key2Length = 0; |
| 3081 | tANI_U32 Key3Length = 0; |
| 3082 | |
| 3083 | // Reserve for the biggest key |
| 3084 | tANI_U8 Key0[ WNI_CFG_WEP_DEFAULT_KEY_1_LEN ]; |
| 3085 | tANI_U8 Key1[ WNI_CFG_WEP_DEFAULT_KEY_2_LEN ]; |
| 3086 | tANI_U8 Key2[ WNI_CFG_WEP_DEFAULT_KEY_3_LEN ]; |
| 3087 | tANI_U8 Key3[ WNI_CFG_WEP_DEFAULT_KEY_4_LEN ]; |
| 3088 | |
| 3089 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 3090 | { |
| 3091 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3092 | |
| 3093 | // for NO encryption, turn off Privacy and Rsn. |
| 3094 | PrivacyEnabled = 0; |
| 3095 | RsnEnabled = 0; |
| 3096 | |
| 3097 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 3098 | |
| 3099 | // clear out the WEP keys that may be hanging around. |
| 3100 | Key0Length = 0; |
| 3101 | Key1Length = 0; |
| 3102 | Key2Length = 0; |
| 3103 | Key3Length = 0; |
| 3104 | |
| 3105 | break; |
| 3106 | |
| 3107 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3108 | case eCSR_ENCRYPT_TYPE_WEP40: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3109 | |
| 3110 | // Privacy is ON. NO RSN for Wep40 static key. |
| 3111 | PrivacyEnabled = 1; |
| 3112 | RsnEnabled = 0; |
| 3113 | |
| 3114 | // Set the Wep default key ID. |
| 3115 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3116 | // Wep key size if 5 bytes (40 bits). |
| 3117 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3118 | |
| 3119 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 3120 | if ( pProfile->Keys.KeyLength[0] ) |
| 3121 | { |
| 3122 | palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[0], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 3123 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3124 | } |
| 3125 | else |
| 3126 | { |
| 3127 | Key0Length = 0; |
| 3128 | } |
| 3129 | |
| 3130 | if ( pProfile->Keys.KeyLength[1] ) |
| 3131 | { |
| 3132 | palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[1], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 3133 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3134 | } |
| 3135 | else |
| 3136 | { |
| 3137 | Key1Length = 0; |
| 3138 | } |
| 3139 | |
| 3140 | if ( pProfile->Keys.KeyLength[2] ) |
| 3141 | { |
| 3142 | palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[2], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 3143 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3144 | } |
| 3145 | else |
| 3146 | { |
| 3147 | Key2Length = 0; |
| 3148 | } |
| 3149 | |
| 3150 | if ( pProfile->Keys.KeyLength[3] ) |
| 3151 | { |
| 3152 | palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[3], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 3153 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3154 | } |
| 3155 | else |
| 3156 | { |
| 3157 | Key3Length = 0; |
| 3158 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3159 | break; |
| 3160 | |
| 3161 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3162 | case eCSR_ENCRYPT_TYPE_WEP104: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3163 | |
| 3164 | // Privacy is ON. NO RSN for Wep40 static key. |
| 3165 | PrivacyEnabled = 1; |
| 3166 | RsnEnabled = 0; |
| 3167 | |
| 3168 | // Set the Wep default key ID. |
| 3169 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
| 3170 | |
| 3171 | // Wep key size if 13 bytes (104 bits). |
| 3172 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3173 | |
| 3174 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 3175 | if ( pProfile->Keys.KeyLength[0] ) |
| 3176 | { |
| 3177 | palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[ 0 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 3178 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3179 | } |
| 3180 | else |
| 3181 | { |
| 3182 | Key0Length = 0; |
| 3183 | } |
| 3184 | |
| 3185 | if ( pProfile->Keys.KeyLength[1] ) |
| 3186 | { |
| 3187 | palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[ 1 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 3188 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3189 | } |
| 3190 | else |
| 3191 | { |
| 3192 | Key1Length = 0; |
| 3193 | } |
| 3194 | |
| 3195 | if ( pProfile->Keys.KeyLength[2] ) |
| 3196 | { |
| 3197 | palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[ 2 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 3198 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3199 | } |
| 3200 | else |
| 3201 | { |
| 3202 | Key2Length = 0; |
| 3203 | } |
| 3204 | |
| 3205 | if ( pProfile->Keys.KeyLength[3] ) |
| 3206 | { |
| 3207 | palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[ 3 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 3208 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3209 | } |
| 3210 | else |
| 3211 | { |
| 3212 | Key3Length = 0; |
| 3213 | } |
| 3214 | |
| 3215 | break; |
| 3216 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3217 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3218 | case eCSR_ENCRYPT_TYPE_AES: |
| 3219 | #ifdef FEATURE_WLAN_WAPI |
| 3220 | case eCSR_ENCRYPT_TYPE_WPI: |
| 3221 | #endif /* FEATURE_WLAN_WAPI */ |
| 3222 | // !! Note: this is the only difference between this function and the csrSetCfgPrivacyFromProfile() |
| 3223 | // (setting of the privacy CFG based on the advertised privacy setting from the AP for WPA/WAPI associations ). |
| 3224 | PrivacyEnabled = (0 != fPrivacy); |
| 3225 | |
| 3226 | // turn on RSN enabled for WPA associations |
| 3227 | RsnEnabled = 1; |
| 3228 | |
| 3229 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 3230 | |
| 3231 | // clear out the static WEP keys that may be hanging around. |
| 3232 | Key0Length = 0; |
| 3233 | Key1Length = 0; |
| 3234 | Key2Length = 0; |
| 3235 | Key3Length = 0; |
| 3236 | |
| 3237 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3238 | default: |
| 3239 | PrivacyEnabled = 0; |
| 3240 | RsnEnabled = 0; |
| 3241 | break; |
| 3242 | } |
| 3243 | |
| 3244 | ccmCfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3245 | ccmCfgSetInt(pMac, WNI_CFG_RSN_ENABLED, RsnEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3246 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length, NULL, eANI_BOOLEAN_FALSE); |
| 3247 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length, NULL, eANI_BOOLEAN_FALSE); |
| 3248 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length, NULL, eANI_BOOLEAN_FALSE); |
| 3249 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length, NULL, eANI_BOOLEAN_FALSE); |
| 3250 | ccmCfgSetInt(pMac, WNI_CFG_WEP_KEY_LENGTH, WepKeyLength, NULL, eANI_BOOLEAN_FALSE); |
| 3251 | ccmCfgSetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId, NULL, eANI_BOOLEAN_FALSE); |
| 3252 | } |
| 3253 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3254 | static void csrSetCfgSsid( tpAniSirGlobal pMac, tSirMacSSid *pSSID ) |
| 3255 | { |
| 3256 | tANI_U32 len = 0; |
| 3257 | if(pSSID->length <= WNI_CFG_SSID_LEN) |
| 3258 | { |
| 3259 | len = pSSID->length; |
| 3260 | } |
| 3261 | ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pSSID->ssId, len, NULL, eANI_BOOLEAN_FALSE); |
| 3262 | } |
| 3263 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3264 | eHalStatus csrSetQosToCfg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrMediaAccessType qosType ) |
| 3265 | { |
| 3266 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3267 | tANI_U32 QoSEnabled; |
| 3268 | tANI_U32 WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3269 | // set the CFG enable/disable variables based on the qosType being configured... |
| 3270 | switch( qosType ) |
| 3271 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3272 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p: |
| 3273 | QoSEnabled = FALSE; |
| 3274 | WmeEnabled = TRUE; |
| 3275 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3276 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP: |
| 3277 | QoSEnabled = FALSE; |
| 3278 | WmeEnabled = TRUE; |
| 3279 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3280 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify: |
| 3281 | QoSEnabled = FALSE; |
| 3282 | WmeEnabled = TRUE; |
| 3283 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3284 | case eCSR_MEDIUM_ACCESS_11e_eDCF: |
| 3285 | QoSEnabled = TRUE; |
| 3286 | WmeEnabled = FALSE; |
| 3287 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3288 | case eCSR_MEDIUM_ACCESS_11e_HCF: |
| 3289 | QoSEnabled = TRUE; |
| 3290 | WmeEnabled = FALSE; |
| 3291 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3292 | default: |
| 3293 | case eCSR_MEDIUM_ACCESS_DCF: |
| 3294 | QoSEnabled = FALSE; |
| 3295 | WmeEnabled = FALSE; |
| 3296 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3297 | } |
| 3298 | //save the WMM setting for later use |
| 3299 | pMac->roam.roamSession[sessionId].fWMMConnection = (tANI_BOOLEAN)WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3300 | status = ccmCfgSetInt(pMac, WNI_CFG_QOS_ENABLED, QoSEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3301 | status = ccmCfgSetInt(pMac, WNI_CFG_WME_ENABLED, WmeEnabled, NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3302 | return (status); |
| 3303 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3304 | static eHalStatus csrGetRateSet( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc, |
| 3305 | tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet) |
| 3306 | { |
| 3307 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3308 | int i; |
| 3309 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3310 | tANI_U8 *pDstRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3311 | palZeroMemory(pMac->hHdd, pOpRateSet, sizeof(tSirMacRateSet)); |
| 3312 | palZeroMemory(pMac->hHdd, pExRateSet, sizeof(tSirMacRateSet)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3313 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3314 | |
| 3315 | if( NULL != pIes ) |
| 3316 | { |
| 3317 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3318 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3319 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3320 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3321 | // would blindly put the rates we support into our Operational Rate set |
| 3322 | // (including the basic rates, which we have already verified are |
| 3323 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3324 | // However, it turns out that this is not always the case. Some AP's |
| 3325 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3326 | // too. Now, we're a little more careful: |
| 3327 | pDstRate = pOpRateSet->rate; |
| 3328 | if(pIes->SuppRates.present) |
| 3329 | { |
| 3330 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3331 | { |
| 3332 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) ) |
| 3333 | { |
| 3334 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 3335 | pOpRateSet->numRates++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3336 | } |
| 3337 | } |
| 3338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3339 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3340 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3341 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3342 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3343 | { |
| 3344 | // If there are Extended Rates in the beacon, we will reflect those |
| 3345 | // extended rates that we support in out Extended Operational Rate |
| 3346 | // set: |
| 3347 | pDstRate = pExRateSet->rate; |
| 3348 | if(pIes->ExtSuppRates.present) |
| 3349 | { |
| 3350 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3351 | { |
| 3352 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) ) |
| 3353 | { |
| 3354 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3355 | pExRateSet->numRates++; |
| 3356 | } |
| 3357 | } |
| 3358 | } |
| 3359 | } |
| 3360 | }//Parsing BSSDesc |
| 3361 | else |
| 3362 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3363 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3364 | } |
| 3365 | if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0) status = eHAL_STATUS_SUCCESS; |
| 3366 | return status; |
| 3367 | } |
| 3368 | |
| 3369 | static void csrSetCfgRateSet( tpAniSirGlobal pMac, eCsrPhyMode phyMode, tCsrRoamProfile *pProfile, |
| 3370 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3371 | { |
| 3372 | int i; |
| 3373 | tANI_U8 *pDstRate; |
| 3374 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3375 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3376 | tANI_U32 OperationalRatesLength = 0; |
| 3377 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3378 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3379 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3380 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3381 | tANI_U32 PropRatesEnable = 0; |
| 3382 | tANI_U8 MCSRateIdxSet[ SIZE_OF_SUPPORTED_MCS_SET ]; |
| 3383 | tANI_U32 MCSRateLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3384 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3385 | if( NULL != pIes ) |
| 3386 | { |
| 3387 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3388 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3389 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3390 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3391 | // would blindly put the rates we support into our Operational Rate set |
| 3392 | // (including the basic rates, which we have already verified are |
| 3393 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3394 | // However, it turns out that this is not always the case. Some AP's |
| 3395 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3396 | // too. Now, we're a little more careful: |
| 3397 | pDstRate = OperationalRates; |
| 3398 | if(pIes->SuppRates.present) |
| 3399 | { |
| 3400 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3401 | { |
| 3402 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) && |
| 3403 | ( OperationalRatesLength < CSR_DOT11_SUPPORTED_RATES_MAX )) |
| 3404 | { |
| 3405 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
| 3406 | OperationalRatesLength++; |
| 3407 | } |
| 3408 | } |
| 3409 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3410 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3411 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3412 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3413 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3414 | { |
| 3415 | // If there are Extended Rates in the beacon, we will reflect those |
| 3416 | // extended rates that we support in out Extended Operational Rate |
| 3417 | // set: |
| 3418 | pDstRate = ExtendedOperationalRates; |
| 3419 | if(pIes->ExtSuppRates.present) |
| 3420 | { |
| 3421 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3422 | { |
| 3423 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) && |
| 3424 | ( ExtendedOperationalRatesLength < CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX )) |
| 3425 | { |
| 3426 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3427 | ExtendedOperationalRatesLength++; |
| 3428 | } |
| 3429 | } |
| 3430 | } |
| 3431 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3432 | // Enable proprietary MAC features if peer node is Airgo node and STA |
| 3433 | // user wants to use them |
| 3434 | if( pIes->Airgo.present && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3435 | { |
| 3436 | PropRatesEnable = 1; |
| 3437 | } |
| 3438 | else |
| 3439 | { |
| 3440 | PropRatesEnable = 0; |
| 3441 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3442 | // For ANI network companions, we need to populate the proprietary rate |
| 3443 | // set with any proprietary rates we found in the beacon, only if user |
| 3444 | // allows them... |
| 3445 | if ( PropRatesEnable && pIes->Airgo.PropSuppRates.present && |
| 3446 | ( pIes->Airgo.PropSuppRates.num_rates > 0 )) |
| 3447 | { |
| 3448 | ProprietaryOperationalRatesLength = pIes->Airgo.PropSuppRates.num_rates; |
| 3449 | if ( ProprietaryOperationalRatesLength > sizeof(ProprietaryOperationalRates) ) |
| 3450 | { |
| 3451 | ProprietaryOperationalRatesLength = sizeof (ProprietaryOperationalRates); |
| 3452 | } |
| 3453 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, pIes->Airgo.PropSuppRates.rates, ProprietaryOperationalRatesLength ); |
| 3454 | } |
| 3455 | else { |
| 3456 | // No proprietary modes... |
| 3457 | ProprietaryOperationalRatesLength = 0; |
| 3458 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3459 | /* Get MCS Rate */ |
| 3460 | pDstRate = MCSRateIdxSet; |
| 3461 | if ( pIes->HTCaps.present ) |
| 3462 | { |
| 3463 | for ( i = 0; i < VALID_MAX_MCS_INDEX; i++ ) |
| 3464 | { |
| 3465 | if ( (unsigned int)pIes->HTCaps.supportedMCSSet[0] & (1 << i) ) |
| 3466 | { |
| 3467 | MCSRateLength++; |
| 3468 | *pDstRate++ = i; |
| 3469 | } |
| 3470 | } |
| 3471 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3472 | // Set the operational rate set CFG variables... |
| 3473 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3474 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3475 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3476 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3477 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3478 | ProprietaryOperationalRates, |
| 3479 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3480 | ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE); |
| 3481 | ccmCfgSetStr(pMac, WNI_CFG_CURRENT_MCS_SET, MCSRateIdxSet, |
| 3482 | MCSRateLength, NULL, eANI_BOOLEAN_FALSE); |
| 3483 | }//Parsing BSSDesc |
| 3484 | else |
| 3485 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3486 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3487 | } |
| 3488 | } |
| 3489 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3490 | static void csrSetCfgRateSetFromProfile( tpAniSirGlobal pMac, |
| 3491 | tCsrRoamProfile *pProfile ) |
| 3492 | { |
| 3493 | tSirMacRateSetIE DefaultSupportedRates11a = { SIR_MAC_RATESET_EID, |
| 3494 | { 8, |
| 3495 | { SIR_MAC_RATE_6, |
| 3496 | SIR_MAC_RATE_9, |
| 3497 | SIR_MAC_RATE_12, |
| 3498 | SIR_MAC_RATE_18, |
| 3499 | SIR_MAC_RATE_24, |
| 3500 | SIR_MAC_RATE_36, |
| 3501 | SIR_MAC_RATE_48, |
| 3502 | SIR_MAC_RATE_54 } } }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3503 | tSirMacRateSetIE DefaultSupportedRates11b = { SIR_MAC_RATESET_EID, |
| 3504 | { 4, |
| 3505 | { SIR_MAC_RATE_1, |
| 3506 | SIR_MAC_RATE_2, |
| 3507 | SIR_MAC_RATE_5_5, |
| 3508 | SIR_MAC_RATE_11 } } }; |
| 3509 | |
| 3510 | |
| 3511 | tSirMacPropRateSet DefaultSupportedPropRates = { 3, |
| 3512 | { SIR_MAC_RATE_72, |
| 3513 | SIR_MAC_RATE_96, |
| 3514 | SIR_MAC_RATE_108 } }; |
| 3515 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3516 | eCsrBand eBand; |
| 3517 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3518 | tANI_U32 OperationalRatesLength = 0; |
| 3519 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3520 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3521 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3522 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3523 | tANI_U32 PropRatesEnable = 0; |
| 3524 | tANI_U8 operationChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3525 | if(pProfile->ChannelInfo.ChannelList) |
| 3526 | { |
| 3527 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 3528 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3529 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3530 | // For 11a networks, the 11a rates go into the Operational Rate set. For 11b and 11g |
| 3531 | // networks, the 11b rates appear in the Operational Rate set. In either case, |
| 3532 | // we can blindly put the rates we support into our Operational Rate set |
| 3533 | // (including the basic rates, which we have already verified are supported |
| 3534 | // earlier in the roaming decision). |
| 3535 | if ( eCSR_BAND_5G == eBand ) |
| 3536 | { |
| 3537 | // 11a rates into the Operational Rate Set. |
| 3538 | OperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3539 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
| 3540 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3541 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3542 | OperationalRatesLength ); |
| 3543 | |
| 3544 | // Nothing in the Extended rate set. |
| 3545 | ExtendedOperationalRatesLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3546 | // populate proprietary rates if user allows them |
| 3547 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3548 | { |
| 3549 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3550 | sizeof(*DefaultSupportedPropRates.propRate); |
| 3551 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, |
| 3552 | DefaultSupportedPropRates.propRate, |
| 3553 | ProprietaryOperationalRatesLength ); |
| 3554 | } |
| 3555 | else |
| 3556 | { |
| 3557 | // No proprietary modes |
| 3558 | ProprietaryOperationalRatesLength = 0; |
| 3559 | } |
| 3560 | } |
| 3561 | else if ( eCSR_CFG_DOT11_MODE_11B == cfgDot11Mode ) |
| 3562 | { |
| 3563 | // 11b rates into the Operational Rate Set. |
| 3564 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3565 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
| 3566 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3567 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3568 | OperationalRatesLength ); |
| 3569 | // Nothing in the Extended rate set. |
| 3570 | ExtendedOperationalRatesLength = 0; |
| 3571 | // No proprietary modes |
| 3572 | ProprietaryOperationalRatesLength = 0; |
| 3573 | } |
| 3574 | else |
| 3575 | { |
| 3576 | // 11G |
| 3577 | |
| 3578 | // 11b rates into the Operational Rate Set. |
| 3579 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3580 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
| 3581 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3582 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3583 | OperationalRatesLength ); |
| 3584 | |
| 3585 | // 11a rates go in the Extended rate set. |
| 3586 | ExtendedOperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3587 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
| 3588 | palCopyMemory( pMac->hHdd, ExtendedOperationalRates, |
| 3589 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3590 | ExtendedOperationalRatesLength ); |
| 3591 | |
| 3592 | // populate proprietary rates if user allows them |
| 3593 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3594 | { |
| 3595 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3596 | sizeof(*DefaultSupportedPropRates.propRate); |
| 3597 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, |
| 3598 | DefaultSupportedPropRates.propRate, |
| 3599 | ProprietaryOperationalRatesLength ); |
| 3600 | } |
| 3601 | else |
| 3602 | { |
| 3603 | // No proprietary modes |
| 3604 | ProprietaryOperationalRatesLength = 0; |
| 3605 | } |
| 3606 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3607 | // set this to 1 if prop. rates need to be advertised in to the IBSS beacon and user wants to use them |
| 3608 | if ( ProprietaryOperationalRatesLength && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3609 | { |
| 3610 | PropRatesEnable = 1; |
| 3611 | } |
| 3612 | else |
| 3613 | { |
| 3614 | PropRatesEnable = 0; |
| 3615 | } |
| 3616 | |
| 3617 | // Set the operational rate set CFG variables... |
| 3618 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3619 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3620 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3621 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3622 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3623 | ProprietaryOperationalRates, |
| 3624 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3625 | 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] | 3626 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3627 | void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result) |
| 3628 | { |
| 3629 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3630 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3631 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 3632 | tANI_U32 sessionId; |
| 3633 | tSmeCmd *pCommand = NULL; |
| 3634 | |
| 3635 | if(NULL == pEntry) |
| 3636 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3637 | smsLog(pMac, LOGW, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3638 | return; |
| 3639 | } |
| 3640 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 3641 | sessionId = pCommand->sessionId; |
| 3642 | |
| 3643 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 3644 | { |
| 3645 | csrRoamingStateConfigCnfProcessor(pMac, (tANI_U32)result); |
| 3646 | } |
| 3647 | } |
| 3648 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3649 | //This function is very dump. It is here because PE still need WNI_CFG_PHY_MODE |
| 3650 | tANI_U32 csrRoamGetPhyModeFromDot11Mode(eCsrCfgDot11Mode dot11Mode, eCsrBand band) |
| 3651 | { |
| 3652 | if(eCSR_CFG_DOT11_MODE_11B == dot11Mode) |
| 3653 | { |
| 3654 | return (WNI_CFG_PHY_MODE_11B); |
| 3655 | } |
| 3656 | else |
| 3657 | { |
| 3658 | if(eCSR_BAND_24 == band) |
| 3659 | return (WNI_CFG_PHY_MODE_11G); |
| 3660 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3661 | return (WNI_CFG_PHY_MODE_11A); |
| 3662 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3663 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3664 | |
| 3665 | #ifdef WLAN_FEATURE_11AC |
| 3666 | ePhyChanBondState csrGetHTCBStateFromVHTCBState(ePhyChanBondState aniCBMode) |
| 3667 | { |
| 3668 | switch ( aniCBMode ) |
| 3669 | { |
| 3670 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 3671 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 3672 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 3673 | return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 3674 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 3675 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 3676 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 3677 | return PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 3678 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3679 | default : |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3680 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 3681 | } |
| 3682 | } |
| 3683 | #endif |
| 3684 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3685 | //pIes may be NULL |
| 3686 | eHalStatus csrRoamSetBssConfigCfg(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3687 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 3688 | tDot11fBeaconIEs *pIes) |
| 3689 | { |
| 3690 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3691 | tANI_U32 cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3692 | tANI_U8 channel = 0; |
| 3693 | //Make sure we have the domain info for the BSS we try to connect to. |
| 3694 | //Do we need to worry about sequence for OSs that are not Windows?? |
| 3695 | if(pBssDesc) |
| 3696 | { |
| 3697 | if(csrLearnCountryInformation(pMac, pBssDesc, pIes, eANI_BOOLEAN_TRUE)) |
| 3698 | { |
| 3699 | //Make sure the 11d info from this BSSDesc can be applied |
| 3700 | pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE; |
| 3701 | csrApplyCountryInformation( pMac, TRUE ); |
| 3702 | } |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3703 | if ((csrIs11dSupported (pMac)) && pIes) |
| 3704 | { |
| 3705 | if (!pIes->Country.present) |
| 3706 | csrResetCountryInformation(pMac, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE ); |
| 3707 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3708 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3709 | //Qos |
| 3710 | csrSetQosToCfg( pMac, sessionId, pBssConfig->qosType ); |
| 3711 | //SSID |
| 3712 | csrSetCfgSsid(pMac, &pBssConfig->SSID ); |
| 3713 | //fragment threshold |
| 3714 | //ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3715 | //RTS threshold |
| 3716 | //ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3717 | |
| 3718 | //ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, csrTranslateToWNICfgDot11Mode(pMac, pBssConfig->uCfgDot11Mode), NULL, eANI_BOOLEAN_FALSE); |
| 3719 | |
| 3720 | //Auth type |
| 3721 | ccmCfgSetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType, NULL, eANI_BOOLEAN_FALSE); |
| 3722 | //encryption type |
| 3723 | csrSetCfgPrivacy(pMac, pProfile, (tANI_BOOLEAN)pBssConfig->BssCap.privacy ); |
| 3724 | //short slot time |
| 3725 | 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] | 3726 | //11d |
| 3727 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 3728 | ((pBssConfig->f11hSupport) ? pBssConfig->f11hSupport : pProfile->ieee80211d), |
| 3729 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3730 | /*//11h |
| 3731 | ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3732 | */ |
| 3733 | ccmCfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, pBssConfig->uPowerLimit, NULL, eANI_BOOLEAN_FALSE); |
| 3734 | //CB |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3735 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 3736 | 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] | 3737 | { |
| 3738 | channel = pProfile->operationChannel; |
| 3739 | } |
| 3740 | else |
| 3741 | { |
| 3742 | if(pBssDesc) |
| 3743 | { |
| 3744 | channel = pBssDesc->channelId; |
| 3745 | } |
| 3746 | } |
| 3747 | if(0 != channel) |
| 3748 | { |
| 3749 | if(CSR_IS_CHANNEL_24GHZ(channel)) |
| 3750 | {//for now if we are on 2.4 Ghz, CB will be always disabled |
| 3751 | cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3752 | } |
| 3753 | else |
| 3754 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3755 | cfgCb = pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3756 | } |
| 3757 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3758 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | a0d8893 | 2012-11-13 10:51:26 -0800 | [diff] [blame] | 3759 | // cbMode = 1 in cfg.ini is mapped to PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 3760 | // in function csrConvertCBIniValueToPhyCBState() |
| 3761 | // So, max value for cbMode in 40MHz mode is 3 (MAC\src\include\sirParams.h) |
| 3762 | if(cfgCb > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3763 | { |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3764 | if(!WDA_getFwWlanFeatCaps(DOT11AC)) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3765 | cfgCb = csrGetHTCBStateFromVHTCBState(cfgCb); |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3766 | } |
| 3767 | else |
| 3768 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3769 | 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] | 3770 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3771 | } |
| 3772 | else |
| 3773 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3774 | ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, cfgCb, NULL, eANI_BOOLEAN_FALSE); |
| 3775 | //Rate |
| 3776 | //Fixed Rate |
| 3777 | if(pBssDesc) |
| 3778 | { |
| 3779 | csrSetCfgRateSet(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile, pBssDesc, pIes); |
| 3780 | } |
| 3781 | else |
| 3782 | { |
| 3783 | csrSetCfgRateSetFromProfile(pMac, pProfile); |
| 3784 | } |
| 3785 | //Make this the last CFG to set. The callback will trigger a join_req |
| 3786 | //Join time out |
| 3787 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId ); |
| 3788 | |
| 3789 | 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] | 3790 | return (status); |
| 3791 | } |
| 3792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3793 | eHalStatus csrRoamStopNetwork( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3794 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3795 | { |
| 3796 | eHalStatus status; |
| 3797 | tBssConfigParam *pBssConfig; |
| 3798 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3799 | |
| 3800 | if(!pSession) |
| 3801 | { |
| 3802 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3803 | return eHAL_STATUS_FAILURE; |
| 3804 | } |
| 3805 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3806 | status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); |
| 3807 | if(HAL_STATUS_SUCCESS(status)) |
| 3808 | { |
| 3809 | palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam)); |
| 3810 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, pBssConfig, pIes); |
| 3811 | if(HAL_STATUS_SUCCESS(status)) |
| 3812 | { |
| 3813 | pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3814 | /* This will allow to pass cbMode during join req */ |
| 3815 | pSession->bssParams.cbMode= pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3816 | //For IBSS, we need to prepare some more information |
| 3817 | if( csrIsBssTypeIBSS(pProfile->BSSType) || CSR_IS_WDS( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3818 | || CSR_IS_INFRA_AP(pProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3819 | ) |
| 3820 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3821 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3822 | } |
| 3823 | // If we are in an IBSS, then stop the IBSS... |
| 3824 | ////Not worry about WDS connection for now |
| 3825 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 3826 | { |
| 3827 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 3828 | } |
| 3829 | else |
| 3830 | { |
| 3831 | // if we are in an Infrastructure association.... |
| 3832 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 3833 | { |
| 3834 | // and the new Bss is an Ibss OR we are roaming from Infra to Infra |
| 3835 | // across SSIDs (roaming to a new SSID)... // |
| 3836 | //Not worry about WDS connection for now |
| 3837 | if ( pBssDesc && ( ( csrIsIbssBssDesc( pBssDesc ) ) || |
| 3838 | !csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIes ) ) ) |
| 3839 | { |
| 3840 | // then we need to disassociate from the Infrastructure network... |
| 3841 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 3842 | } |
| 3843 | else |
| 3844 | { |
| 3845 | // In an Infrastucture and going to an Infrastructure network with the same SSID. This |
| 3846 | // calls for a Reassociation sequence. So issue the CFG sets for this new AP. |
| 3847 | if ( pBssDesc ) |
| 3848 | { |
| 3849 | // Set parameters for this Bss. |
| 3850 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
| 3851 | } |
| 3852 | } |
| 3853 | } |
| 3854 | else |
| 3855 | { |
| 3856 | // Neiher in IBSS nor in Infra. We can go ahead and set the CFG for tne new network... |
| 3857 | // Nothing to stop. |
| 3858 | if ( pBssDesc || CSR_IS_WDS_AP( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3859 | || CSR_IS_INFRA_AP(pProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3860 | ) |
| 3861 | { |
| 3862 | // Set parameters for this Bss. |
| 3863 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
| 3864 | } |
| 3865 | } |
| 3866 | } |
| 3867 | }//Success getting BSS config info |
| 3868 | palFreeMemory(pMac->hHdd, pBssConfig); |
| 3869 | }//Allocate memory |
| 3870 | |
| 3871 | return (status); |
| 3872 | } |
| 3873 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3874 | eCsrJoinState csrRoamJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3875 | tCsrScanResultInfo *pScanResult, tCsrRoamProfile *pProfile ) |
| 3876 | { |
| 3877 | eCsrJoinState eRoamState = eCsrContinueRoaming; |
| 3878 | eHalStatus status; |
| 3879 | tSirBssDescription *pBssDesc = &pScanResult->BssDescriptor; |
| 3880 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)( pScanResult->pvIes ); //This may be NULL |
| 3881 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3882 | |
| 3883 | if(!pSession) |
| 3884 | { |
| 3885 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3886 | return (eCsrStopRoaming); |
| 3887 | } |
| 3888 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3889 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 3890 | { |
| 3891 | status = csrRoamStartWds( pMac, sessionId, pProfile, pBssDesc ); |
| 3892 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 3893 | { |
| 3894 | eRoamState = eCsrStopRoaming; |
| 3895 | } |
| 3896 | } |
| 3897 | else |
| 3898 | { |
| 3899 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 3900 | { |
| 3901 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
| 3902 | return (eCsrStopRoaming); |
| 3903 | } |
| 3904 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 3905 | { |
| 3906 | // If we are connected in infrastructure mode and the Join Bss description is for the same BssID, then we are |
| 3907 | // attempting to join the AP we are already connected with. In that case, see if the Bss or Sta capabilities |
| 3908 | // have changed and handle the changes (without disturbing the current association). |
| 3909 | |
| 3910 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && |
| 3911 | csrIsBssIdEqual( pMac, pBssDesc, pSession->pConnectBssDesc ) && |
| 3912 | csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIesLocal ) |
| 3913 | ) |
| 3914 | { |
| 3915 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 3916 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 3917 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 3918 | // a new Association. |
| 3919 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 3920 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3921 | 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] | 3922 | if(csrRoamIsSameProfileKeys(pMac, &pSession->connectedProfile, pProfile)) |
| 3923 | { |
| 3924 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 3925 | } |
| 3926 | else |
| 3927 | { |
| 3928 | tBssConfigParam bssConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3929 | //The key changes |
| 3930 | palZeroMemory(pMac->hHdd, &bssConfig, sizeof(bssConfig)); |
| 3931 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 3932 | if(HAL_STATUS_SUCCESS(status)) |
| 3933 | { |
| 3934 | pSession->bssParams.uCfgDot11Mode = bssConfig.uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3935 | pSession->bssParams.cbMode = bssConfig.cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3936 | //Reapply the config including Keys so reassoc is happening. |
| 3937 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 3938 | if(!HAL_STATUS_SUCCESS(status)) |
| 3939 | { |
| 3940 | eRoamState = eCsrStopRoaming; |
| 3941 | } |
| 3942 | } |
| 3943 | else |
| 3944 | { |
| 3945 | eRoamState = eCsrStopRoaming; |
| 3946 | } |
| 3947 | }//same profile |
| 3948 | } |
| 3949 | else |
| 3950 | { |
| 3951 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, sessionId, |
| 3952 | eCSR_ROAM_SUBSTATE_DISASSOC_REQ, FALSE ))) |
| 3953 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3954 | smsLog(pMac, LOGW, FL(" fail to issue disassociate")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3955 | eRoamState = eCsrStopRoaming; |
| 3956 | } |
| 3957 | } |
| 3958 | } |
| 3959 | else |
| 3960 | { |
| 3961 | // note: we used to pre-auth here with open authentication networks but that was not working so well. |
| 3962 | // we had a lot of join timeouts when testing at Samsung. removing this step helped associations |
| 3963 | // work much better. |
| 3964 | // |
| 3965 | // |
| 3966 | // stop the existing network before attempting to join the new network... |
| 3967 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 3968 | { |
| 3969 | eRoamState = eCsrStopRoaming; |
| 3970 | } |
| 3971 | } |
| 3972 | }//Infra |
| 3973 | else |
| 3974 | { |
| 3975 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 3976 | { |
| 3977 | eRoamState = eCsrStopRoaming; |
| 3978 | } |
| 3979 | } |
| 3980 | if( pIesLocal && !pScanResult->pvIes ) |
| 3981 | { |
| 3982 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 3983 | } |
| 3984 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3985 | return( eRoamState ); |
| 3986 | } |
| 3987 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3988 | eHalStatus csrRoamShouldRoam(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3989 | tSirBssDescription *pBssDesc, tANI_U32 roamId) |
| 3990 | { |
| 3991 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3992 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3993 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 3994 | roamInfo.pBssDesc = pBssDesc; |
| 3995 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, roamId, eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE); |
| 3996 | return (status); |
| 3997 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3998 | //In case no matching BSS is found, use whatever default we can find |
| 3999 | static void csrRoamAssignDefaultParam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4000 | { |
| 4001 | //Need to get all negotiated types in place first |
| 4002 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 4003 | 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] | 4004 | { |
| 4005 | default: |
| 4006 | case eCSR_AUTH_TYPE_WPA: |
| 4007 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 4008 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 4009 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 4010 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4011 | break; |
| 4012 | |
| 4013 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 4014 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 4015 | break; |
| 4016 | |
| 4017 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 4018 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 4019 | break; |
| 4020 | } |
| 4021 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 4022 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 4023 | //In this case, the multicast encryption needs to follow the uncast ones. |
| 4024 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 4025 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 4026 | } |
| 4027 | |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4028 | |
| 4029 | static void csrSetAbortRoamingCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4030 | { |
| 4031 | switch(pCommand->u.roamCmd.roamReason) |
| 4032 | { |
| 4033 | case eCsrLostLink1: |
| 4034 | pCommand->u.roamCmd.roamReason = eCsrLostLink1Abort; |
| 4035 | break; |
| 4036 | case eCsrLostLink2: |
| 4037 | pCommand->u.roamCmd.roamReason = eCsrLostLink2Abort; |
| 4038 | break; |
| 4039 | case eCsrLostLink3: |
| 4040 | pCommand->u.roamCmd.roamReason = eCsrLostLink3Abort; |
| 4041 | break; |
| 4042 | default: |
| 4043 | smsLog(pMac, LOGE, FL(" aborting roaming reason %d not recognized"), |
| 4044 | pCommand->u.roamCmd.roamReason); |
| 4045 | break; |
| 4046 | } |
| 4047 | } |
| 4048 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4049 | static eCsrJoinState csrRoamJoinNextBss( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fUseSameBss ) |
| 4050 | { |
| 4051 | eHalStatus status; |
| 4052 | tCsrScanResult *pScanResult = NULL; |
| 4053 | eCsrJoinState eRoamState = eCsrStopRoaming; |
| 4054 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 4055 | tANI_BOOLEAN fDone = eANI_BOOLEAN_FALSE; |
| 4056 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 4057 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4058 | v_U8_t acm_mask = 0; |
| 4059 | #endif |
| 4060 | tANI_U32 sessionId = pCommand->sessionId; |
| 4061 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4062 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4063 | tANI_U8 concurrentChannel = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4064 | |
| 4065 | if(!pSession) |
| 4066 | { |
| 4067 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4068 | return (eCsrStopRoaming); |
| 4069 | } |
| 4070 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4071 | do |
| 4072 | { |
| 4073 | // Check for Cardbus eject condition, before trying to Roam to any BSS |
| 4074 | //***if( !balIsCardPresent(pAdapter) ) break; |
| 4075 | |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 4076 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 4077 | memcpy (&roamInfo.bssid, &pSession->joinFailStatusCode.bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4078 | if(NULL != pBSSList) |
| 4079 | { |
| 4080 | // When handling AP's capability change, continue to associate to |
| 4081 | // same BSS and make sure pRoamBssEntry is not Null. |
| 4082 | if((eANI_BOOLEAN_FALSE == fUseSameBss) || (pCommand->u.roamCmd.pRoamBssEntry == NULL)) |
| 4083 | { |
| 4084 | if(pCommand->u.roamCmd.pRoamBssEntry == NULL) |
| 4085 | { |
| 4086 | //Try the first BSS |
| 4087 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4088 | pCommand->u.roamCmd.pRoamBssEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 4089 | } |
| 4090 | else |
| 4091 | { |
| 4092 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 4093 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 4094 | { |
| 4095 | //Done with all the BSSs |
| 4096 | //In this case, will tell HDD the completion |
| 4097 | break; |
| 4098 | } |
| 4099 | else |
| 4100 | { |
| 4101 | //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] | 4102 | //palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4103 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; //this shall not be NULL |
| 4104 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4105 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4106 | pRoamInfo = &roamInfo; |
| 4107 | } |
| 4108 | } |
| 4109 | while(pCommand->u.roamCmd.pRoamBssEntry) |
| 4110 | { |
| 4111 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4112 | /*If concurrency enabled take the concurrent connected channel first. */ |
| 4113 | /* Valid multichannel concurrent sessions exempted */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4114 | if (vos_concurrent_sessions_running() && |
| 4115 | !csrIsValidMcConcurrentSession(pMac, sessionId, &pScanResult->Result.BssDescriptor)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4116 | { |
| 4117 | concurrentChannel = |
| 4118 | csrGetConcurrentOperationChannel(pMac); |
| 4119 | 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] | 4120 | " csr Concurrent Channel = %d", __func__, concurrentChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4121 | if ((concurrentChannel) && |
| 4122 | (concurrentChannel == |
| 4123 | pScanResult->Result.BssDescriptor.channelId)) |
| 4124 | { |
| 4125 | //make this 0 because we do not want the |
| 4126 | //below check to pass as we don't want to |
| 4127 | //connect on other channel |
| 4128 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 4129 | FL("Concurrent channel match =%d"), |
| 4130 | concurrentChannel); |
| 4131 | concurrentChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4132 | } |
| 4133 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4134 | |
| 4135 | if (!concurrentChannel) |
| 4136 | { |
| 4137 | |
| 4138 | if(HAL_STATUS_SUCCESS(csrRoamShouldRoam(pMac, |
| 4139 | sessionId, &pScanResult->Result.BssDescriptor, |
| 4140 | pCommand->u.roamCmd.roamId))) |
| 4141 | { |
| 4142 | //Ok to roam this |
| 4143 | break; |
| 4144 | } |
| 4145 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4146 | else |
| 4147 | { |
| 4148 | eRoamState = eCsrStopRoamingDueToConcurrency; |
| 4149 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4150 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 4151 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 4152 | { |
| 4153 | //Done with all the BSSs |
| 4154 | fDone = eANI_BOOLEAN_TRUE; |
| 4155 | break; |
| 4156 | } |
| 4157 | } |
| 4158 | if(fDone) |
| 4159 | { |
| 4160 | break; |
| 4161 | } |
| 4162 | } |
| 4163 | } |
| 4164 | //We have something to roam, tell HDD when it is infra. |
| 4165 | //For IBSS, the indication goes back to HDD via eCSR_ROAM_IBSS_IND |
| 4166 | //For WDS, the indication is eCSR_ROAM_WDS_IND |
| 4167 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 4168 | { |
| 4169 | if(pRoamInfo) |
| 4170 | { |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4171 | if(pSession->bRefAssocStartCnt) |
| 4172 | { |
| 4173 | pSession->bRefAssocStartCnt--; |
| 4174 | //Complete the last association attemp because a new one is about to be tried |
| 4175 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4176 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4177 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4178 | } |
| 4179 | } |
| 4180 | /* If the roaming has stopped, not to continue the roaming command*/ |
| 4181 | if ( !CSR_IS_ROAMING(pSession) && CSR_IS_ROAMING_COMMAND(pCommand) ) |
| 4182 | { |
| 4183 | //No need to complete roaming here as it already completes |
| 4184 | smsLog(pMac, LOGW, FL(" Roam command (reason %d) aborted due to roaming completed"), |
| 4185 | pCommand->u.roamCmd.roamReason); |
| 4186 | eRoamState = eCsrStopRoaming; |
| 4187 | csrSetAbortRoamingCommand(pMac, pCommand); |
| 4188 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4189 | } |
| 4190 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 4191 | if(pScanResult) |
| 4192 | { |
| 4193 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4194 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->Result.BssDescriptor, &pIesLocal))) ) |
| 4195 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4196 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4197 | fDone = eANI_BOOLEAN_TRUE; |
| 4198 | eRoamState = eCsrStopRoaming; |
| 4199 | break; |
| 4200 | } |
| 4201 | roamInfo.pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4202 | pCommand->u.roamCmd.pLastRoamBss = roamInfo.pBssDesc; |
| 4203 | //No need to put uapsd_mask in if the BSS doesn't support uAPSD |
| 4204 | if( pCommand->u.roamCmd.roamProfile.uapsd_mask && |
| 4205 | CSR_IS_QOS_BSS(pIesLocal) && |
| 4206 | CSR_IS_UAPSD_BSS(pIesLocal) ) |
| 4207 | { |
| 4208 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4209 | acm_mask = sme_QosGetACMMask(pMac, &pScanResult->Result.BssDescriptor, |
| 4210 | pIesLocal); |
| 4211 | pCommand->u.roamCmd.roamProfile.uapsd_mask &= ~(acm_mask); |
| 4212 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4213 | } |
| 4214 | else |
| 4215 | { |
| 4216 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 4217 | } |
| 4218 | if( pIesLocal && !pScanResult->Result.pvIes) |
| 4219 | { |
| 4220 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 4221 | } |
| 4222 | } |
| 4223 | else |
| 4224 | { |
| 4225 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 4226 | } |
| 4227 | roamInfo.pProfile = pProfile; |
| 4228 | pSession->bRefAssocStartCnt++; |
| 4229 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4230 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4231 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4232 | if ( NULL == pCommand->u.roamCmd.pRoamBssEntry ) |
| 4233 | { |
| 4234 | // If this is a start IBSS profile, then we need to start the IBSS. |
| 4235 | if ( CSR_IS_START_IBSS(pProfile) ) |
| 4236 | { |
| 4237 | tANI_BOOLEAN fSameIbss = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4238 | // Attempt to start this IBSS... |
| 4239 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 4240 | status = csrRoamStartIbss( pMac, sessionId, pProfile, &fSameIbss ); |
| 4241 | if(HAL_STATUS_SUCCESS(status)) |
| 4242 | { |
| 4243 | if ( fSameIbss ) |
| 4244 | { |
| 4245 | eRoamState = eCsrStartIbssSameIbss; |
| 4246 | } |
| 4247 | else |
| 4248 | { |
| 4249 | eRoamState = eCsrContinueRoaming; |
| 4250 | } |
| 4251 | } |
| 4252 | else |
| 4253 | { |
| 4254 | //it somehow fail need to stop |
| 4255 | eRoamState = eCsrStopRoaming; |
| 4256 | } |
| 4257 | break; |
| 4258 | } |
| 4259 | else if ( (CSR_IS_WDS_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4260 | || (CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4261 | ) |
| 4262 | { |
| 4263 | // Attempt to start this WDS... |
| 4264 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 4265 | /* For AP WDS, we dont have any BSSDescription */ |
| 4266 | status = csrRoamStartWds( pMac, sessionId, pProfile, NULL ); |
| 4267 | if(HAL_STATUS_SUCCESS(status)) |
| 4268 | { |
| 4269 | eRoamState = eCsrContinueRoaming; |
| 4270 | } |
| 4271 | else |
| 4272 | { |
| 4273 | //it somehow fail need to stop |
| 4274 | eRoamState = eCsrStopRoaming; |
| 4275 | } |
| 4276 | } |
| 4277 | else |
| 4278 | { |
| 4279 | //Nothing we can do |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4280 | smsLog(pMac, LOGW, FL("cannot continue without BSS list")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4281 | eRoamState = eCsrStopRoaming; |
| 4282 | break; |
| 4283 | } |
| 4284 | } |
| 4285 | else //We have BSS |
| 4286 | { |
| 4287 | //Need to assign these value because they are used in csrIsSameProfile |
| 4288 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4289 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = pScanResult->ucEncryptionType; //Negotiated while building scan result. |
| 4290 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = pScanResult->mcEncryptionType; |
| 4291 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = pScanResult->authType; |
| 4292 | if ( CSR_IS_START_IBSS(&pCommand->u.roamCmd.roamProfile) ) |
| 4293 | { |
| 4294 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 4295 | { |
| 4296 | eRoamState = eCsrStartIbssSameIbss; |
| 4297 | break; |
| 4298 | } |
| 4299 | } |
| 4300 | if( pCommand->u.roamCmd.fReassocToSelfNoCapChange ) |
| 4301 | { |
| 4302 | //trying to connect to the one already connected |
| 4303 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_FALSE; |
| 4304 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 4305 | break; |
| 4306 | } |
| 4307 | // Attempt to Join this Bss... |
| 4308 | eRoamState = csrRoamJoin( pMac, sessionId, &pScanResult->Result, pProfile ); |
| 4309 | break; |
| 4310 | } |
| 4311 | |
| 4312 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4313 | if( (eCsrStopRoaming == eRoamState) && (CSR_IS_INFRASTRUCTURE( pProfile )) ) |
| 4314 | { |
| 4315 | //Need to indicate association_completion if association_start has been done |
| 4316 | if(pSession->bRefAssocStartCnt > 0) |
| 4317 | { |
| 4318 | pSession->bRefAssocStartCnt--; |
| 4319 | //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] | 4320 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4321 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4322 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 4323 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 4324 | } |
| 4325 | } |
| 4326 | |
| 4327 | return( eRoamState ); |
| 4328 | } |
| 4329 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4330 | static eHalStatus csrRoam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4331 | { |
| 4332 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4333 | eCsrJoinState RoamState; |
| 4334 | tANI_U32 sessionId = pCommand->sessionId; |
| 4335 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4336 | //***if( hddIsRadioStateOn( pAdapter ) ) |
| 4337 | { |
| 4338 | // Attept to join a Bss... |
| 4339 | RoamState = csrRoamJoinNextBss( pMac, pCommand, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4340 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4341 | // if nothing to join.. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4342 | if (( eCsrStopRoaming == RoamState ) || ( eCsrStopRoamingDueToConcurrency == RoamState)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4343 | { |
| 4344 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4345 | // and if connected in Infrastructure mode... |
| 4346 | if ( csrIsConnStateInfra(pMac, sessionId) ) |
| 4347 | { |
| 4348 | //... then we need to issue a disassociation |
| 4349 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, FALSE ); |
| 4350 | if(!HAL_STATUS_SUCCESS(status)) |
| 4351 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4352 | smsLog(pMac, LOGW, FL(" failed to issue disassociate, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4353 | //roam command is completed by caller in the failed case |
| 4354 | fComplete = eANI_BOOLEAN_TRUE; |
| 4355 | } |
| 4356 | } |
| 4357 | else if( csrIsConnStateIbss(pMac, sessionId) ) |
| 4358 | { |
| 4359 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4360 | if(!HAL_STATUS_SUCCESS(status)) |
| 4361 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4362 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4363 | //roam command is completed by caller in the failed case |
| 4364 | fComplete = eANI_BOOLEAN_TRUE; |
| 4365 | } |
| 4366 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4367 | else if (csrIsConnStateConnectedInfraAp(pMac, sessionId)) |
| 4368 | { |
| 4369 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4370 | if(!HAL_STATUS_SUCCESS(status)) |
| 4371 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4372 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4373 | //roam command is completed by caller in the failed case |
| 4374 | fComplete = eANI_BOOLEAN_TRUE; |
| 4375 | } |
| 4376 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4377 | else |
| 4378 | { |
| 4379 | fComplete = eANI_BOOLEAN_TRUE; |
| 4380 | } |
| 4381 | if(fComplete) |
| 4382 | { |
| 4383 | // ... otherwise, we can complete the Roam command here. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4384 | if(eCsrStopRoamingDueToConcurrency == RoamState) |
| 4385 | { |
| 4386 | csrRoamComplete( pMac, eCsrJoinFailureDueToConcurrency, NULL ); |
| 4387 | } |
| 4388 | else |
| 4389 | { |
| 4390 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 4391 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4392 | } |
| 4393 | } |
| 4394 | else if ( eCsrReassocToSelfNoCapChange == RoamState ) |
| 4395 | { |
| 4396 | csrRoamComplete( pMac, eCsrSilentlyStopRoamingSaveState, NULL ); |
| 4397 | } |
| 4398 | else if ( eCsrStartIbssSameIbss == RoamState ) |
| 4399 | { |
| 4400 | csrRoamComplete( pMac, eCsrSilentlyStopRoaming, NULL ); |
| 4401 | } |
| 4402 | }//hddIsRadioStateOn |
| 4403 | |
| 4404 | return status; |
| 4405 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4406 | eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4407 | { |
| 4408 | tANI_U32 sessionId; |
| 4409 | tCsrRoamSession *pSession; |
| 4410 | tCsrScanResult *pScanResult = NULL; |
| 4411 | tSirBssDescription *pBssDesc = NULL; |
| 4412 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4413 | sessionId = pCommand->sessionId; |
| 4414 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4415 | |
| 4416 | if(!pSession) |
| 4417 | { |
| 4418 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4419 | return eHAL_STATUS_FAILURE; |
| 4420 | } |
| 4421 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4422 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 4423 | { |
| 4424 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4425 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4426 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4427 | return eHAL_STATUS_FAILURE; |
| 4428 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4429 | if (pCommand->u.roamCmd.pRoamBssEntry) |
| 4430 | { |
| 4431 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4432 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4433 | } |
| 4434 | else |
| 4435 | { |
| 4436 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4437 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4438 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4439 | return eHAL_STATUS_FAILURE; |
| 4440 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4441 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 4442 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 4443 | return status; |
| 4444 | } |
| 4445 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4446 | eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4447 | { |
| 4448 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4449 | tCsrRoamInfo roamInfo; |
| 4450 | tANI_U32 sessionId = pCommand->sessionId; |
| 4451 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4452 | |
| 4453 | if(!pSession) |
| 4454 | { |
| 4455 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4456 | return eHAL_STATUS_FAILURE; |
| 4457 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4458 | |
| 4459 | switch ( pCommand->u.roamCmd.roamReason ) |
| 4460 | { |
| 4461 | case eCsrForcedDisassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4462 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4463 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4464 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4465 | case eCsrSmeIssuedDisassocForHandoff: |
| 4466 | //Not to free pMac->roam.pCurRoamProfile (via csrFreeRoamProfile) because it is needed after disconnect |
| 4467 | #if 0 // TODO : Confirm this change |
| 4468 | status = csrRoamProcessDisassociate( pMac, pCommand, FALSE ); |
| 4469 | #else |
| 4470 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 4471 | #endif |
| 4472 | |
| 4473 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4474 | case eCsrForcedDisassocMICFailure: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4475 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, TRUE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4476 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4477 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4478 | case eCsrForcedDeauth: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4479 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, FALSE, FALSE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4480 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4481 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4482 | case eCsrHddIssuedReassocToSameAP: |
| 4483 | case eCsrSmeIssuedReassocToSameAP: |
| 4484 | { |
| 4485 | tDot11fBeaconIEs *pIes = NULL; |
| 4486 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4487 | if( pSession->pConnectBssDesc ) |
| 4488 | { |
| 4489 | status = csrGetParsedBssDescriptionIEs(pMac, pSession->pConnectBssDesc, &pIes); |
| 4490 | if(!HAL_STATUS_SUCCESS(status) ) |
| 4491 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4492 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4493 | } |
| 4494 | else |
| 4495 | { |
| 4496 | roamInfo.reasonCode = eCsrRoamReasonStaCapabilityChanged; |
| 4497 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
| 4498 | pSession->roamingReason = eCsrReassocRoaming; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4499 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 4500 | roamInfo.pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4501 | pSession->bRefAssocStartCnt++; |
| 4502 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4503 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4504 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4505 | smsLog(pMac, LOG1, FL(" calling csrRoamIssueReassociate")); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4506 | status = csrRoamIssueReassociate( pMac, sessionId, pSession->pConnectBssDesc, pIes, |
| 4507 | &pCommand->u.roamCmd.roamProfile ); |
| 4508 | if(!HAL_STATUS_SUCCESS(status)) |
| 4509 | { |
| 4510 | smsLog(pMac, LOGE, FL("csrRoamIssueReassociate failed with status %d"), status); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 4511 | csrReleaseCommandRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4512 | } |
| 4513 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4514 | palFreeMemory(pMac->hHdd, pIes); |
| 4515 | pIes = NULL; |
| 4516 | } |
| 4517 | } |
| 4518 | break; |
| 4519 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4520 | case eCsrCapsChange: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4521 | smsLog(pMac, LOGE, FL("received eCsrCapsChange ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4522 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4523 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE); |
| 4524 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4525 | case eCsrSmeIssuedFTReassoc: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4526 | smsLog(pMac, LOGE, FL("received FT Reassoc Req ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4527 | status = csrProcessFTReassocRoamCommand(pMac, pCommand); |
| 4528 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4529 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4530 | case eCsrStopBss: |
| 4531 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4532 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4533 | break; |
| 4534 | |
| 4535 | case eCsrForcedDisassocSta: |
| 4536 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4537 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId); |
| 4538 | status = csrSendMBDisassocReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4539 | pCommand->u.roamCmd.reason); |
| 4540 | break; |
| 4541 | |
| 4542 | case eCsrForcedDeauthSta: |
| 4543 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4544 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId); |
| 4545 | status = csrSendMBDeauthReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4546 | pCommand->u.roamCmd.reason); |
| 4547 | break; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4548 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4549 | case eCsrPerformPreauth: |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 4550 | smsLog(pMac, LOG1, FL("Attempting FT PreAuth Req")); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4551 | status = csrRoamIssueFTPreauthReq(pMac, sessionId, |
| 4552 | pCommand->u.roamCmd.pLastRoamBss); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4553 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4554 | |
| 4555 | default: |
| 4556 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4557 | |
| 4558 | if( pCommand->u.roamCmd.fUpdateCurRoamProfile ) |
| 4559 | { |
| 4560 | //Remember the roaming profile |
| 4561 | csrFreeRoamProfile(pMac, sessionId); |
| 4562 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)))) |
| 4563 | { |
| 4564 | palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 4565 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, &pCommand->u.roamCmd.roamProfile); |
| 4566 | } |
| 4567 | } |
| 4568 | |
| 4569 | //At this point, original uapsd_mask is saved in pCurRoamProfile |
| 4570 | //uapsd_mask in the pCommand may change from this point on. |
| 4571 | |
| 4572 | // Attempt to roam with the new scan results (if we need to..) |
| 4573 | status = csrRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4574 | if(!HAL_STATUS_SUCCESS(status)) |
| 4575 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4576 | smsLog(pMac, LOGW, FL("csrRoam() failed with status = 0x%08X"), status); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4577 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4578 | break; |
| 4579 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4580 | return (status); |
| 4581 | } |
| 4582 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4583 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4584 | { |
| 4585 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4586 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4587 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
| 4588 | palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd)); |
| 4589 | } |
| 4590 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4591 | void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4592 | { |
| 4593 | if(pCommand->u.roamCmd.fReleaseBssList) |
| 4594 | { |
| 4595 | csrScanResultPurge(pMac, pCommand->u.roamCmd.hBSSList); |
| 4596 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 4597 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 4598 | } |
| 4599 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 4600 | { |
| 4601 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 4602 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 4603 | } |
| 4604 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4605 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
| 4606 | palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd)); |
| 4607 | } |
| 4608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4609 | void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4610 | { |
| 4611 | palZeroMemory(pMac->hHdd, &pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd)); |
| 4612 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4613 | void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context ) |
| 4614 | { |
| 4615 | tListElem *pEntry; |
| 4616 | tSmeCmd *pCommand; |
| 4617 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4618 | smsLog( pMac, LOG2, "Roam Completion ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4619 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 4620 | if ( pEntry ) |
| 4621 | { |
| 4622 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4623 | // If the head of the queue is Active and it is a ROAM command, remove |
| 4624 | // and put this on the Free queue. |
| 4625 | if ( eSmeCommandRoam == pCommand->command ) |
| 4626 | { |
| 4627 | //we need to process the result first before removing it from active list because state changes |
| 4628 | //still happening insides roamQProcessRoamResults so no other roam command should be issued |
| 4629 | fReleaseCommand = csrRoamProcessResults( pMac, pCommand, Result, Context ); |
| 4630 | if( fReleaseCommand ) |
| 4631 | { |
| 4632 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 4633 | { |
| 4634 | csrReleaseCommandRoam( pMac, pCommand ); |
| 4635 | } |
| 4636 | else |
| 4637 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4638 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4639 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4640 | } |
| 4641 | } |
| 4642 | else |
| 4643 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4644 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4645 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4646 | } |
| 4647 | } |
| 4648 | else |
| 4649 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4650 | 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] | 4651 | } |
| 4652 | } |
| 4653 | else |
| 4654 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4655 | smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4656 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4657 | if( fReleaseCommand ) |
| 4658 | { |
| 4659 | smeProcessPendingQueue( pMac ); |
| 4660 | } |
| 4661 | } |
| 4662 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4663 | void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4664 | { |
| 4665 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4666 | if(!pSession) |
| 4667 | { |
| 4668 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4669 | return; |
| 4670 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4671 | palZeroMemory( pMac->hHdd, &(pSession->PmkidCandidateInfo[0]), sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED ); |
| 4672 | pSession->NumPmkidCandidate = 0; |
| 4673 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4674 | #ifdef FEATURE_WLAN_WAPI |
| 4675 | void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4676 | { |
| 4677 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4678 | if(!pSession) |
| 4679 | { |
| 4680 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4681 | return; |
| 4682 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4683 | palZeroMemory( pMac->hHdd, &(pSession->BkidCandidateInfo[0]), sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED ); |
| 4684 | pSession->NumBkidCandidate = 0; |
| 4685 | } |
| 4686 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4687 | extern tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ]; |
| 4688 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4689 | static eHalStatus csrRoamSaveSecurityRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrAuthType authType, |
| 4690 | tSirBssDescription *pSirBssDesc, |
| 4691 | tDot11fBeaconIEs *pIes) |
| 4692 | { |
| 4693 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4694 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4695 | tDot11fBeaconIEs *pIesLocal = pIes; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4696 | |
| 4697 | if(!pSession) |
| 4698 | { |
| 4699 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4700 | return eHAL_STATUS_FAILURE; |
| 4701 | } |
| 4702 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4703 | if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4704 | (eCSR_AUTH_TYPE_WPA_PSK == authType) || |
| 4705 | (eCSR_AUTH_TYPE_RSN == authType) || |
| 4706 | (eCSR_AUTH_TYPE_RSN_PSK == authType) |
| 4707 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4708 | || |
| 4709 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4710 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) |
| 4711 | #endif /* FEATURE_WLAN_WAPI */ |
| 4712 | #ifdef FEATURE_WLAN_WAPI |
| 4713 | || |
| 4714 | (eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4715 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType) |
| 4716 | #endif /* FEATURE_WLAN_WAPI */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4717 | #ifdef WLAN_FEATURE_11W |
| 4718 | || |
| 4719 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) |
| 4720 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4721 | ) |
| 4722 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4723 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 4724 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4725 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4726 | } |
| 4727 | if( pIesLocal ) |
| 4728 | { |
| 4729 | tANI_U32 nIeLen; |
| 4730 | tANI_U8 *pIeBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4731 | if((eCSR_AUTH_TYPE_RSN == authType) || |
| 4732 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4733 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4734 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) || |
| 4735 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4736 | #if defined WLAN_FEATURE_11W |
| 4737 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) || |
| 4738 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4739 | (eCSR_AUTH_TYPE_RSN_PSK == authType)) |
| 4740 | { |
| 4741 | if(pIesLocal->RSN.present) |
| 4742 | { |
| 4743 | //Calculate the actual length |
| 4744 | nIeLen = 8 //version + gp_cipher_suite + pwise_cipher_suite_count |
| 4745 | + pIesLocal->RSN.pwise_cipher_suite_count * 4 //pwise_cipher_suites |
| 4746 | + 2 //akm_suite_count |
| 4747 | + pIesLocal->RSN.akm_suite_count * 4 //akm_suites |
| 4748 | + 2; //reserved |
| 4749 | if( pIesLocal->RSN.pmkid_count ) |
| 4750 | { |
| 4751 | nIeLen += 2 + pIesLocal->RSN.pmkid_count * 4; //pmkid |
| 4752 | } |
| 4753 | //nIeLen doesn't count EID and length fields |
| 4754 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2)))) |
| 4755 | { |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 4756 | palZeroMemory(pMac->hHdd, pSession->pWpaRsnRspIE, nIeLen + 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4757 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_RSN; |
| 4758 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4759 | //copy upto akm_suites |
| 4760 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 4761 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.version, sizeof(pIesLocal->RSN.version)); |
| 4762 | pIeBuf += sizeof(pIesLocal->RSN.version); |
| 4763 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.gp_cipher_suite, sizeof(pIesLocal->RSN.gp_cipher_suite)); |
| 4764 | pIeBuf += sizeof(pIesLocal->RSN.gp_cipher_suite); |
| 4765 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.pwise_cipher_suite_count, sizeof(pIesLocal->RSN.pwise_cipher_suite_count)); |
| 4766 | pIeBuf += sizeof(pIesLocal->RSN.pwise_cipher_suite_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4767 | if( pIesLocal->RSN.pwise_cipher_suite_count ) |
| 4768 | { |
| 4769 | //copy pwise_cipher_suites |
| 4770 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.pwise_cipher_suites, |
| 4771 | pIesLocal->RSN.pwise_cipher_suite_count * 4); |
| 4772 | pIeBuf += pIesLocal->RSN.pwise_cipher_suite_count * 4; |
| 4773 | } |
| 4774 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.akm_suite_count, 2); |
| 4775 | pIeBuf += 2; |
| 4776 | if( pIesLocal->RSN.akm_suite_count ) |
| 4777 | { |
| 4778 | //copy akm_suites |
| 4779 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites, |
| 4780 | pIesLocal->RSN.akm_suite_count * 4); |
| 4781 | pIeBuf += pIesLocal->RSN.akm_suite_count * 4; |
| 4782 | } |
| 4783 | //copy the rest |
| 4784 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites + |
| 4785 | pIesLocal->RSN.akm_suite_count * 4, |
| 4786 | 2 + pIesLocal->RSN.pmkid_count * 4); |
| 4787 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4788 | } |
| 4789 | } |
| 4790 | } |
| 4791 | else if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4792 | (eCSR_AUTH_TYPE_WPA_PSK == authType)) |
| 4793 | { |
| 4794 | if(pIesLocal->WPA.present) |
| 4795 | { |
| 4796 | //Calculate the actual length |
| 4797 | nIeLen = 12 //OUI + version + multicast_cipher + unicast_cipher_count |
| 4798 | + pIesLocal->WPA.unicast_cipher_count * 4 //unicast_ciphers |
| 4799 | + 2 //auth_suite_count |
| 4800 | + pIesLocal->WPA.auth_suite_count * 4; //auth_suites |
| 4801 | // The WPA capabilities follows the Auth Suite (two octects)-- |
| 4802 | // this field is optional, and we always "send" zero, so just |
| 4803 | // remove it. This is consistent with our assumptions in the |
| 4804 | // frames compiler; c.f. bug 15234: |
| 4805 | //nIeLen doesn't count EID and length fields |
| 4806 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2)))) |
| 4807 | { |
| 4808 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_WPA; |
| 4809 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4810 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 4811 | //Copy WPA OUI |
| 4812 | palCopyMemory(pMac->hHdd, pIeBuf, &csrWpaOui[1], 4); |
| 4813 | pIeBuf += 4; |
| 4814 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.version, 8 + |
| 4815 | pIesLocal->WPA.unicast_cipher_count * 4); |
| 4816 | pIeBuf += 8 + pIesLocal->WPA.unicast_cipher_count * 4; |
| 4817 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.auth_suite_count, 2 + |
| 4818 | pIesLocal->WPA.auth_suite_count * 4); |
| 4819 | pIeBuf += pIesLocal->WPA.auth_suite_count * 4; |
| 4820 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4821 | } |
| 4822 | } |
| 4823 | } |
| 4824 | #ifdef FEATURE_WLAN_WAPI |
| 4825 | else if((eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4826 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType)) |
| 4827 | { |
| 4828 | if(pIesLocal->WAPI.present) |
| 4829 | { |
| 4830 | //Calculate the actual length |
| 4831 | nIeLen = 4 //version + akm_suite_count |
| 4832 | + pIesLocal->WAPI.akm_suite_count * 4 // akm_suites |
| 4833 | + 2 //pwise_cipher_suite_count |
| 4834 | + pIesLocal->WAPI.unicast_cipher_suite_count * 4 //pwise_cipher_suites |
| 4835 | + 6; //gp_cipher_suite + preauth + reserved |
| 4836 | if( pIesLocal->WAPI.bkid_count ) |
| 4837 | { |
| 4838 | nIeLen += 2 + pIesLocal->WAPI.bkid_count * 4; //bkid |
| 4839 | } |
| 4840 | |
| 4841 | //nIeLen doesn't count EID and length fields |
| 4842 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiRspIE, nIeLen + 2)))) |
| 4843 | { |
| 4844 | pSession->pWapiRspIE[0] = DOT11F_EID_WAPI; |
| 4845 | pSession->pWapiRspIE[1] = (tANI_U8)nIeLen; |
| 4846 | pIeBuf = pSession->pWapiRspIE + 2; |
| 4847 | //copy upto akm_suite_count |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 4848 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.version, 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4849 | pIeBuf += 4; |
| 4850 | if( pIesLocal->WAPI.akm_suite_count ) |
| 4851 | { |
| 4852 | //copy akm_suites |
| 4853 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.akm_suites, |
| 4854 | pIesLocal->WAPI.akm_suite_count * 4); |
| 4855 | pIeBuf += pIesLocal->WAPI.akm_suite_count * 4; |
| 4856 | } |
| 4857 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.unicast_cipher_suite_count, 2); |
| 4858 | pIeBuf += 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4859 | if( pIesLocal->WAPI.unicast_cipher_suite_count ) |
| 4860 | { |
| 4861 | //copy pwise_cipher_suites |
| 4862 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.unicast_cipher_suites, |
| 4863 | pIesLocal->WAPI.unicast_cipher_suite_count * 4); |
| 4864 | pIeBuf += pIesLocal->WAPI.unicast_cipher_suite_count * 4; |
| 4865 | } |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 4866 | //gp_cipher_suite |
| 4867 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.multicast_cipher_suite, 4); |
| 4868 | //preauth + reserved |
| 4869 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.multicast_cipher_suite + 4, 2); |
| 4870 | //bkid_count |
| 4871 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.bkid_count, 2); |
| 4872 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4873 | pIeBuf += 8; |
| 4874 | if( pIesLocal->WAPI.bkid_count ) |
| 4875 | { |
| 4876 | //copy akm_suites |
| 4877 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.bkid, pIesLocal->WAPI.bkid_count * 4); |
| 4878 | pIeBuf += pIesLocal->WAPI.bkid_count * 4; |
| 4879 | } |
| 4880 | pSession->nWapiRspIeLength = nIeLen + 2; |
| 4881 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4882 | } |
| 4883 | } |
| 4884 | #endif /* FEATURE_WLAN_WAPI */ |
| 4885 | if( !pIes ) |
| 4886 | { |
| 4887 | //locally allocated |
| 4888 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 4889 | } |
| 4890 | } |
| 4891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4892 | return (status); |
| 4893 | } |
| 4894 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4895 | static void csrCheckAndUpdateACWeight( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIEs ) |
| 4896 | { |
| 4897 | v_U8_t bACWeights[WLANTL_MAX_AC]; |
| 4898 | v_U8_t paramBk, paramBe, paramVi, paramVo; |
| 4899 | v_BOOL_t fWeightChange = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4900 | //Compare two ACs' EDCA parameters, from low to high (BK, BE, VI, VO) |
| 4901 | //The "formula" is, if lower AC's AIFSN+CWMin is bigger than a fixed amount |
| 4902 | //of the higher AC one, make the higher AC has the same weight as the lower AC. |
| 4903 | //This doesn't address the case where the lower AC needs a real higher weight |
| 4904 | if( pIEs->WMMParams.present ) |
| 4905 | { |
| 4906 | //no change to the lowest ones |
| 4907 | bACWeights[WLANTL_AC_BK] = pMac->roam.ucACWeights[WLANTL_AC_BK]; |
| 4908 | bACWeights[WLANTL_AC_BE] = pMac->roam.ucACWeights[WLANTL_AC_BE]; |
| 4909 | bACWeights[WLANTL_AC_VI] = pMac->roam.ucACWeights[WLANTL_AC_VI]; |
| 4910 | bACWeights[WLANTL_AC_VO] = pMac->roam.ucACWeights[WLANTL_AC_VO]; |
| 4911 | paramBk = pIEs->WMMParams.acbk_aifsn + pIEs->WMMParams.acbk_acwmin; |
| 4912 | paramBe = pIEs->WMMParams.acbe_aifsn + pIEs->WMMParams.acbe_acwmin; |
| 4913 | paramVi = pIEs->WMMParams.acvi_aifsn + pIEs->WMMParams.acvi_acwmin; |
| 4914 | paramVo = pIEs->WMMParams.acvo_aifsn + pIEs->WMMParams.acvo_acwmin; |
| 4915 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramBe) ) |
| 4916 | { |
| 4917 | bACWeights[WLANTL_AC_BE] = bACWeights[WLANTL_AC_BK]; |
| 4918 | fWeightChange = VOS_TRUE; |
| 4919 | } |
| 4920 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVi) ) |
| 4921 | { |
| 4922 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BK]; |
| 4923 | fWeightChange = VOS_TRUE; |
| 4924 | } |
| 4925 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVi) ) |
| 4926 | { |
| 4927 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BE]; |
| 4928 | fWeightChange = VOS_TRUE; |
| 4929 | } |
| 4930 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVo) ) |
| 4931 | { |
| 4932 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BK]; |
| 4933 | fWeightChange = VOS_TRUE; |
| 4934 | } |
| 4935 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVo) ) |
| 4936 | { |
| 4937 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BE]; |
| 4938 | fWeightChange = VOS_TRUE; |
| 4939 | } |
| 4940 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramVi, paramVo) ) |
| 4941 | { |
| 4942 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_VI]; |
| 4943 | fWeightChange = VOS_TRUE; |
| 4944 | } |
| 4945 | if(fWeightChange) |
| 4946 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4947 | 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] | 4948 | bACWeights[2], bACWeights[3]); |
| 4949 | WLANTL_SetACWeights(pMac->roam.gVosContext, bACWeights); |
| 4950 | } |
| 4951 | } |
| 4952 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4953 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4954 | //Returns whether the current association is a 11r assoc or not |
| 4955 | tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac) |
| 4956 | { |
| 4957 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4958 | return csrNeighborRoamIs11rAssoc(pMac); |
| 4959 | #else |
| 4960 | return eANI_BOOLEAN_FALSE; |
| 4961 | #endif |
| 4962 | } |
| 4963 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4964 | #ifdef FEATURE_WLAN_CCX |
| 4965 | //Returns whether the current association is a CCX assoc or not |
| 4966 | tANI_BOOLEAN csrRoamIsCCXAssoc(tpAniSirGlobal pMac) |
| 4967 | { |
| 4968 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4969 | return csrNeighborRoamIsCCXAssoc(pMac); |
| 4970 | #else |
| 4971 | return eANI_BOOLEAN_FALSE; |
| 4972 | #endif |
| 4973 | } |
| 4974 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4975 | #ifdef FEATURE_WLAN_LFR |
| 4976 | //Returns whether "Legacy Fast Roaming" is currently enabled...or not |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4977 | tANI_BOOLEAN csrRoamIsFastRoamEnabled(tpAniSirGlobal pMac, tANI_U32 sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4978 | { |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4979 | tCsrRoamSession *pSession = NULL; |
| 4980 | |
| 4981 | if (CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 4982 | { |
| 4983 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4984 | if (NULL != pSession->pCurRoamProfile) |
| 4985 | { |
| 4986 | if (pSession->pCurRoamProfile->csrPersona != VOS_STA_MODE) |
| 4987 | { |
| 4988 | return eANI_BOOLEAN_FALSE; |
| 4989 | } |
| 4990 | } |
| 4991 | } |
| 4992 | |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 4993 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 4994 | if (eANI_BOOLEAN_TRUE == CSR_IS_FASTROAM_IN_CONCURRENCY_INI_FEATURE_ENABLED(pMac)) |
| 4995 | { |
| 4996 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled); |
| 4997 | } |
| 4998 | else |
| 4999 | #endif |
| 5000 | { |
| 5001 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled && |
Madan Mohan Koyyalamudi | 393a434 | 2012-10-15 16:07:09 -0700 | [diff] [blame] | 5002 | (!csrIsConcurrentSessionRunning(pMac))); |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5003 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5004 | } |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5005 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 5006 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 5007 | //Returns whether "FW based BG scan" is currently enabled...or not |
| 5008 | tANI_BOOLEAN csrRoamIsRoamOffloadScanEnabled(tpAniSirGlobal pMac) |
| 5009 | { |
| 5010 | return (pMac->roam.configParam.isRoamOffloadScanEnabled); |
| 5011 | } |
| 5012 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5013 | #endif |
| 5014 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5015 | //Return true means the command can be release, else not |
| 5016 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 5017 | eCsrRoamCompleteResult Result, void *Context ) |
| 5018 | { |
| 5019 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
| 5020 | tSirBssDescription *pSirBssDesc = NULL; |
| 5021 | tSirMacAddr BroadcastMac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 5022 | tCsrScanResult *pScanResult = NULL; |
| 5023 | tCsrRoamInfo roamInfo; |
| 5024 | sme_QosAssocInfo assocInfo; |
| 5025 | sme_QosCsrEventIndType ind_qos;//indication for QoS module in SME |
| 5026 | tANI_U8 acm_mask = 0; //HDD needs the ACM mask in the assoc rsp callback |
| 5027 | tDot11fBeaconIEs *pIes = NULL; |
| 5028 | tANI_U32 sessionId = pCommand->sessionId; |
| 5029 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 5030 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 5031 | eRoamCmdStatus roamStatus; |
| 5032 | eCsrRoamResult roamResult; |
| 5033 | eHalStatus status; |
| 5034 | tANI_U32 key_timeout_interval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5035 | tSirSmeStartBssRsp *pSmeStartBssRsp = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5036 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5037 | if(!pSession) |
| 5038 | { |
| 5039 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 5040 | return eANI_BOOLEAN_FALSE; |
| 5041 | } |
| 5042 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5043 | smsLog( pMac, LOG1, FL("Processing ROAM results...")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5044 | switch( Result ) |
| 5045 | { |
| 5046 | case eCsrJoinSuccess: |
| 5047 | // reset the IDLE timer |
| 5048 | // !! |
| 5049 | // !! fall through to the next CASE statement here is intentional !! |
| 5050 | // !! |
| 5051 | case eCsrReassocSuccess: |
| 5052 | if(eCsrReassocSuccess == Result) |
| 5053 | { |
| 5054 | ind_qos = SME_QOS_CSR_REASSOC_COMPLETE; |
| 5055 | } |
| 5056 | else |
| 5057 | { |
| 5058 | ind_qos = SME_QOS_CSR_ASSOC_COMPLETE; |
| 5059 | } |
| 5060 | // Success Join Response from LIM. Tell NDIS we are connected and save the |
| 5061 | // Connected state... |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5062 | smsLog(pMac, LOGW, FL("receives association indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5063 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 5064 | //always free the memory here |
| 5065 | if(pSession->pWpaRsnRspIE) |
| 5066 | { |
| 5067 | pSession->nWpaRsnRspIeLength = 0; |
| 5068 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE); |
| 5069 | pSession->pWpaRsnRspIE = NULL; |
| 5070 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5071 | #ifdef FEATURE_WLAN_WAPI |
| 5072 | if(pSession->pWapiRspIE) |
| 5073 | { |
| 5074 | pSession->nWapiRspIeLength = 0; |
| 5075 | palFreeMemory(pMac->hHdd, pSession->pWapiRspIE); |
| 5076 | pSession->pWapiRspIE = NULL; |
| 5077 | } |
| 5078 | #endif /* FEATURE_WLAN_WAPI */ |
| 5079 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5080 | //Reset counter so no join retry is needed. |
| 5081 | pSession->maxRetryCount = 0; |
| 5082 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 5083 | #endif |
| 5084 | /* This creates problem since we have not saved the connected profile. |
| 5085 | So moving this after saving the profile |
| 5086 | */ |
| 5087 | //csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED ); |
| 5088 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 5089 | { |
| 5090 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
| 5091 | } |
| 5092 | else |
| 5093 | { |
| 5094 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED; |
| 5095 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5096 | //Use the last connected bssdesc for reassoc-ing to the same AP. |
| 5097 | //NOTE: What to do when reassoc to a different AP??? |
| 5098 | if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) || |
| 5099 | (eCsrSmeIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ) |
| 5100 | { |
| 5101 | pSirBssDesc = pSession->pConnectBssDesc; |
| 5102 | if(pSirBssDesc) |
| 5103 | { |
| 5104 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 5105 | } |
| 5106 | } |
| 5107 | else |
| 5108 | { |
| 5109 | |
| 5110 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5111 | { |
| 5112 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 5113 | if(pScanResult != NULL) |
| 5114 | { |
| 5115 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5116 | //this can be NULL |
| 5117 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 5118 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 5119 | } |
| 5120 | } |
| 5121 | } |
| 5122 | if( pSirBssDesc ) |
| 5123 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5124 | roamInfo.staId = HAL_STA_INVALID_IDX; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5125 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 5126 | //Save WPA/RSN IE |
| 5127 | csrRoamSaveSecurityRspIE(pMac, sessionId, pProfile->negotiatedAuthType, pSirBssDesc, pIes); |
| 5128 | #ifdef FEATURE_WLAN_CCX |
| 5129 | roamInfo.isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
| 5130 | #endif |
| 5131 | |
| 5132 | // csrRoamStateChange also affects sub-state. Hence, csrRoamStateChange happens first and then |
| 5133 | // substate change. |
| 5134 | // Moving even save profile above so that below mentioned conditon is also met. |
| 5135 | // JEZ100225: Moved to after saving the profile. Fix needed in main/latest |
| 5136 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5137 | // Make sure the Set Context is issued before link indication to NDIS. After link indication is |
| 5138 | // made to NDIS, frames could start flowing. If we have not set context with LIM, the frames |
| 5139 | // will be dropped for the security context may not be set properly. |
| 5140 | // |
| 5141 | // this was causing issues in the 2c_wlan_wep WHQL test when the SetContext was issued after the link |
| 5142 | // indication. (Link Indication happens in the profFSMSetConnectedInfra call). |
| 5143 | // |
| 5144 | // this reordering was done on titan_prod_usb branch and is being replicated here. |
| 5145 | // |
| 5146 | |
| 5147 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && |
| 5148 | !pProfile->bWPSAssociation) |
| 5149 | { |
| 5150 | // Issue the set Context request to LIM to establish the Unicast STA context |
| 5151 | if( !HAL_STATUS_SUCCESS( csrRoamIssueSetContextReq( pMac, sessionId, |
| 5152 | pProfile->negotiatedUCEncryptionType, |
| 5153 | pSirBssDesc, &(pSirBssDesc->bssId), |
| 5154 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ) ) ) // NO keys... these key parameters don't matter. |
| 5155 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5156 | smsLog( pMac, LOGE, FL(" Set context for unicast fail") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5157 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 5158 | } |
| 5159 | // Issue the set Context request to LIM to establish the Broadcast STA context |
| 5160 | csrRoamIssueSetContextReq( pMac, sessionId, pProfile->negotiatedMCEncryptionType, |
| 5161 | pSirBssDesc, &BroadcastMac, |
| 5162 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5163 | } |
| 5164 | else |
| 5165 | { |
| 5166 | //Need to wait for supplicant authtication |
| 5167 | roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5168 | //Set the subestate to WaitForKey in case authentiation is needed |
| 5169 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId ); |
| 5170 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5171 | if(pProfile->bWPSAssociation) |
| 5172 | { |
| 5173 | key_timeout_interval = CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD; |
| 5174 | } |
| 5175 | else |
| 5176 | { |
| 5177 | key_timeout_interval = CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD; |
| 5178 | } |
| 5179 | |
| 5180 | //Save sessionId in case of timeout |
| 5181 | pMac->roam.WaitForKeyTimerInfo.sessionId = (tANI_U8)sessionId; |
| 5182 | //This time should be long enough for the rest of the process plus setting key |
| 5183 | if(!HAL_STATUS_SUCCESS( csrRoamStartWaitForKeyTimer( pMac, key_timeout_interval ) ) ) |
| 5184 | { |
| 5185 | //Reset our state so nothting is blocked. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5186 | smsLog( pMac, LOGE, FL(" Failed to start pre-auth timer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5187 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 5188 | } |
| 5189 | } |
| 5190 | |
| 5191 | assocInfo.pBssDesc = pSirBssDesc; //could be NULL |
| 5192 | assocInfo.pProfile = pProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5193 | if(Context) |
| 5194 | { |
| 5195 | tSirSmeJoinRsp *pJoinRsp = (tSirSmeJoinRsp *)Context; |
| 5196 | tANI_U32 len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5197 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5198 | len = pJoinRsp->assocReqLength + pJoinRsp->assocRspLength + pJoinRsp->beaconLength; |
| 5199 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5200 | len += pJoinRsp->parsedRicRspLen; |
| 5201 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 5202 | #ifdef FEATURE_WLAN_CCX |
| 5203 | len += pJoinRsp->tspecIeLen; |
| 5204 | #endif |
| 5205 | if(len) |
| 5206 | { |
| 5207 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 5208 | (void **)&pSession->connectedInfo.pbFrames, len))) |
| 5209 | { |
| 5210 | if(HAL_STATUS_SUCCESS( palCopyMemory(pMac->hHdd, |
| 5211 | pSession->connectedInfo.pbFrames, pJoinRsp->frames, len) )) |
| 5212 | { |
| 5213 | pSession->connectedInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 5214 | pSession->connectedInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 5215 | pSession->connectedInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 5216 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5217 | pSession->connectedInfo.nRICRspLength = pJoinRsp->parsedRicRspLen; |
| 5218 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 5219 | #ifdef FEATURE_WLAN_CCX |
| 5220 | pSession->connectedInfo.nTspecIeLength = pJoinRsp->tspecIeLen; |
| 5221 | #endif |
| 5222 | roamInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 5223 | roamInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 5224 | roamInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 5225 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5226 | } |
| 5227 | else |
| 5228 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5229 | smsLog(pMac, LOGE, "%s: Copying of memory failed for %d bytes !!!", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5230 | __func__, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5231 | palFreeMemory( pMac->hHdd, pSession->connectedInfo.pbFrames ); |
| 5232 | pSession->connectedInfo.pbFrames = NULL; |
| 5233 | } |
| 5234 | } |
| 5235 | } |
| 5236 | if(pCommand->u.roamCmd.fReassoc) |
| 5237 | { |
| 5238 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 5239 | } |
| 5240 | pSession->connectedInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 5241 | roamInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 5242 | roamInfo.ucastSig = ( tANI_U8 )pJoinRsp->ucastSig; |
| 5243 | roamInfo.bcastSig = ( tANI_U8 )pJoinRsp->bcastSig; |
| 5244 | } |
| 5245 | else |
| 5246 | { |
| 5247 | if(pCommand->u.roamCmd.fReassoc) |
| 5248 | { |
| 5249 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 5250 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5251 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5252 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5253 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5254 | } |
| 5255 | } |
| 5256 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5257 | // Indicate SME-QOS with reassoc success event, only after |
| 5258 | // copying the frames |
| 5259 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, ind_qos, &assocInfo); |
| 5260 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5261 | roamInfo.pBssDesc = pSirBssDesc; |
| 5262 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5263 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5264 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5265 | acm_mask = sme_QosGetACMMask(pMac, pSirBssDesc, NULL); |
| 5266 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 5267 | pSession->connectedProfile.acm_mask = acm_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5268 | //start UAPSD if uapsd_mask is not 0 because HDD will configure for trigger frame |
| 5269 | //It may be better to let QoS do this???? |
| 5270 | if( pSession->connectedProfile.modifyProfileFields.uapsd_mask ) |
| 5271 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5272 | smsLog(pMac, LOGE, " uapsd_mask (0x%X) set, request UAPSD now", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5273 | pSession->connectedProfile.modifyProfileFields.uapsd_mask); |
| 5274 | pmcStartUapsd( pMac, NULL, NULL ); |
| 5275 | } |
Gopichand Nakkala | dacbcb5 | 2013-04-18 16:41:54 +0530 | [diff] [blame] | 5276 | pSession->connectedProfile.dot11Mode = pSession->bssParams.uCfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5277 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5278 | if( pSession->bRefAssocStartCnt > 0 ) |
| 5279 | { |
| 5280 | pSession->bRefAssocStartCnt--; |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5281 | //Remove this code once SLM_Sessionization is supported |
| 5282 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5283 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5284 | { |
| 5285 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5286 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5287 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5288 | } |
| 5289 | |
| 5290 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_NONE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5291 | // reset the PMKID candidate list |
| 5292 | csrResetPMKIDCandidateList( pMac, sessionId ); |
| 5293 | //Update TL's AC weight base on the current EDCA parameters |
| 5294 | //These parameters may change in the course of the connection, that sictuation |
| 5295 | //is not taken care here. This change is mainly to address a WIFI WMM test where |
| 5296 | //BE has a equal or higher TX priority than VI. |
| 5297 | //We only do this for infra link |
| 5298 | if( csrIsConnStateConnectedInfra(pMac, sessionId ) && pIes ) |
| 5299 | { |
| 5300 | csrCheckAndUpdateACWeight(pMac, pIes); |
| 5301 | } |
| 5302 | #ifdef FEATURE_WLAN_WAPI |
| 5303 | // reset the BKID candidate list |
| 5304 | csrResetBKIDCandidateList( pMac, sessionId ); |
| 5305 | #endif /* FEATURE_WLAN_WAPI */ |
| 5306 | } |
| 5307 | else |
| 5308 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5309 | smsLog(pMac, LOGW, " Roam command doesn't have a BSS desc"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5310 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5311 | csrScanCancelIdleScan(pMac); |
| 5312 | //Not to signal link up because keys are yet to be set. |
| 5313 | //The linkup function will overwrite the sub-state that we need to keep at this point. |
| 5314 | if( !CSR_IS_WAIT_FOR_KEY(pMac, sessionId) ) |
| 5315 | { |
| 5316 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 5317 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5318 | //Check if BMPS is required and start the BMPS retry timer. Timer period is large |
| 5319 | //enough to let security and DHCP handshake succeed before entry into BMPS |
| 5320 | if (pmcShouldBmpsTimerRun(pMac)) |
| 5321 | { |
| 5322 | if (pmcStartTrafficTimer(pMac, BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP) |
| 5323 | != eHAL_STATUS_SUCCESS) |
| 5324 | { |
| 5325 | smsLog(pMac, LOGP, FL("Cannot start BMPS Retry timer")); |
| 5326 | } |
| 5327 | smsLog(pMac, LOG2, FL("BMPS Retry Timer already running or started")); |
| 5328 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5329 | break; |
| 5330 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5331 | case eCsrStartBssSuccess: |
| 5332 | // on the StartBss Response, LIM is returning the Bss Description that we |
| 5333 | // are beaconing. Add this Bss Description to our scan results and |
| 5334 | // chain the Profile to this Bss Description. On a Start BSS, there was no |
| 5335 | // detected Bss description (no partner) so we issued the Start Bss to |
| 5336 | // start the Ibss without any Bss description. Lim was kind enough to return |
| 5337 | // 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] | 5338 | smsLog(pMac, LOG2, FL("receives start BSS ok indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5339 | status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5340 | pSmeStartBssRsp = (tSirSmeStartBssRsp *)Context; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5341 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5342 | if( CSR_IS_IBSS( pProfile ) ) |
| 5343 | { |
| 5344 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 5345 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5346 | else if (CSR_IS_INFRA_AP(pProfile)) |
| 5347 | { |
| 5348 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 5349 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5350 | else |
| 5351 | { |
| 5352 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 5353 | } |
| 5354 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 5355 | { |
| 5356 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5357 | pSirBssDesc = &pSmeStartBssRsp->bssDescription; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5358 | if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs( pMac, pSirBssDesc, &pIes )) ) |
| 5359 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5360 | smsLog(pMac, LOG2, FL("cannot parse IBSS IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5361 | roamInfo.pBssDesc = pSirBssDesc; |
| 5362 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5363 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5364 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_START_FAILED ); |
| 5365 | break; |
| 5366 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5367 | if (!CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5368 | { |
Tushnim Bhattacharyya | 5128d75 | 2013-06-26 23:23:18 -0700 | [diff] [blame] | 5369 | pScanResult = csrScanAppendBssDescription( pMac, pSirBssDesc, pIes, FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5370 | } |
| 5371 | csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
| 5372 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5373 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5374 | if(pSirBssDesc) |
| 5375 | { |
| 5376 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 5377 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 5378 | } |
| 5379 | //We are doen with the IEs so free it |
| 5380 | palFreeMemory(pMac->hHdd, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5381 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5382 | { |
| 5383 | vos_log_ibss_pkt_type *pIbssLog; |
| 5384 | tANI_U32 bi; |
| 5385 | |
| 5386 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5387 | if(pIbssLog) |
| 5388 | { |
| 5389 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 5390 | { |
| 5391 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5392 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_RSP; |
| 5393 | } |
| 5394 | else |
| 5395 | { |
| 5396 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_RSP; |
| 5397 | } |
| 5398 | if(pSirBssDesc) |
| 5399 | { |
| 5400 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pSirBssDesc->bssId, 6); |
| 5401 | pIbssLog->operatingChannel = pSirBssDesc->channelId; |
| 5402 | } |
| 5403 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 5404 | { |
| 5405 | //***U8 is not enough for beacon interval |
| 5406 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 5407 | } |
| 5408 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5409 | } |
| 5410 | } |
| 5411 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5412 | //Only set context for non-WDS_STA. We don't even need it for WDS_AP. But since the encryption |
| 5413 | //is WPA2-PSK so it won't matter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5414 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && !CSR_IS_INFRA_AP( pSession->pCurRoamProfile )) |
| 5415 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5416 | // Issue the set Context request to LIM to establish the Broadcast STA context for the Ibss. |
| 5417 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 5418 | pProfile->negotiatedMCEncryptionType, |
| 5419 | pSirBssDesc, &BroadcastMac, |
| 5420 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5421 | } |
| 5422 | } |
| 5423 | else |
| 5424 | { |
| 5425 | //Keep the state to eCSR_ROAMING_STATE_JOINING |
| 5426 | //Need to send join_req. |
| 5427 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5428 | { |
| 5429 | if((pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link))) |
| 5430 | { |
| 5431 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5432 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 5433 | // Set the roaming substate to 'join attempt'... |
| 5434 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 5435 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5436 | } |
| 5437 | } |
| 5438 | else |
| 5439 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5440 | smsLog( pMac, LOGE, " StartBSS for WDS station with no BssDesc" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5441 | VOS_ASSERT( 0 ); |
| 5442 | } |
| 5443 | } |
| 5444 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5445 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5446 | //trigger the connection start indication in Vista |
| 5447 | if( !CSR_IS_JOIN_TO_IBSS( pProfile ) ) |
| 5448 | { |
| 5449 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5450 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5451 | if( CSR_IS_WDS( pProfile ) ) |
| 5452 | { |
| 5453 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5454 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5455 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5456 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5457 | { |
| 5458 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5459 | roamResult = eCSR_ROAM_RESULT_INFRA_STARTED; |
| 5460 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5461 | |
| 5462 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5463 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5464 | //trigger the connection start indication in Vista |
| 5465 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5466 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5467 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5468 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 5469 | { |
| 5470 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5471 | roamInfo.pBssDesc = pSirBssDesc; |
| 5472 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5473 | roamInfo.staId = (tANI_U8)pSmeStartBssRsp->staId; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 5474 | vos_mem_copy (roamInfo.bssid, pSirBssDesc->bssId, sizeof(tCsrBssid)); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5475 | //Remove this code once SLM_Sessionization is supported |
| 5476 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5477 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5478 | ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5479 | { |
| 5480 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5481 | } |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5482 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5483 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5484 | } |
| 5485 | |
| 5486 | csrScanCancelIdleScan(pMac); |
| 5487 | //Only use this timer for ibss. BAP has its own timer for WDS |
| 5488 | if( CSR_IS_IBSS( pProfile) && CSR_INVALID_SCANRESULT_HANDLE != pCommand->u.roamCmd.hBSSList) |
| 5489 | { |
| 5490 | //start the join IBSS timer |
| 5491 | csrRoamStartIbssJoinTimer(pMac, sessionId, CSR_IBSS_JOIN_TIMEOUT_PERIOD); //interval |
| 5492 | pSession->ibss_join_pending = TRUE; |
| 5493 | } |
| 5494 | if( HAL_STATUS_SUCCESS( status ) ) |
| 5495 | { |
| 5496 | //Already sent join_req for the WDS station |
| 5497 | fReleaseCommand = eANI_BOOLEAN_FALSE; |
| 5498 | } |
| 5499 | else if( CSR_IS_WDS_STA( pProfile ) ) |
| 5500 | { |
| 5501 | //need to send stop BSS because we fail to send join_req |
| 5502 | csrRoamIssueDisassociateCmd( pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 5503 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5504 | eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_STOPPED ); |
| 5505 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5506 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5507 | case eCsrStartBssFailure: |
| 5508 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5509 | { |
| 5510 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5511 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5512 | if(pIbssLog) |
| 5513 | { |
| 5514 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 5515 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5516 | } |
| 5517 | } |
| 5518 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5519 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5520 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5521 | if( CSR_IS_WDS( pProfile ) ) |
| 5522 | { |
| 5523 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5524 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5526 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5527 | { |
| 5528 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5529 | roamResult = eCSR_ROAM_RESULT_INFRA_START_FAILED; |
| 5530 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5531 | if(Context) |
| 5532 | { |
| 5533 | pSirBssDesc = (tSirBssDescription *)Context; |
| 5534 | } |
| 5535 | else |
| 5536 | { |
| 5537 | pSirBssDesc = NULL; |
| 5538 | } |
| 5539 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5540 | roamInfo.pBssDesc = pSirBssDesc; |
| 5541 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5542 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5543 | csrSetDefaultDot11Mode( pMac ); |
| 5544 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5545 | case eCsrSilentlyStopRoaming: |
| 5546 | // We are here because we try to start the same IBSS |
| 5547 | //No message to PE |
| 5548 | // return the roaming state to Joined. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5549 | smsLog(pMac, LOGW, FL("receives silently roaming indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5550 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
| 5551 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 5552 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5553 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5554 | if( roamInfo.pBssDesc ) |
| 5555 | { |
| 5556 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid)); |
| 5557 | } |
| 5558 | //Since there is no change in the current state, simply pass back no result otherwise |
| 5559 | //HDD may be mistakenly mark to disconnected state. |
| 5560 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5561 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5562 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5563 | case eCsrSilentlyStopRoamingSaveState: |
| 5564 | //We are here because we try to connect to the same AP |
| 5565 | //No message to PE |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5566 | smsLog(pMac, LOGW, FL("receives silently stop roaming indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5567 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 5568 | |
| 5569 | //to aviod resetting the substate to NONE |
| 5570 | pMac->roam.curState[sessionId] = eCSR_ROAMING_STATE_JOINED; |
| 5571 | //No need to change substate to wai_for_key because there is no state change |
| 5572 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5573 | if( roamInfo.pBssDesc ) |
| 5574 | { |
| 5575 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid)); |
| 5576 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5577 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5578 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5579 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5580 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5581 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5582 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5583 | roamInfo.staId = pSession->connectedInfo.staId; |
| 5584 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5585 | VOS_ASSERT( roamInfo.staId != 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5586 | pSession->bRefAssocStartCnt--; |
| 5587 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5588 | eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5589 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_ASSOCIATED, eANI_BOOLEAN_TRUE); |
| 5590 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5591 | case eCsrReassocFailure: |
| 5592 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5593 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_REASSOC_FAILURE, NULL); |
| 5594 | #endif |
| 5595 | case eCsrJoinWdsFailure: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5596 | smsLog(pMac, LOGW, FL("failed to join WDS")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5597 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5598 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5599 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5600 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5601 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5602 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5603 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5604 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5605 | eCSR_ROAM_WDS_IND, |
| 5606 | eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED); |
| 5607 | //Need to issue stop_bss |
| 5608 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5609 | case eCsrJoinFailure: |
| 5610 | case eCsrNothingToJoin: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5611 | case eCsrJoinFailureDueToConcurrency: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5612 | default: |
| 5613 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5614 | smsLog(pMac, LOGW, FL("receives no association indication")); |
| 5615 | smsLog(pMac, LOG1, FL("Assoc ref count %d"), |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 5616 | pSession->bRefAssocStartCnt); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5617 | if( CSR_IS_INFRASTRUCTURE( &pSession->connectedProfile ) || |
| 5618 | CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, sessionId ) ) |
| 5619 | { |
| 5620 | //do not free for the other profiles as we need to send down stop BSS later |
| 5621 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5622 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5623 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5624 | csrSetDefaultDot11Mode( pMac ); |
| 5625 | } |
| 5626 | |
| 5627 | switch( pCommand->u.roamCmd.roamReason ) |
| 5628 | { |
| 5629 | // If this transition is because of an 802.11 OID, then we transition |
| 5630 | // back to INIT state so we sit waiting for more OIDs to be issued and |
| 5631 | // we don't start the IDLE timer. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5632 | case eCsrSmeIssuedFTReassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5633 | case eCsrSmeIssuedAssocToSimilarAP: |
| 5634 | case eCsrHddIssued: |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 5635 | case eCsrSmeIssuedDisassocForHandoff: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5636 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5637 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5638 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5639 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5640 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 5641 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSession->joinFailStatusCode.bssId, sizeof(tCsrBssid)); |
| 5642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5643 | /* Defeaturize this later if needed */ |
| 5644 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5645 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 5646 | if (csrRoamIsHandoffInProgress(pMac)) |
| 5647 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5648 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 5649 | csrNeighborRoamIndicateConnect(pMac, (tANI_U8)sessionId, VOS_STATUS_E_FAILURE); |
| 5650 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5651 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5652 | if(pSession->bRefAssocStartCnt > 0) |
| 5653 | { |
| 5654 | pSession->bRefAssocStartCnt--; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5655 | if(eCsrJoinFailureDueToConcurrency == Result) |
| 5656 | { |
| 5657 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5658 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5659 | eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL); |
| 5660 | } |
| 5661 | else |
| 5662 | { |
| 5663 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5664 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5665 | eCSR_ROAM_RESULT_FAILURE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5666 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5667 | } |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5668 | else |
| 5669 | { |
| 5670 | /* bRefAssocStartCnt is not incremented when |
| 5671 | * eRoamState == eCsrStopRoamingDueToConcurrency |
| 5672 | * in csrRoamJoinNextBss API. so handle this in |
| 5673 | * else case by sending assoc failure |
| 5674 | */ |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 5675 | csrRoamCallCallback(pMac, sessionId, &roamInfo, |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5676 | pCommand->u.scanCmd.roamId, |
| 5677 | eCSR_ROAM_ASSOCIATION_FAILURE, |
| 5678 | eCSR_ROAM_RESULT_FAILURE); |
| 5679 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5680 | smsLog(pMac, LOG1, FL(" roam(reason %d) failed"), pCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5681 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5682 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5683 | #endif |
| 5684 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5685 | csrScanStartIdleScan(pMac); |
| 5686 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5687 | //For WDS STA. To fix the issue where the WDS AP side may be too busy by |
| 5688 | //BT activity and not able to recevie WLAN traffic. Retry the join |
| 5689 | if( CSR_IS_WDS_STA(pProfile) ) |
| 5690 | { |
| 5691 | csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD); |
| 5692 | } |
| 5693 | #endif |
| 5694 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5695 | case eCsrHddIssuedReassocToSameAP: |
| 5696 | case eCsrSmeIssuedReassocToSameAP: |
| 5697 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5698 | |
| 5699 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5700 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5701 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5702 | #endif |
| 5703 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5704 | csrScanStartIdleScan(pMac); |
| 5705 | break; |
| 5706 | case eCsrForcedDisassoc: |
| 5707 | case eCsrForcedDeauth: |
| 5708 | case eCsrSmeIssuedIbssJoinFailure: |
| 5709 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5710 | |
| 5711 | if(eCsrSmeIssuedIbssJoinFailure == pCommand->u.roamCmd.roamReason) |
| 5712 | { |
| 5713 | // Notify HDD that IBSS join failed |
| 5714 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 5715 | } |
| 5716 | else |
| 5717 | { |
| 5718 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5719 | pCommand->u.roamCmd.roamId, |
| 5720 | eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5721 | } |
| 5722 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5723 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5724 | #endif |
| 5725 | csrRoamLinkDown(pMac, sessionId); |
| 5726 | csrScanStartIdleScan(pMac); |
| 5727 | break; |
| 5728 | case eCsrForcedIbssLeave: |
| 5729 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5730 | pCommand->u.roamCmd.roamId, |
| 5731 | eCSR_ROAM_IBSS_LEAVE, |
| 5732 | eCSR_ROAM_RESULT_IBSS_STOP); |
| 5733 | break; |
| 5734 | case eCsrForcedDisassocMICFailure: |
| 5735 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5736 | |
| 5737 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_MIC_FAILURE); |
| 5738 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5739 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 5740 | #endif |
| 5741 | csrScanStartIdleScan(pMac); |
| 5742 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5743 | case eCsrStopBss: |
| 5744 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5745 | pCommand->u.roamCmd.roamId, |
| 5746 | eCSR_ROAM_INFRA_IND, |
| 5747 | eCSR_ROAM_RESULT_INFRA_STOPPED); |
| 5748 | break; |
| 5749 | case eCsrForcedDisassocSta: |
| 5750 | case eCsrForcedDeauthSta: |
| 5751 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId); |
| 5752 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 5753 | { |
| 5754 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5755 | if (!pSession) |
| 5756 | break; |
| 5757 | |
| 5758 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 5759 | { |
| 5760 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5761 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, |
| 5762 | pCommand->u.roamCmd.peerMac, sizeof(tSirMacAddr)); |
| 5763 | roamInfo.reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 5764 | roamInfo.statusCode = eSIR_SME_SUCCESS; |
| 5765 | status = csrRoamCallCallback(pMac, sessionId, |
| 5766 | &roamInfo, pCommand->u.roamCmd.roamId, |
| 5767 | eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 5768 | } |
| 5769 | } |
| 5770 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5771 | case eCsrLostLink1: |
| 5772 | // if lost link roam1 failed, then issue lost link Scan2 ... |
| 5773 | csrScanRequestLostLink2(pMac, sessionId); |
| 5774 | break; |
| 5775 | case eCsrLostLink2: |
| 5776 | // if lost link roam2 failed, then issue lost link scan3 ... |
| 5777 | csrScanRequestLostLink3(pMac, sessionId); |
| 5778 | break; |
| 5779 | case eCsrLostLink3: |
| 5780 | default: |
| 5781 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5782 | |
| 5783 | //We are done with one round of lostlink roaming here |
| 5784 | csrScanHandleFailedLostlink3(pMac, sessionId); |
| 5785 | break; |
| 5786 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5787 | break; |
| 5788 | } |
| 5789 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5790 | return ( fReleaseCommand ); |
| 5791 | } |
| 5792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5793 | eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext) |
| 5794 | { |
| 5795 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5796 | return (status); |
| 5797 | } |
| 5798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5799 | eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile) |
| 5800 | { |
| 5801 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5802 | tANI_U32 size = 0; |
| 5803 | |
| 5804 | do |
| 5805 | { |
| 5806 | palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile)); |
| 5807 | if(pSrcProfile->BSSIDs.numOfBSSIDs) |
| 5808 | { |
| 5809 | size = sizeof(tCsrBssid) * pSrcProfile->BSSIDs.numOfBSSIDs; |
| 5810 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, size); |
| 5811 | if(!HAL_STATUS_SUCCESS(status)) |
| 5812 | { |
| 5813 | break; |
| 5814 | } |
| 5815 | pDstProfile->BSSIDs.numOfBSSIDs = pSrcProfile->BSSIDs.numOfBSSIDs; |
| 5816 | palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->BSSIDs.bssid, size); |
| 5817 | } |
| 5818 | if(pSrcProfile->SSIDs.numOfSSIDs) |
| 5819 | { |
| 5820 | size = sizeof(tCsrSSIDInfo) * pSrcProfile->SSIDs.numOfSSIDs; |
| 5821 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, size); |
| 5822 | if(!HAL_STATUS_SUCCESS(status)) |
| 5823 | { |
| 5824 | break; |
| 5825 | } |
| 5826 | pDstProfile->SSIDs.numOfSSIDs = pSrcProfile->SSIDs.numOfSSIDs; |
| 5827 | palCopyMemory(pMac->hHdd, pDstProfile->SSIDs.SSIDList, pSrcProfile->SSIDs.SSIDList, size); |
| 5828 | } |
| 5829 | if(pSrcProfile->nWPAReqIELength) |
| 5830 | { |
| 5831 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength); |
| 5832 | if(!HAL_STATUS_SUCCESS(status)) |
| 5833 | { |
| 5834 | break; |
| 5835 | } |
| 5836 | pDstProfile->nWPAReqIELength = pSrcProfile->nWPAReqIELength; |
| 5837 | palCopyMemory(pMac->hHdd, pDstProfile->pWPAReqIE, pSrcProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength); |
| 5838 | } |
| 5839 | if(pSrcProfile->nRSNReqIELength) |
| 5840 | { |
| 5841 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength); |
| 5842 | if(!HAL_STATUS_SUCCESS(status)) |
| 5843 | { |
| 5844 | break; |
| 5845 | } |
| 5846 | pDstProfile->nRSNReqIELength = pSrcProfile->nRSNReqIELength; |
| 5847 | palCopyMemory(pMac->hHdd, pDstProfile->pRSNReqIE, pSrcProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength); |
| 5848 | } |
| 5849 | #ifdef FEATURE_WLAN_WAPI |
| 5850 | if(pSrcProfile->nWAPIReqIELength) |
| 5851 | { |
| 5852 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength); |
| 5853 | if(!HAL_STATUS_SUCCESS(status)) |
| 5854 | { |
| 5855 | break; |
| 5856 | } |
| 5857 | pDstProfile->nWAPIReqIELength = pSrcProfile->nWAPIReqIELength; |
| 5858 | palCopyMemory(pMac->hHdd, pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength); |
| 5859 | } |
| 5860 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5861 | if(pSrcProfile->nAddIEScanLength) |
| 5862 | { |
| 5863 | status = palAllocateMemory(pMac->hHdd, |
| 5864 | (void **)&pDstProfile->pAddIEScan, pSrcProfile->nAddIEScanLength); |
| 5865 | if(!HAL_STATUS_SUCCESS(status)) |
| 5866 | { |
| 5867 | break; |
| 5868 | } |
| 5869 | pDstProfile->nAddIEScanLength = pSrcProfile->nAddIEScanLength; |
| 5870 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEScan, pSrcProfile->pAddIEScan, |
| 5871 | pSrcProfile->nAddIEScanLength); |
| 5872 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5873 | if(pSrcProfile->nAddIEAssocLength) |
| 5874 | { |
| 5875 | status = palAllocateMemory(pMac->hHdd, |
| 5876 | (void **)&pDstProfile->pAddIEAssoc, pSrcProfile->nAddIEAssocLength); |
| 5877 | if(!HAL_STATUS_SUCCESS(status)) |
| 5878 | { |
| 5879 | break; |
| 5880 | } |
| 5881 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
| 5882 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 5883 | pSrcProfile->nAddIEAssocLength); |
| 5884 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5885 | if(pSrcProfile->ChannelInfo.ChannelList) |
| 5886 | { |
| 5887 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); |
| 5888 | if(!HAL_STATUS_SUCCESS(status)) |
| 5889 | { |
| 5890 | break; |
| 5891 | } |
| 5892 | pDstProfile->ChannelInfo.numOfChannels = pSrcProfile->ChannelInfo.numOfChannels; |
| 5893 | palCopyMemory(pMac->hHdd, pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); |
| 5894 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5895 | pDstProfile->AuthType = pSrcProfile->AuthType; |
| 5896 | pDstProfile->EncryptionType = pSrcProfile->EncryptionType; |
| 5897 | pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType; |
| 5898 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->negotiatedUCEncryptionType; |
| 5899 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->negotiatedMCEncryptionType; |
| 5900 | pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5901 | #ifdef WLAN_FEATURE_11W |
| 5902 | pDstProfile->MFPEnabled = pSrcProfile->MFPEnabled; |
| 5903 | pDstProfile->MFPRequired = pSrcProfile->MFPRequired; |
| 5904 | pDstProfile->MFPCapable = pSrcProfile->MFPCapable; |
| 5905 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5906 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 5907 | pDstProfile->phyMode = pSrcProfile->phyMode; |
| 5908 | pDstProfile->csrPersona = pSrcProfile->csrPersona; |
| 5909 | |
| 5910 | #ifdef FEATURE_WLAN_WAPI |
| 5911 | if(csrIsProfileWapi(pSrcProfile)) |
| 5912 | { |
| 5913 | if(pDstProfile->phyMode & eCSR_DOT11_MODE_11n) |
| 5914 | { |
| 5915 | pDstProfile->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 5916 | } |
| 5917 | } |
| 5918 | #endif /* FEATURE_WLAN_WAPI */ |
| 5919 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 5920 | /*Save the WPS info*/ |
| 5921 | pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation; |
| 5922 | pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5923 | pDstProfile->beaconInterval = pSrcProfile->beaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5924 | pDstProfile->privacy = pSrcProfile->privacy; |
| 5925 | pDstProfile->fwdWPSPBCProbeReq = pSrcProfile->fwdWPSPBCProbeReq; |
| 5926 | pDstProfile->csr80211AuthType = pSrcProfile->csr80211AuthType; |
| 5927 | pDstProfile->dtimPeriod = pSrcProfile->dtimPeriod; |
| 5928 | pDstProfile->ApUapsdEnable = pSrcProfile->ApUapsdEnable; |
| 5929 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->SSIDs.SSIDList[0].ssidHidden; |
| 5930 | pDstProfile->protEnabled = pSrcProfile->protEnabled; |
| 5931 | pDstProfile->obssProtEnabled = pSrcProfile->obssProtEnabled; |
| 5932 | pDstProfile->cfg_protection = pSrcProfile->cfg_protection; |
| 5933 | pDstProfile->wps_state = pSrcProfile->wps_state; |
| 5934 | pDstProfile->ieee80211d = pSrcProfile->ieee80211d; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5935 | palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5936 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5937 | if (pSrcProfile->MDID.mdiePresent) |
| 5938 | { |
| 5939 | pDstProfile->MDID.mdiePresent = 1; |
| 5940 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 5941 | } |
| 5942 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5943 | }while(0); |
| 5944 | |
| 5945 | if(!HAL_STATUS_SUCCESS(status)) |
| 5946 | { |
| 5947 | csrReleaseProfile(pMac, pDstProfile); |
| 5948 | pDstProfile = NULL; |
| 5949 | } |
| 5950 | |
| 5951 | return (status); |
| 5952 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5953 | eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile ) |
| 5954 | { |
| 5955 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5956 | tCsrRoamConnectedProfile *pSrcProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 5957 | do |
| 5958 | { |
| 5959 | palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile)); |
| 5960 | if(pSrcProfile->bssid) |
| 5961 | { |
| 5962 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 5963 | if(!HAL_STATUS_SUCCESS(status)) |
| 5964 | { |
| 5965 | break; |
| 5966 | } |
| 5967 | pDstProfile->BSSIDs.numOfBSSIDs = 1; |
| 5968 | palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->bssid, sizeof(tCsrBssid)); |
| 5969 | } |
| 5970 | if(pSrcProfile->SSID.ssId) |
| 5971 | { |
| 5972 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, sizeof(tCsrSSIDInfo)); |
| 5973 | if(!HAL_STATUS_SUCCESS(status)) |
| 5974 | { |
| 5975 | break; |
| 5976 | } |
| 5977 | pDstProfile->SSIDs.numOfSSIDs = 1; |
| 5978 | pDstProfile->SSIDs.SSIDList[0].handoffPermitted = pSrcProfile->handoffPermitted; |
| 5979 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->ssidHidden; |
| 5980 | palCopyMemory(pMac->hHdd, &pDstProfile->SSIDs.SSIDList[0].SSID, &pSrcProfile->SSID, sizeof(tSirMacSSid)); |
| 5981 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 5982 | if(pSrcProfile->nAddIEAssocLength) |
| 5983 | { |
| 5984 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pAddIEAssoc, pSrcProfile->nAddIEAssocLength); |
| 5985 | if(!HAL_STATUS_SUCCESS(status)) |
| 5986 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5987 | smsLog( pMac, LOGE, FL(" failed to allocate memory for additional IEs ") ); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 5988 | break; |
| 5989 | } |
| 5990 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
| 5991 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 5992 | pSrcProfile->nAddIEAssocLength); |
| 5993 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5994 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, 1); |
| 5995 | if(!HAL_STATUS_SUCCESS(status)) |
| 5996 | { |
| 5997 | break; |
| 5998 | } |
| 5999 | pDstProfile->ChannelInfo.numOfChannels = 1; |
| 6000 | pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6001 | pDstProfile->AuthType.numEntries = 1; |
| 6002 | pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType; |
| 6003 | pDstProfile->negotiatedAuthType = pSrcProfile->AuthType; |
| 6004 | pDstProfile->EncryptionType.numEntries = 1; |
| 6005 | pDstProfile->EncryptionType.encryptionType[0] = pSrcProfile->EncryptionType; |
| 6006 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->EncryptionType; |
| 6007 | pDstProfile->mcEncryptionType.numEntries = 1; |
| 6008 | pDstProfile->mcEncryptionType.encryptionType[0] = pSrcProfile->mcEncryptionType; |
| 6009 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->mcEncryptionType; |
| 6010 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 6011 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 6012 | palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys)); |
| 6013 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6014 | if (pSrcProfile->MDID.mdiePresent) |
| 6015 | { |
| 6016 | pDstProfile->MDID.mdiePresent = 1; |
| 6017 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 6018 | } |
| 6019 | #endif |
| 6020 | |
| 6021 | }while(0); |
| 6022 | |
| 6023 | if(!HAL_STATUS_SUCCESS(status)) |
| 6024 | { |
| 6025 | csrReleaseProfile(pMac, pDstProfile); |
| 6026 | pDstProfile = NULL; |
| 6027 | } |
| 6028 | |
| 6029 | return (status); |
| 6030 | } |
| 6031 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6032 | eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6033 | tScanResultHandle hBSSList, |
| 6034 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate, |
| 6035 | tANI_BOOLEAN fClearScan) |
| 6036 | { |
| 6037 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6038 | tSmeCmd *pCommand; |
| 6039 | |
| 6040 | pCommand = csrGetCommandBuffer(pMac); |
| 6041 | if(NULL == pCommand) |
| 6042 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6043 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6044 | status = eHAL_STATUS_RESOURCES; |
| 6045 | } |
| 6046 | else |
| 6047 | { |
| 6048 | if( fClearScan ) |
| 6049 | { |
| 6050 | csrScanCancelIdleScan(pMac); |
| 6051 | csrScanAbortMacScanNotForConnect(pMac); |
| 6052 | } |
| 6053 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 6054 | if(NULL == pProfile) |
| 6055 | { |
| 6056 | //We can roam now |
| 6057 | //Since pProfile is NULL, we need to build our own profile, set everything to default |
| 6058 | //We can only support open and no encryption |
| 6059 | pCommand->u.roamCmd.roamProfile.AuthType.numEntries = 1; |
| 6060 | pCommand->u.roamCmd.roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6061 | pCommand->u.roamCmd.roamProfile.EncryptionType.numEntries = 1; |
| 6062 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 6063 | pCommand->u.roamCmd.roamProfile.csrPersona = VOS_STA_MODE; |
| 6064 | } |
| 6065 | else |
| 6066 | { |
| 6067 | //make a copy of the profile |
| 6068 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 6069 | if(HAL_STATUS_SUCCESS(status)) |
| 6070 | { |
| 6071 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 6072 | } |
| 6073 | } |
| 6074 | pCommand->command = eSmeCommandRoam; |
| 6075 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6076 | pCommand->u.roamCmd.hBSSList = hBSSList; |
| 6077 | pCommand->u.roamCmd.roamId = roamId; |
| 6078 | pCommand->u.roamCmd.roamReason = reason; |
| 6079 | //We need to free the BssList when the command is done |
| 6080 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_TRUE; |
| 6081 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6082 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 6083 | FL("CSR PERSONA=%d"), |
| 6084 | pCommand->u.roamCmd.roamProfile.csrPersona); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6085 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 6086 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6087 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6088 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6089 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6090 | } |
| 6091 | } |
| 6092 | |
| 6093 | return (status); |
| 6094 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6095 | eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6096 | tCsrRoamModifyProfileFields *pMmodProfileFields, |
| 6097 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 6098 | { |
| 6099 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6100 | tSmeCmd *pCommand; |
| 6101 | |
| 6102 | pCommand = csrGetCommandBuffer(pMac); |
| 6103 | if(NULL == pCommand) |
| 6104 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6105 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6106 | status = eHAL_STATUS_RESOURCES; |
| 6107 | } |
| 6108 | else |
| 6109 | { |
| 6110 | csrScanCancelIdleScan(pMac); |
| 6111 | csrScanAbortMacScanNotForConnect(pMac); |
| 6112 | if(pProfile) |
| 6113 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6114 | //This is likely trying to reassoc to different profile |
| 6115 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 6116 | //make a copy of the profile |
| 6117 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 6118 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6119 | } |
| 6120 | else |
| 6121 | { |
| 6122 | status = csrRoamCopyConnectedProfile(pMac, sessionId, &pCommand->u.roamCmd.roamProfile); |
| 6123 | //how to update WPA/WPA2 info in roamProfile?? |
| 6124 | pCommand->u.roamCmd.roamProfile.uapsd_mask = pMmodProfileFields->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6125 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6126 | if(HAL_STATUS_SUCCESS(status)) |
| 6127 | { |
| 6128 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 6129 | } |
| 6130 | pCommand->command = eSmeCommandRoam; |
| 6131 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6132 | pCommand->u.roamCmd.roamId = roamId; |
| 6133 | pCommand->u.roamCmd.roamReason = reason; |
| 6134 | //We need to free the BssList when the command is done |
| 6135 | //For reassoc there is no BSS list, so the boolean set to false |
| 6136 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 6137 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 6138 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6139 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 6140 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6141 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6142 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6143 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 6144 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6145 | } |
| 6146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6147 | return (status); |
| 6148 | } |
| 6149 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6150 | eHalStatus csrRoamEnqueuePreauth(tpAniSirGlobal pMac, tANI_U32 sessionId, tpSirBssDescription pBssDescription, |
| 6151 | eCsrRoamReason reason, tANI_BOOLEAN fImmediate) |
| 6152 | // , eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 6153 | { |
| 6154 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6155 | tSmeCmd *pCommand; |
| 6156 | |
| 6157 | pCommand = csrGetCommandBuffer(pMac); |
| 6158 | if(NULL == pCommand) |
| 6159 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6160 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6161 | status = eHAL_STATUS_RESOURCES; |
| 6162 | } |
| 6163 | else |
| 6164 | { |
| 6165 | if(pBssDescription) |
| 6166 | { |
| 6167 | //copy over the parameters we need later |
| 6168 | pCommand->command = eSmeCommandRoam; |
| 6169 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6170 | pCommand->u.roamCmd.roamReason = reason; |
| 6171 | //this is the important parameter |
| 6172 | //in this case we are using this field for the "next" BSS |
| 6173 | pCommand->u.roamCmd.pLastRoamBss = pBssDescription; |
| 6174 | status = csrQueueSmeCommand(pMac, pCommand, fImmediate); |
| 6175 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6176 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6177 | 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] | 6178 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 6179 | } |
| 6180 | } |
| 6181 | else |
| 6182 | { |
| 6183 | //Return failure |
| 6184 | status = eHAL_STATUS_RESOURCES; |
| 6185 | } |
| 6186 | } |
| 6187 | return (status); |
| 6188 | } |
| 6189 | |
| 6190 | eHalStatus csrRoamDequeuePreauth(tpAniSirGlobal pMac) |
| 6191 | { |
| 6192 | tListElem *pEntry; |
| 6193 | tSmeCmd *pCommand; |
| 6194 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 6195 | if ( pEntry ) |
| 6196 | { |
| 6197 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 6198 | if ( (eSmeCommandRoam == pCommand->command) && |
| 6199 | (eCsrPerformPreauth == pCommand->u.roamCmd.roamReason)) |
| 6200 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6201 | smsLog( pMac, LOG1, FL("DQ-Command = %d, Reason = %d"), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6202 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 6203 | if (csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK )) { |
| 6204 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 6205 | } |
| 6206 | } else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6207 | smsLog( pMac, LOGE, FL("Command = %d, Reason = %d "), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6208 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 6209 | } |
| 6210 | } |
| 6211 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6212 | 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] | 6213 | } |
| 6214 | smeProcessPendingQueue( pMac ); |
| 6215 | return eHAL_STATUS_SUCCESS; |
| 6216 | } |
| 6217 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6218 | eHalStatus csrRoamConnectWithBSSList(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6219 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 6220 | { |
| 6221 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6222 | tScanResultHandle hBSSList; |
| 6223 | tANI_U32 roamId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6224 | status = csrScanCopyResultList(pMac, hBssListIn, &hBSSList); |
| 6225 | if(HAL_STATUS_SUCCESS(status)) |
| 6226 | { |
| 6227 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6228 | if(pRoamId) |
| 6229 | { |
| 6230 | *pRoamId = roamId; |
| 6231 | } |
| 6232 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6233 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6234 | if(!HAL_STATUS_SUCCESS(status)) |
| 6235 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6236 | smsLog(pMac, LOGE, FL("failed to start a join process")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6237 | csrScanResultPurge(pMac, hBSSList); |
| 6238 | } |
| 6239 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6240 | return (status); |
| 6241 | } |
| 6242 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6243 | eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6244 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 6245 | { |
| 6246 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6247 | tScanResultHandle hBSSList; |
| 6248 | tCsrScanResultFilter *pScanFilter; |
| 6249 | tANI_U32 roamId = 0; |
| 6250 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_FALSE; |
| 6251 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6252 | if (NULL == pProfile) |
| 6253 | { |
| 6254 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6255 | return eHAL_STATUS_FAILURE; |
| 6256 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6257 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6258 | pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6259 | if( CSR_IS_WDS( pProfile ) && |
| 6260 | !HAL_STATUS_SUCCESS( status = csrIsBTAMPAllowed( pMac, pProfile->operationChannel ) ) ) |
| 6261 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6262 | 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] | 6263 | pProfile->operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6264 | return status; |
| 6265 | } |
| 6266 | csrRoamCancelRoaming(pMac, sessionId); |
| 6267 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6268 | csrScanCancelIdleScan(pMac); |
| 6269 | //Only abort the scan if it is not used for other roam/connect purpose |
| 6270 | csrScanAbortMacScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6271 | if (!vos_concurrent_sessions_running() && (VOS_STA_SAP_MODE == pProfile->csrPersona))//In case of AP mode we do not want idle mode scan |
| 6272 | { |
| 6273 | csrScanDisable(pMac); |
| 6274 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6275 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6276 | //Check whether ssid changes |
| 6277 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6278 | { |
| 6279 | if(pProfile->SSIDs.numOfSSIDs && !csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6280 | { |
| 6281 | csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6282 | } |
| 6283 | } |
| 6284 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6285 | pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; |
| 6286 | #endif |
| 6287 | if(CSR_INVALID_SCANRESULT_HANDLE != hBssListIn) |
| 6288 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6289 | smsLog(pMac, LOG1, FL("is called with BSSList")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6290 | status = csrRoamConnectWithBSSList(pMac, sessionId, pProfile, hBssListIn, pRoamId); |
| 6291 | if(pRoamId) |
| 6292 | { |
| 6293 | roamId = *pRoamId; |
| 6294 | } |
| 6295 | if(!HAL_STATUS_SUCCESS(status)) |
| 6296 | { |
| 6297 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6298 | } |
| 6299 | } |
| 6300 | else |
| 6301 | { |
| 6302 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6303 | if(HAL_STATUS_SUCCESS(status)) |
| 6304 | { |
| 6305 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6306 | //Try to connect to any BSS |
| 6307 | if(NULL == pProfile) |
| 6308 | { |
| 6309 | //No encryption |
| 6310 | pScanFilter->EncryptionType.numEntries = 1; |
| 6311 | pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 6312 | }//we don't have a profile |
| 6313 | else |
| 6314 | { |
| 6315 | //Here is the profile we need to connect to |
| 6316 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6317 | }//We have a profile |
| 6318 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6319 | if(pRoamId) |
| 6320 | { |
| 6321 | *pRoamId = roamId; |
| 6322 | } |
| 6323 | |
| 6324 | if(HAL_STATUS_SUCCESS(status)) |
| 6325 | { |
| 6326 | /*Save the WPS info*/ |
| 6327 | if(NULL != pProfile) |
| 6328 | { |
| 6329 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
| 6330 | } |
| 6331 | else |
| 6332 | { |
| 6333 | pScanFilter->bWPSAssociation = 0; |
| 6334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6335 | do |
| 6336 | { |
| 6337 | if( (pProfile && CSR_IS_WDS_AP( pProfile ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6338 | || (pProfile && CSR_IS_INFRA_AP ( pProfile )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6339 | ) |
| 6340 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6341 | //This can be started right away |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6342 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6343 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6344 | if(!HAL_STATUS_SUCCESS(status)) |
| 6345 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6346 | 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] | 6347 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6348 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6349 | else |
| 6350 | { |
| 6351 | smsLog(pMac, LOG1, FL("Connect request to proceed for AMP/SoftAP mode")); |
| 6352 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6353 | break; |
| 6354 | } |
| 6355 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6356 | smsLog(pMac, LOG1, "************ csrScanGetResult Status ********* %d", status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6357 | if(HAL_STATUS_SUCCESS(status)) |
| 6358 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6359 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6360 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6361 | if(!HAL_STATUS_SUCCESS(status)) |
| 6362 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6363 | 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] | 6364 | csrScanResultPurge(pMac, hBSSList); |
| 6365 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6366 | } |
| 6367 | }//Have scan result |
| 6368 | else if(NULL != pProfile) |
| 6369 | { |
| 6370 | //Check whether it is for start ibss |
| 6371 | if(CSR_IS_START_IBSS(pProfile)) |
| 6372 | { |
| 6373 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6374 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6375 | if(!HAL_STATUS_SUCCESS(status)) |
| 6376 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6377 | 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] | 6378 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6379 | } |
| 6380 | } |
| 6381 | else |
| 6382 | { |
| 6383 | //scan for this SSID |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 6384 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6385 | if(!HAL_STATUS_SUCCESS(status)) |
| 6386 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6387 | 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] | 6388 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6389 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6390 | else |
| 6391 | { |
| 6392 | smsLog(pMac, LOG1, FL("SSID scan requested for Infra connect req")); |
| 6393 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6394 | } |
| 6395 | } |
| 6396 | else |
| 6397 | { |
| 6398 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6399 | } |
| 6400 | } while (0); |
| 6401 | if(NULL != pProfile) |
| 6402 | { |
| 6403 | //we need to free memory for filter if profile exists |
| 6404 | csrFreeScanFilter(pMac, pScanFilter); |
| 6405 | } |
| 6406 | }//Got the scan filter from profile |
| 6407 | |
| 6408 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 6409 | }//allocated memory for pScanFilter |
| 6410 | }//No Bsslist coming in |
| 6411 | //tell the caller if we fail to trigger a join request |
| 6412 | if( fCallCallback ) |
| 6413 | { |
| 6414 | csrRoamCallCallback(pMac, sessionId, NULL, roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6415 | } |
| 6416 | |
| 6417 | return (status); |
| 6418 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6419 | eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6420 | tCsrRoamModifyProfileFields modProfileFields, |
| 6421 | tANI_U32 *pRoamId) |
| 6422 | { |
| 6423 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6424 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_TRUE; |
| 6425 | tANI_U32 roamId = 0; |
| 6426 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6427 | if (NULL == pProfile) |
| 6428 | { |
| 6429 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6430 | return eHAL_STATUS_FAILURE; |
| 6431 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6432 | 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] | 6433 | csrRoamCancelRoaming(pMac, sessionId); |
| 6434 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6435 | csrScanCancelIdleScan(pMac); |
| 6436 | csrScanAbortMacScanNotForConnect(pMac); |
| 6437 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssuedReassocToSameAP); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6438 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6439 | { |
| 6440 | if(pProfile) |
| 6441 | { |
| 6442 | if(pProfile->SSIDs.numOfSSIDs && |
| 6443 | csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6444 | { |
| 6445 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6446 | } |
| 6447 | else |
| 6448 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6449 | 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] | 6450 | } |
| 6451 | } |
| 6452 | else if(!palEqualMemory(pMac->hHdd, &modProfileFields, |
| 6453 | &pSession->connectedProfile.modifyProfileFields, |
| 6454 | sizeof(tCsrRoamModifyProfileFields))) |
| 6455 | { |
| 6456 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6457 | } |
| 6458 | else |
| 6459 | { |
| 6460 | 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] | 6461 | "in tCsrRoamModifyProfileFields got modified")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6462 | } |
| 6463 | } |
| 6464 | else |
| 6465 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6466 | smsLog(pMac, LOG1, FL("Not connected! No need to reassoc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6467 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6468 | if(!fCallCallback) |
| 6469 | { |
| 6470 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6471 | if(pRoamId) |
| 6472 | { |
| 6473 | *pRoamId = roamId; |
| 6474 | } |
| 6475 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6476 | status = csrRoamIssueReassoc(pMac, sessionId, pProfile, &modProfileFields, |
| 6477 | eCsrHddIssuedReassocToSameAP, roamId, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6478 | } |
| 6479 | else |
| 6480 | { |
| 6481 | status = csrRoamCallCallback(pMac, sessionId, NULL, roamId, |
| 6482 | eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6483 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6484 | return status; |
| 6485 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6486 | eHalStatus csrRoamJoinLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6487 | { |
| 6488 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6489 | tScanResultHandle hBSSList = NULL; |
| 6490 | tCsrScanResultFilter *pScanFilter = NULL; |
| 6491 | tANI_U32 roamId; |
| 6492 | tCsrRoamProfile *pProfile = NULL; |
| 6493 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6494 | |
| 6495 | if(!pSession) |
| 6496 | { |
| 6497 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6498 | return eHAL_STATUS_FAILURE; |
| 6499 | } |
| 6500 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6501 | do |
| 6502 | { |
| 6503 | if(pSession->pCurRoamProfile) |
| 6504 | { |
| 6505 | csrScanCancelIdleScan(pMac); |
| 6506 | csrScanAbortMacScanNotForConnect(pMac); |
| 6507 | //We have to make a copy of pCurRoamProfile because it will be free inside csrRoamIssueConnect |
| 6508 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile, sizeof(tCsrRoamProfile)); |
| 6509 | if(!HAL_STATUS_SUCCESS(status)) |
| 6510 | break; |
| 6511 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile)); |
| 6512 | status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile); |
| 6513 | if(!HAL_STATUS_SUCCESS(status)) |
| 6514 | break; |
| 6515 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6516 | if(!HAL_STATUS_SUCCESS(status)) |
| 6517 | { |
| 6518 | break; |
| 6519 | } |
| 6520 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6521 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6522 | if(!HAL_STATUS_SUCCESS(status)) |
| 6523 | { |
| 6524 | break; |
| 6525 | } |
| 6526 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6527 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 6528 | if(HAL_STATUS_SUCCESS(status)) |
| 6529 | { |
| 6530 | //we want to put the last connected BSS to the very beginning, if possible |
| 6531 | csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList); |
| 6532 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6533 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6534 | if(!HAL_STATUS_SUCCESS(status)) |
| 6535 | { |
| 6536 | csrScanResultPurge(pMac, hBSSList); |
| 6537 | break; |
| 6538 | } |
| 6539 | } |
| 6540 | else |
| 6541 | { |
| 6542 | //Do a scan on this profile |
| 6543 | //scan for this SSID only in case the AP suppresses SSID |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 6544 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6545 | if(!HAL_STATUS_SUCCESS(status)) |
| 6546 | { |
| 6547 | break; |
| 6548 | } |
| 6549 | } |
| 6550 | }//We have a profile |
| 6551 | else |
| 6552 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6553 | smsLog(pMac, LOGW, FL("cannot find a roaming profile")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6554 | break; |
| 6555 | } |
| 6556 | }while(0); |
| 6557 | if(pScanFilter) |
| 6558 | { |
| 6559 | csrFreeScanFilter(pMac, pScanFilter); |
| 6560 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 6561 | } |
| 6562 | if(NULL != pProfile) |
| 6563 | { |
| 6564 | csrReleaseProfile(pMac, pProfile); |
| 6565 | palFreeMemory(pMac->hHdd, pProfile); |
| 6566 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6567 | return (status); |
| 6568 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6569 | eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6570 | { |
| 6571 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6572 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6573 | { |
| 6574 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6575 | if(HAL_STATUS_SUCCESS(status)) |
| 6576 | { |
| 6577 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6578 | } |
| 6579 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6580 | return (status); |
| 6581 | } |
| 6582 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6583 | eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6584 | { |
| 6585 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6586 | smsLog(pMac, LOGW, FL("is called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6587 | csrRoamCancelRoaming(pMac, sessionId); |
| 6588 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6589 | if(csrIsConnStateDisconnected(pMac, sessionId)) |
| 6590 | { |
| 6591 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6592 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6593 | return (status); |
| 6594 | } |
| 6595 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6596 | eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure ) |
| 6597 | { |
| 6598 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6599 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
| 6600 | eCsrRoamSubState NewSubstate; |
| 6601 | tANI_U32 sessionId = pCommand->sessionId; |
| 6602 | |
| 6603 | // change state to 'Roaming'... |
| 6604 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 6605 | |
| 6606 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 6607 | { |
| 6608 | // If we are in an IBSS, then stop the IBSS... |
| 6609 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6610 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6611 | } |
| 6612 | else if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6613 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6614 | 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] | 6615 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 6616 | //Restore AC weight in case we change it |
| 6617 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 6618 | // in Infrasturcture, we need to disassociate from the Infrastructure network... |
| 6619 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED; |
| 6620 | if(eCsrSmeIssuedDisassocForHandoff == pCommand->u.roamCmd.roamReason) |
| 6621 | { |
| 6622 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF; |
| 6623 | } |
| 6624 | if( fDisassoc ) |
| 6625 | { |
| 6626 | status = csrRoamIssueDisassociate( pMac, sessionId, NewSubstate, fMICFailure ); |
| 6627 | } |
| 6628 | else |
| 6629 | { |
| 6630 | status = csrRoamIssueDeauth( pMac, sessionId, eCSR_ROAM_SUBSTATE_DEAUTH_REQ ); |
| 6631 | } |
| 6632 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6633 | } |
| 6634 | else if ( csrIsConnStateWds( pMac, sessionId ) ) |
| 6635 | { |
| 6636 | if( CSR_IS_WDS_AP( &pMac->roam.roamSession[sessionId].connectedProfile ) ) |
| 6637 | { |
| 6638 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6639 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6640 | } |
| 6641 | //This has to be WDS station |
| 6642 | else if( csrIsConnStateConnectedWds( pMac, sessionId ) ) //This has to be WDS station |
| 6643 | { |
| 6644 | |
| 6645 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 6646 | if( fDisassoc ) |
| 6647 | { |
| 6648 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 6649 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, fMICFailure ); |
| 6650 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6651 | } |
| 6652 | } |
| 6653 | } else { |
| 6654 | // we got a dis-assoc request while not connected to any peer |
| 6655 | // just complete the command |
| 6656 | fComplete = eANI_BOOLEAN_TRUE; |
| 6657 | status = eHAL_STATUS_FAILURE; |
| 6658 | } |
| 6659 | if(fComplete) |
| 6660 | { |
| 6661 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6662 | } |
| 6663 | |
| 6664 | if(HAL_STATUS_SUCCESS(status)) |
| 6665 | { |
| 6666 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6667 | { |
| 6668 | //Set the state to disconnect here |
| 6669 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 6670 | } |
| 6671 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6672 | else |
| 6673 | { |
| 6674 | smsLog(pMac, LOGW, FL(" failed with status %d"), status); |
| 6675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6676 | return (status); |
| 6677 | } |
| 6678 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6679 | /* This is been removed from latest code base */ |
| 6680 | /* |
| 6681 | static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 6682 | { |
| 6683 | eHalStatus status; |
| 6684 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6685 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING ); |
| 6686 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6687 | return ( status ); |
| 6688 | } |
| 6689 | */ |
| 6690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6691 | eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason ) |
| 6692 | { |
| 6693 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6694 | tSmeCmd *pCommand; |
| 6695 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6696 | do |
| 6697 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6698 | smsLog( pMac, LOG1, FL(" reason = %d"), reason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6699 | pCommand = csrGetCommandBuffer( pMac ); |
| 6700 | if ( !pCommand ) |
| 6701 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6702 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6703 | status = eHAL_STATUS_RESOURCES; |
| 6704 | break; |
| 6705 | } |
| 6706 | //Change the substate in case it is wait-for-key |
| 6707 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 6708 | { |
| 6709 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6710 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 6711 | } |
| 6712 | pCommand->command = eSmeCommandRoam; |
| 6713 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6714 | switch ( reason ) |
| 6715 | { |
| 6716 | case eCSR_DISCONNECT_REASON_MIC_ERROR: |
| 6717 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocMICFailure; |
| 6718 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6719 | case eCSR_DISCONNECT_REASON_DEAUTH: |
| 6720 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauth; |
| 6721 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6722 | case eCSR_DISCONNECT_REASON_HANDOFF: |
| 6723 | fHighPriority = eANI_BOOLEAN_TRUE; |
| 6724 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff; |
| 6725 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6726 | case eCSR_DISCONNECT_REASON_UNSPECIFIED: |
| 6727 | case eCSR_DISCONNECT_REASON_DISASSOC: |
| 6728 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 6729 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6730 | case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE: |
| 6731 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedIbssJoinFailure; |
| 6732 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6733 | case eCSR_DISCONNECT_REASON_IBSS_LEAVE: |
| 6734 | pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave; |
| 6735 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6736 | default: |
| 6737 | break; |
| 6738 | } |
| 6739 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6740 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6741 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6742 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6743 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6744 | } |
| 6745 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6746 | return( status ); |
| 6747 | } |
| 6748 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6749 | eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority ) |
| 6750 | { |
| 6751 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6752 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6753 | pCommand = csrGetCommandBuffer( pMac ); |
| 6754 | if ( NULL != pCommand ) |
| 6755 | { |
| 6756 | //Change the substate in case it is wait-for-key |
| 6757 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 6758 | { |
| 6759 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6760 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 6761 | } |
| 6762 | pCommand->command = eSmeCommandRoam; |
| 6763 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6764 | pCommand->u.roamCmd.roamReason = eCsrStopBss; |
| 6765 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6766 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6767 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6768 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6769 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6770 | } |
| 6771 | } |
| 6772 | else |
| 6773 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6774 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6775 | status = eHAL_STATUS_RESOURCES; |
| 6776 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6777 | return ( status ); |
| 6778 | } |
| 6779 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6780 | eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 6781 | { |
| 6782 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6783 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6784 | |
| 6785 | if(!pSession) |
| 6786 | { |
| 6787 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6788 | return eHAL_STATUS_FAILURE; |
| 6789 | } |
| 6790 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6791 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6792 | //Stop te retry |
| 6793 | pSession->maxRetryCount = 0; |
| 6794 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 6795 | #endif |
| 6796 | //Not to call cancel roaming here |
| 6797 | //Only issue disconnect when necessary |
| 6798 | if(csrIsConnStateConnected(pMac, sessionId) || csrIsBssTypeIBSS(pSession->connectedProfile.BSSType) |
| 6799 | || csrIsBssTypeWDS(pSession->connectedProfile.BSSType) |
| 6800 | || csrIsRoamCommandWaitingForSession(pMac, sessionId) ) |
| 6801 | |
| 6802 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6803 | smsLog(pMac, LOG2, FL("called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6804 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, reason); |
| 6805 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6806 | return (status); |
| 6807 | } |
| 6808 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6809 | eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 6810 | { |
| 6811 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6812 | |
| 6813 | if(!pSession) |
| 6814 | { |
| 6815 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6816 | return eHAL_STATUS_FAILURE; |
| 6817 | } |
| 6818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6819 | csrRoamCancelRoaming(pMac, sessionId); |
| 6820 | pSession->ibss_join_pending = FALSE; |
| 6821 | csrRoamStopIbssJoinTimer(pMac, sessionId); |
| 6822 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrForcedDisassoc); |
| 6823 | |
| 6824 | return (csrRoamDisconnectInternal(pMac, sessionId, reason)); |
| 6825 | } |
| 6826 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6827 | eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6828 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes) |
| 6829 | { |
| 6830 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6831 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 6832 | tANI_U8 index; |
| 6833 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 6834 | tCsrRoamConnectedProfile *pConnectProfile = &pSession->connectedProfile; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6835 | |
| 6836 | if(!pSession) |
| 6837 | { |
| 6838 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6839 | return eHAL_STATUS_FAILURE; |
| 6840 | } |
Madan Mohan Koyyalamudi | d02b594 | 2013-07-19 18:35:59 +0800 | [diff] [blame] | 6841 | |
| 6842 | if(pConnectProfile->pAddIEAssoc) |
| 6843 | { |
| 6844 | palFreeMemory(pMac->hHdd, pConnectProfile->pAddIEAssoc); |
| 6845 | pConnectProfile->pAddIEAssoc = NULL; |
| 6846 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6847 | palZeroMemory(pMac->hHdd, &pSession->connectedProfile, sizeof(tCsrRoamConnectedProfile)); |
| 6848 | pConnectProfile->AuthType = pProfile->negotiatedAuthType; |
| 6849 | pConnectProfile->AuthInfo = pProfile->AuthType; |
| 6850 | pConnectProfile->CBMode = pProfile->CBMode; //*** this may not be valid |
| 6851 | pConnectProfile->EncryptionType = pProfile->negotiatedUCEncryptionType; |
| 6852 | pConnectProfile->EncryptionInfo = pProfile->EncryptionType; |
| 6853 | pConnectProfile->mcEncryptionType = pProfile->negotiatedMCEncryptionType; |
| 6854 | pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType; |
| 6855 | pConnectProfile->BSSType = pProfile->BSSType; |
| 6856 | pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask; |
| 6857 | pConnectProfile->operationChannel = pSirBssDesc->channelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6858 | pConnectProfile->beaconInterval = pSirBssDesc->beaconInterval; |
| 6859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6860 | palCopyMemory(pMac->hHdd, &pConnectProfile->Keys, &pProfile->Keys, sizeof(tCsrKeys)); |
Madan Mohan Koyyalamudi | d02b594 | 2013-07-19 18:35:59 +0800 | [diff] [blame] | 6861 | |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6862 | /* saving the addional IE`s like Hot spot indication element and extended capabilities */ |
| 6863 | if(pProfile->nAddIEAssocLength) |
| 6864 | { |
| 6865 | status = palAllocateMemory(pMac->hHdd, |
| 6866 | (void **)&pConnectProfile->pAddIEAssoc, pProfile->nAddIEAssocLength); |
| 6867 | if(!HAL_STATUS_SUCCESS(status)) |
| 6868 | { |
| 6869 | smsLog(pMac, LOGE, FL("Failed to allocate memory for additional IEs")) ; |
| 6870 | return eHAL_STATUS_FAILURE; |
| 6871 | } |
| 6872 | pConnectProfile->nAddIEAssocLength = pProfile->nAddIEAssocLength; |
| 6873 | palCopyMemory(pMac->hHdd, pConnectProfile->pAddIEAssoc, pProfile->pAddIEAssoc, |
| 6874 | pProfile->nAddIEAssocLength); |
| 6875 | } |
| 6876 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6877 | //Save bssid |
| 6878 | csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid); |
| 6879 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6880 | if (pSirBssDesc->mdiePresent) |
| 6881 | { |
| 6882 | pConnectProfile->MDID.mdiePresent = 1; |
| 6883 | pConnectProfile->MDID.mobilityDomain = (pSirBssDesc->mdie[1] << 8) | (pSirBssDesc->mdie[0]); |
| 6884 | } |
| 6885 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | d48e327 | 2013-04-12 14:21:07 -0700 | [diff] [blame] | 6886 | if( NULL == pIesTemp ) |
| 6887 | { |
| 6888 | status = csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp); |
| 6889 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6890 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6891 | if ((csrIsProfileCCX(pProfile) || |
| 6892 | ((pIesTemp->CCXVersion.present) |
| 6893 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 6894 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 6895 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 6896 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6897 | #ifdef WLAN_FEATURE_11W |
| 6898 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 6899 | #endif |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 6900 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6901 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6902 | { |
| 6903 | pConnectProfile->isCCXAssoc = 1; |
| 6904 | } |
| 6905 | #endif |
| 6906 | //save ssid |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6907 | if(HAL_STATUS_SUCCESS(status)) |
| 6908 | { |
| 6909 | if(pIesTemp->SSID.present) |
| 6910 | { |
| 6911 | pConnectProfile->SSID.length = pIesTemp->SSID.num_ssid; |
| 6912 | palCopyMemory(pMac->hHdd, pConnectProfile->SSID.ssId, |
| 6913 | pIesTemp->SSID.ssid, pIesTemp->SSID.num_ssid); |
| 6914 | } |
| 6915 | |
| 6916 | //Save the bss desc |
| 6917 | status = csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 6918 | |
| 6919 | if( CSR_IS_QOS_BSS(pIesTemp) || pIesTemp->HTCaps.present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6920 | { |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 6921 | //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] | 6922 | pConnectProfile->qap = TRUE; |
| 6923 | } |
| 6924 | else |
| 6925 | { |
| 6926 | pConnectProfile->qap = FALSE; |
| 6927 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6928 | if ( NULL == pIes ) |
| 6929 | { |
| 6930 | //Free memory if it allocated locally |
| 6931 | palFreeMemory(pMac->hHdd, pIesTemp); |
| 6932 | } |
| 6933 | } |
| 6934 | //Save Qos connection |
| 6935 | pConnectProfile->qosConnection = pMac->roam.roamSession[sessionId].fWMMConnection; |
| 6936 | |
| 6937 | if(!HAL_STATUS_SUCCESS(status)) |
| 6938 | { |
| 6939 | csrFreeConnectBssDesc(pMac, sessionId); |
| 6940 | } |
| 6941 | for(index = 0; index < pProfile->SSIDs.numOfSSIDs; index++) |
| 6942 | { |
| 6943 | if((pProfile->SSIDs.SSIDList[index].SSID.length == pConnectProfile->SSID.length) && |
| 6944 | palEqualMemory(pMac->hHdd, pProfile->SSIDs.SSIDList[index].SSID.ssId, |
| 6945 | pConnectProfile->SSID.ssId, pConnectProfile->SSID.length)) |
| 6946 | { |
| 6947 | pConnectProfile->handoffPermitted = pProfile->SSIDs.SSIDList[index].handoffPermitted; |
| 6948 | break; |
| 6949 | } |
| 6950 | pConnectProfile->handoffPermitted = FALSE; |
| 6951 | } |
| 6952 | |
| 6953 | return (status); |
| 6954 | } |
| 6955 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6956 | static void csrRoamJoinRspProcessor( tpAniSirGlobal pMac, tSirSmeJoinRsp *pSmeJoinRsp ) |
| 6957 | { |
| 6958 | tListElem *pEntry = NULL; |
| 6959 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6960 | //The head of the active list is the request we sent |
| 6961 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6962 | if(pEntry) |
| 6963 | { |
| 6964 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6965 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6966 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 6967 | { |
| 6968 | if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason) |
| 6969 | { |
| 6970 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6971 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 6972 | #endif |
| 6973 | } |
| 6974 | csrRoamComplete( pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp ); |
| 6975 | } |
| 6976 | else |
| 6977 | { |
| 6978 | tANI_U32 roamId = 0; |
| 6979 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6980 | if(!pSession) |
| 6981 | { |
| 6982 | smsLog(pMac, LOGE, FL(" session %d not found "), pSmeJoinRsp->sessionId); |
| 6983 | return; |
| 6984 | } |
| 6985 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6986 | |
| 6987 | //The head of the active list is the request we sent |
| 6988 | //Try to get back the same profile and roam again |
| 6989 | if(pCommand) |
| 6990 | { |
| 6991 | roamId = pCommand->u.roamCmd.roamId; |
| 6992 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6993 | pSession->joinFailStatusCode.statusCode = pSmeJoinRsp->statusCode; |
| 6994 | pSession->joinFailStatusCode.reasonCode = pSmeJoinRsp->protStatusCode; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6995 | 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] | 6996 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 6997 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 6998 | if (csrRoamIsHandoffInProgress(pMac)) |
| 6999 | { |
| 7000 | csrRoamCallCallback(pMac, pSmeJoinRsp->sessionId, NULL, roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 7001 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 7002 | csrNeighborRoamIndicateConnect(pMac, pSmeJoinRsp->sessionId, VOS_STATUS_E_FAILURE); |
| 7003 | } |
| 7004 | #endif |
| 7005 | if (pCommand) |
| 7006 | { |
| 7007 | if(CSR_IS_WDS_STA( &pCommand->u.roamCmd.roamProfile )) |
| 7008 | { |
| 7009 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 7010 | pSession->connectedProfile.BSSType = eCSR_BSS_TYPE_WDS_STA; |
| 7011 | csrRoamReissueRoamCommand(pMac); |
| 7012 | } |
| 7013 | else if( CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) ) |
| 7014 | { |
| 7015 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7016 | } |
| 7017 | else |
| 7018 | { |
| 7019 | csrRoam(pMac, pCommand); |
| 7020 | } |
| 7021 | } |
| 7022 | else |
| 7023 | { |
| 7024 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7025 | } |
| 7026 | } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */ |
| 7027 | } |
| 7028 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7029 | eHalStatus csrRoamIssueJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 7030 | tDot11fBeaconIEs *pIes, |
| 7031 | tCsrRoamProfile *pProfile, tANI_U32 roamId ) |
| 7032 | { |
| 7033 | eHalStatus status; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7034 | 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] | 7035 | pSirBssDesc->bssId[ 0 ],pSirBssDesc->bssId[ 1 ],pSirBssDesc->bssId[ 2 ], |
| 7036 | pSirBssDesc->bssId[ 3 ],pSirBssDesc->bssId[ 4 ],pSirBssDesc->bssId[ 5 ] ); |
| 7037 | |
| 7038 | // Set the roaming substate to 'join attempt'... |
| 7039 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7040 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 7041 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7042 | return (status); |
| 7043 | } |
| 7044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7045 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 7046 | tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile) |
| 7047 | { |
| 7048 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7049 | // Set the roaming substate to 'join attempt'... |
| 7050 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId ); |
| 7051 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7052 | smsLog(pMac, LOGE, FL(" calling csrSendJoinReqMsg (eWNI_SME_REASSOC_REQ)")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7053 | |
| 7054 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 7055 | return csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_REASSOC_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7056 | } |
| 7057 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7058 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac) |
| 7059 | { |
| 7060 | tListElem *pEntry; |
| 7061 | tSmeCmd *pCommand; |
| 7062 | tCsrRoamInfo roamInfo; |
| 7063 | tANI_U32 sessionId; |
| 7064 | tCsrRoamSession *pSession; |
| 7065 | |
| 7066 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7067 | if(pEntry) |
| 7068 | { |
| 7069 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7070 | if ( eSmeCommandRoam == pCommand->command ) |
| 7071 | { |
| 7072 | sessionId = pCommand->sessionId; |
| 7073 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7074 | |
| 7075 | if(!pSession) |
| 7076 | { |
| 7077 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7078 | return; |
| 7079 | } |
| 7080 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7081 | if( pCommand->u.roamCmd.fStopWds ) |
| 7082 | { |
| 7083 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 7084 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 7085 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 7086 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7087 | if (CSR_IS_WDS(&pSession->connectedProfile)){ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7088 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 7089 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 7090 | eCSR_ROAM_WDS_IND, |
| 7091 | eCSR_ROAM_RESULT_WDS_DISASSOCIATED); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7092 | }else if (CSR_IS_INFRA_AP(&pSession->connectedProfile)){ |
| 7093 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 7094 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 7095 | eCSR_ROAM_INFRA_IND, |
| 7096 | eCSR_ROAM_RESULT_INFRA_DISASSOCIATED); |
| 7097 | } |
| 7098 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7099 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7100 | if( !HAL_STATUS_SUCCESS( csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ) ) ) |
| 7101 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7102 | 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] | 7103 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7104 | } |
| 7105 | } |
| 7106 | else if(eCsrStopRoaming == csrRoamJoinNextBss(pMac, pCommand, eANI_BOOLEAN_TRUE)) |
| 7107 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7108 | smsLog(pMac, LOGW, " Failed to reissue join command after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7109 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7110 | } |
| 7111 | } |
| 7112 | else |
| 7113 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7114 | smsLog(pMac, LOGW, " Command is not roaming after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7115 | } |
| 7116 | } |
| 7117 | else |
| 7118 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7119 | smsLog(pMac, LOGE, " Disassoc rsp cannot continue because no command is available"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7120 | } |
| 7121 | } |
| 7122 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7123 | tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 7124 | { |
| 7125 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7126 | tListElem *pEntry; |
| 7127 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7128 | //alwasy lock active list before locking pending list |
| 7129 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7130 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7131 | if(pEntry) |
| 7132 | { |
| 7133 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7134 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7135 | { |
| 7136 | fRet = eANI_BOOLEAN_TRUE; |
| 7137 | } |
| 7138 | } |
| 7139 | if(eANI_BOOLEAN_FALSE == fRet) |
| 7140 | { |
| 7141 | csrLLLock(&pMac->sme.smeCmdPendingList); |
| 7142 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK); |
| 7143 | while(pEntry) |
| 7144 | { |
| 7145 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7146 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7147 | { |
| 7148 | fRet = eANI_BOOLEAN_TRUE; |
| 7149 | break; |
| 7150 | } |
| 7151 | pEntry = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK); |
| 7152 | } |
| 7153 | csrLLUnlock(&pMac->sme.smeCmdPendingList); |
| 7154 | } |
| 7155 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7156 | return (fRet); |
| 7157 | } |
| 7158 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7159 | tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac) |
| 7160 | { |
| 7161 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7162 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7163 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 7164 | { |
| 7165 | if( CSR_IS_SESSION_VALID( pMac, i ) && ( fRet = csrIsRoamCommandWaitingForSession( pMac, i ) ) ) |
| 7166 | { |
| 7167 | break; |
| 7168 | } |
| 7169 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7170 | return ( fRet ); |
| 7171 | } |
| 7172 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7173 | tANI_BOOLEAN csrIsCommandWaiting(tpAniSirGlobal pMac) |
| 7174 | { |
| 7175 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7176 | //alwasy lock active list before locking pending list |
| 7177 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7178 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7179 | if(eANI_BOOLEAN_FALSE == fRet) |
| 7180 | { |
| 7181 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK); |
| 7182 | } |
| 7183 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7184 | return (fRet); |
| 7185 | } |
| 7186 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7187 | tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac ) |
| 7188 | { |
| 7189 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7190 | tListElem *pEntry; |
| 7191 | tCsrCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7192 | //alwasy lock active list before locking pending list |
| 7193 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7194 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7195 | if( pEntry ) |
| 7196 | { |
| 7197 | pCommand = GET_BASE_ADDR(pEntry, tCsrCmd, Link); |
| 7198 | if( ( eCsrRoamCommandScan == pCommand->command ) && |
| 7199 | ( ( eCsrScanForSsid == pCommand->u.scanCmd.reason ) || |
| 7200 | ( eCsrScanForCapsChange == pCommand->u.scanCmd.reason ) || |
| 7201 | ( eCsrScanP2PFindPeer == pCommand->u.scanCmd.reason ) ) ) |
| 7202 | { |
| 7203 | fRet = eANI_BOOLEAN_TRUE; |
| 7204 | } |
| 7205 | } |
| 7206 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7207 | return (fRet); |
| 7208 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7209 | eHalStatus csrRoamIssueReassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 7210 | { |
| 7211 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7212 | tSmeCmd *pCommand = NULL; |
| 7213 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_TRUE; |
| 7214 | tANI_BOOLEAN fRemoveCmd = FALSE; |
| 7215 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7216 | // Delete the old assoc command. All is setup for reassoc to be serialized |
| 7217 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 7218 | if ( pEntry ) |
| 7219 | { |
| 7220 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 7221 | if ( !pCommand ) |
| 7222 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7223 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7224 | return eHAL_STATUS_RESOURCES; |
| 7225 | } |
| 7226 | if ( eSmeCommandRoam == pCommand->command ) |
| 7227 | { |
| 7228 | if (pCommand->u.roamCmd.roamReason == eCsrSmeIssuedAssocToSimilarAP) |
| 7229 | { |
| 7230 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 7231 | } |
| 7232 | else |
| 7233 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7234 | smsLog( pMac, LOGE, FL(" Unexpected active roam command present ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7235 | } |
| 7236 | if (fRemoveCmd == FALSE) |
| 7237 | { |
| 7238 | // Implies we did not get the serialized assoc command we |
| 7239 | // were expecting |
| 7240 | pCommand = NULL; |
| 7241 | } |
| 7242 | } |
| 7243 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7244 | if(NULL == pCommand) |
| 7245 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7246 | 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] | 7247 | return eHAL_STATUS_RESOURCES; |
| 7248 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7249 | do |
| 7250 | { |
| 7251 | //Change the substate in case it is wait-for-key |
| 7252 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7253 | { |
| 7254 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7255 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 7256 | } |
| 7257 | pCommand->command = eSmeCommandRoam; |
| 7258 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7259 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedFTReassoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7260 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 7261 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7262 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7263 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7264 | csrReleaseCommandRoam( pMac, pCommand ); |
| 7265 | } |
| 7266 | } while( 0 ); |
| 7267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7268 | return( status ); |
| 7269 | } |
| 7270 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ) |
| 7271 | { |
| 7272 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7273 | tCsrScanResult *pScanResult = NULL; |
| 7274 | tSirBssDescription *pBssDesc = NULL; |
| 7275 | tSmeCmd *pCommand = NULL; |
| 7276 | tANI_U32 sessionId; |
| 7277 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7278 | if(NULL == pEntry) |
| 7279 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7280 | smsLog(pMac, LOGW, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7281 | return; |
| 7282 | } |
| 7283 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7284 | sessionId = pCommand->sessionId; |
| 7285 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7286 | |
| 7287 | if(!pSession) |
| 7288 | { |
| 7289 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7290 | return; |
| 7291 | } |
| 7292 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7293 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 7294 | { |
| 7295 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7296 | smsLog(pMac, LOGW, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7297 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 7298 | } |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 7299 | /* If the roaming has stopped, not to continue the roaming command*/ |
| 7300 | else if ( !CSR_IS_ROAMING(pSession) && CSR_IS_ROAMING_COMMAND(pCommand) ) |
| 7301 | { |
| 7302 | //No need to complete roaming here as it already completes |
| 7303 | smsLog(pMac, LOGW, FL(" Roam command (reason %d) aborted due to roaming completed\n"), |
| 7304 | pCommand->u.roamCmd.roamReason); |
| 7305 | csrSetAbortRoamingCommand( pMac, pCommand ); |
| 7306 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 7307 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7308 | else |
| 7309 | { |
| 7310 | if ( CCM_IS_RESULT_SUCCESS(result) ) |
| 7311 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7312 | smsLog(pMac, LOG2, "Cfg sequence complete"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7313 | // Successfully set the configuration parameters for the new Bss. Attempt to |
| 7314 | // join the roaming Bss. |
| 7315 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 7316 | { |
| 7317 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 7318 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 7319 | } |
| 7320 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) || |
| 7321 | CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7322 | || CSR_IS_INFRA_AP(&pCommand->u.roamCmd.roamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7323 | ) |
| 7324 | { |
| 7325 | if(!HAL_STATUS_SUCCESS(csrRoamIssueStartBss( pMac, sessionId, |
| 7326 | &pSession->bssParams, &pCommand->u.roamCmd.roamProfile, |
| 7327 | pBssDesc, pCommand->u.roamCmd.roamId ))) |
| 7328 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7329 | smsLog(pMac, LOGW, " CSR start BSS failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7330 | //We need to complete the command |
| 7331 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7332 | } |
| 7333 | } |
| 7334 | else |
| 7335 | { |
| 7336 | if (!pCommand->u.roamCmd.pRoamBssEntry) |
| 7337 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7338 | smsLog(pMac, LOGW, " pRoamBssEntry is NULL"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7339 | //We need to complete the command |
| 7340 | csrRoamComplete(pMac, eCsrJoinFailure, NULL); |
| 7341 | return; |
| 7342 | } |
| 7343 | // If we are roaming TO an Infrastructure BSS... |
| 7344 | VOS_ASSERT(pScanResult != NULL); |
| 7345 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7346 | { |
| 7347 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7348 | if(pIesLocal || (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 7349 | { |
| 7350 | // ..and currently in an Infrastructure connection.... |
| 7351 | if( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 7352 | { |
| 7353 | // ...and the SSIDs are equal, then we Reassoc. |
| 7354 | if ( csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, |
| 7355 | pIesLocal ) ) |
| 7356 | // ..and currently in an infrastructure connection |
| 7357 | { |
| 7358 | // then issue a Reassoc. |
| 7359 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
| 7360 | csrRoamIssueReassociate( pMac, sessionId, pBssDesc, pIesLocal, |
| 7361 | &pCommand->u.roamCmd.roamProfile ); |
| 7362 | } |
| 7363 | else |
| 7364 | { |
| 7365 | |
| 7366 | // otherwise, we have to issue a new Join request to LIM because we disassociated from the |
| 7367 | // previously associated AP. |
| 7368 | if(!HAL_STATUS_SUCCESS(csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7369 | pIesLocal, |
| 7370 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ))) |
| 7371 | { |
| 7372 | //try something else |
| 7373 | csrRoam( pMac, pCommand ); |
| 7374 | } |
| 7375 | } |
| 7376 | } |
| 7377 | else |
| 7378 | { |
| 7379 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7380 | |
| 7381 | /* We need to come with other way to figure out that this is because of HO in BMP |
| 7382 | The below API will be only available for Android as it uses a different HO algorithm */ |
| 7383 | /* Reassoc request will be used only for CCX and 11r handoff whereas other legacy roaming should |
| 7384 | * use join request */ |
| 7385 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7386 | if (csrRoamIsHandoffInProgress(pMac) && |
| 7387 | csrRoamIs11rAssoc(pMac)) |
| 7388 | { |
| 7389 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 7390 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 7391 | } |
| 7392 | else |
| 7393 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7394 | #ifdef FEATURE_WLAN_CCX |
| 7395 | if (csrRoamIsHandoffInProgress(pMac) && |
| 7396 | csrRoamIsCCXAssoc(pMac)) |
| 7397 | { |
| 7398 | // Now serialize the reassoc command. |
| 7399 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7400 | } |
| 7401 | else |
| 7402 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7403 | #ifdef FEATURE_WLAN_LFR |
| 7404 | if (csrRoamIsHandoffInProgress(pMac) && |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 7405 | csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7406 | { |
| 7407 | // Now serialize the reassoc command. |
| 7408 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7409 | } |
| 7410 | else |
| 7411 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7412 | // else we are not connected and attempting to Join. Issue the |
| 7413 | // Join request. |
| 7414 | { |
| 7415 | status = csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7416 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), |
| 7417 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ); |
| 7418 | } |
| 7419 | if(!HAL_STATUS_SUCCESS(status)) |
| 7420 | { |
| 7421 | //try something else |
| 7422 | csrRoam( pMac, pCommand ); |
| 7423 | } |
| 7424 | } |
| 7425 | if( !pScanResult->Result.pvIes ) |
| 7426 | { |
| 7427 | //Locally allocated |
| 7428 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 7429 | } |
| 7430 | } |
| 7431 | }//if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7432 | else |
| 7433 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7434 | smsLog(pMac, LOGW, FL(" found BSSType mismatching the one in BSS description")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7435 | } |
| 7436 | }//else |
| 7437 | }//if ( WNI_CFG_SUCCESS == result ) |
| 7438 | else |
| 7439 | { |
| 7440 | // In the event the configuration failed, for infra let the roam processor |
| 7441 | //attempt to join something else... |
| 7442 | if( pCommand->u.roamCmd.pRoamBssEntry && CSR_IS_INFRASTRUCTURE( &pCommand->u.roamCmd.roamProfile ) ) |
| 7443 | { |
| 7444 | csrRoam(pMac, pCommand); |
| 7445 | } |
| 7446 | else |
| 7447 | { |
| 7448 | //We need to complete the command |
| 7449 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) ) |
| 7450 | { |
| 7451 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7452 | } |
| 7453 | else |
| 7454 | { |
| 7455 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7456 | } |
| 7457 | } |
| 7458 | } |
| 7459 | }//we have active entry |
| 7460 | } |
| 7461 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7462 | static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp ) |
| 7463 | { |
| 7464 | //No one is sending eWNI_SME_AUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7465 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7466 | if ( eSIR_SME_SUCCESS == pSmeAuthRsp->statusCode ) |
| 7467 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7468 | smsLog( pMac, LOGW, "CSR SmeAuthReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7469 | // Successfully authenticated with a new Bss. Attempt to stop the current Bss and |
| 7470 | // join the new one... |
| 7471 | /***pBssDesc = profGetRoamingBssDesc( pAdapter, &pHddProfile ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7472 | roamStopNetwork( pAdapter, &pBssDesc->SirBssDescription );***/ |
| 7473 | } |
| 7474 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7475 | 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] | 7476 | /***profHandleLostLinkAfterReset(pAdapter); |
| 7477 | // In the event the authenticate fails, let the roam processor attempt to join something else... |
| 7478 | roamRoam( pAdapter );***/ |
| 7479 | } |
| 7480 | } |
| 7481 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7482 | static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSmeJoinRsp pSmeJoinRsp ) |
| 7483 | { |
| 7484 | eCsrRoamCompleteResult result; |
| 7485 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 7486 | tCsrRoamInfo roamInfo; |
| 7487 | tANI_U32 roamId = 0; |
| 7488 | |
| 7489 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 7490 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7491 | smsLog( pMac, LOGW, "CSR SmeReassocReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7492 | result = eCsrReassocSuccess; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7493 | /* Defeaturize this part later if needed */ |
| 7494 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7495 | /* Since the neighbor roam algorithm uses reassoc req for handoff instead of join, |
| 7496 | * we need the response contents while processing the result in csrRoamProcessResults() */ |
| 7497 | if (csrRoamIsHandoffInProgress(pMac)) |
| 7498 | { |
| 7499 | /* Need to dig more on indicating events to SME QoS module */ |
| 7500 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 7501 | csrRoamComplete( pMac, result, pSmeJoinRsp); |
| 7502 | } |
| 7503 | else |
| 7504 | #endif |
| 7505 | { |
| 7506 | csrRoamComplete( pMac, result, NULL ); |
| 7507 | } |
| 7508 | } |
| 7509 | /* Should we handle this similar to handling the join failure? Is it ok |
| 7510 | * to call csrRoamComplete() with state as CsrJoinFailure */ |
| 7511 | else |
| 7512 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7513 | 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] | 7514 | result = eCsrReassocFailure; |
| 7515 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7516 | if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) || |
| 7517 | (eSIR_SME_FT_REASSOC_FAILURE == pSmeJoinRsp->statusCode)) |
| 7518 | { |
| 7519 | // Inform HDD to turn off FT flag in HDD |
| 7520 | if (pNeighborRoamInfo) |
| 7521 | { |
| 7522 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7523 | csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, |
| 7524 | &roamInfo, roamId, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
Madan Mohan Koyyalamudi | 5777216 | 2012-10-18 19:46:14 -0700 | [diff] [blame] | 7525 | /* |
| 7526 | * Since the above callback sends a disconnect |
| 7527 | * to HDD, we should clean-up our state |
| 7528 | * machine as well to be in sync with the upper |
| 7529 | * layers. There is no need to send a disassoc |
| 7530 | * since: 1) we will never reassoc to the current |
| 7531 | * AP in LFR, and 2) there is no need to issue a |
| 7532 | * disassoc to the AP with which we were trying |
| 7533 | * to reassoc. |
| 7534 | */ |
| 7535 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7536 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7537 | } |
| 7538 | } |
| 7539 | #endif |
| 7540 | // In the event that the Reassociation fails, then we need to Disassociate the current association and keep |
| 7541 | // roaming. Note that we will attempt to Join the AP instead of a Reassoc since we may have attempted a |
| 7542 | // 'Reassoc to self', which AP's that don't support Reassoc will force a Disassoc. |
| 7543 | //The disassoc rsp message will remove the command from active list |
| 7544 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, pSmeJoinRsp->sessionId, |
| 7545 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE ))) |
| 7546 | { |
| 7547 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7548 | } |
| 7549 | } |
| 7550 | } |
| 7551 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7552 | static void csrRoamRoamingStateStopBssRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSmeRsp) |
| 7553 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7554 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7555 | { |
| 7556 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7557 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 7558 | if(pIbssLog) |
| 7559 | { |
| 7560 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_RSP; |
| 7561 | if(eSIR_SME_SUCCESS != pSmeRsp->statusCode) |
| 7562 | { |
| 7563 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 7564 | } |
| 7565 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 7566 | } |
| 7567 | } |
| 7568 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7569 | pMac->roam.roamSession[pSmeRsp->sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7570 | if(CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, pSmeRsp->sessionId)) |
| 7571 | { |
| 7572 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7573 | } |
| 7574 | else if(CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId)) |
| 7575 | { |
| 7576 | csrRoamReissueRoamCommand(pMac); |
| 7577 | } |
| 7578 | } |
| 7579 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7580 | void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeRsp ) |
| 7581 | { |
| 7582 | tSirResultCodes statusCode; |
| 7583 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7584 | tScanResultHandle hBSSList; |
| 7585 | tANI_BOOLEAN fCallCallback, fRemoveCmd; |
| 7586 | eHalStatus status; |
| 7587 | tCsrRoamInfo roamInfo; |
| 7588 | tCsrScanResultFilter *pScanFilter = NULL; |
| 7589 | tANI_U32 roamId = 0; |
| 7590 | tCsrRoamProfile *pCurRoamProfile = NULL; |
| 7591 | tListElem *pEntry = NULL; |
| 7592 | tSmeCmd *pCommand = NULL; |
| 7593 | #endif |
| 7594 | tANI_U32 sessionId; |
| 7595 | tCsrRoamSession *pSession; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7596 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7597 | tSirSmeDisassocRsp SmeDisassocRsp; |
| 7598 | |
| 7599 | csrSerDesUnpackDiassocRsp((tANI_U8 *)pSmeRsp, &SmeDisassocRsp); |
| 7600 | sessionId = SmeDisassocRsp.sessionId; |
| 7601 | statusCode = SmeDisassocRsp.statusCode; |
| 7602 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7603 | smsLog( pMac, LOG2, "csrRoamRoamingStateDisassocRspProcessor sessionId %d", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7604 | |
| 7605 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 7606 | { |
| 7607 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7608 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7609 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7610 | |
| 7611 | if(!pSession) |
| 7612 | { |
| 7613 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7614 | return; |
| 7615 | } |
| 7616 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7617 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) ) |
| 7618 | { |
| 7619 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7620 | } |
| 7621 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, sessionId ) || |
| 7622 | CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, sessionId ) ) |
| 7623 | { |
| 7624 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7625 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7626 | smsLog( pMac, LOG2, "CSR SmeDisassocReq force disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7627 | //A callback to HDD will be issued from csrRoamComplete so no need to do anything here |
| 7628 | } |
| 7629 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7630 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7631 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId ) ) |
| 7632 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7633 | smsLog( pMac, LOGE, "CSR SmeDisassocReq due to HO on session %d", sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7634 | #if defined (WLAN_FEATURE_NEIGHBOR_ROAMING) |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7635 | /* |
| 7636 | * First ensure if the roam profile is in the scan cache. |
| 7637 | * If not, post a reassoc failure and disconnect. |
| 7638 | */ |
| 7639 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 7640 | if(HAL_STATUS_SUCCESS(status)) |
| 7641 | { |
| 7642 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 7643 | status = csrRoamPrepareFilterFromProfile(pMac, |
| 7644 | &pMac->roam.neighborRoamInfo.csrNeighborRoamProfile, pScanFilter); |
| 7645 | if(!HAL_STATUS_SUCCESS(status)) |
| 7646 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7647 | 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] | 7648 | __func__, status); |
| 7649 | goto POST_ROAM_FAILURE; |
| 7650 | } |
| 7651 | else |
| 7652 | { |
| 7653 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 7654 | if (!HAL_STATUS_SUCCESS(status)) |
| 7655 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7656 | smsLog( pMac, LOGE,"%s: csrScanGetResult failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7657 | __func__, status); |
| 7658 | goto POST_ROAM_FAILURE; |
| 7659 | } |
| 7660 | } |
| 7661 | } |
| 7662 | else |
| 7663 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7664 | smsLog( pMac, LOGE,"%s: alloc for pScanFilter failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7665 | __func__, status); |
| 7666 | goto POST_ROAM_FAILURE; |
| 7667 | } |
| 7668 | |
| 7669 | /* |
| 7670 | * After ensuring that the roam profile is in the scan result list, |
| 7671 | * dequeue the command from the active list. |
| 7672 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7673 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 7674 | if ( pEntry ) |
| 7675 | { |
| 7676 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7677 | /* If the head of the queue is Active and it is a ROAM command, remove |
| 7678 | * and put this on the Free queue. |
| 7679 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7680 | if ( eSmeCommandRoam == pCommand->command ) |
| 7681 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7682 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7683 | /* |
| 7684 | * we need to process the result first before removing it from active list |
| 7685 | * because state changes still happening insides roamQProcessRoamResults so |
| 7686 | * no other roam command should be issued. |
| 7687 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7688 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 7689 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 7690 | { |
| 7691 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 7692 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 7693 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7694 | if( fRemoveCmd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7695 | csrReleaseCommandRoam( pMac, pCommand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7696 | else |
| 7697 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7698 | smsLog( pMac, LOGE, "%s: fail to remove cmd reason %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7699 | __func__, pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7700 | } |
| 7701 | } |
| 7702 | else |
| 7703 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7704 | smsLog( pMac, LOGE, "%s: roam command not active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7705 | } |
| 7706 | } |
| 7707 | else |
| 7708 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7709 | smsLog( pMac, LOGE, "%s: NO commands are active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7710 | } |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7711 | |
| 7712 | /* Notify HDD about handoff and provide the BSSID too */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7713 | roamInfo.reasonCode = eCsrRoamReasonBetterAP; |
| 7714 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7715 | palCopyMemory(pMac->hHdd, roamInfo.bssid, |
| 7716 | pMac->roam.neighborRoamInfo.csrNeighborRoamProfile.BSSIDs.bssid, |
| 7717 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7718 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7719 | csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, |
| 7720 | eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7721 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7722 | /* Copy the connected profile to apply the same for this connection as well */ |
| 7723 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 7724 | (void **)&pCurRoamProfile, sizeof(tCsrRoamProfile)))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7725 | { |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7726 | palZeroMemory(pMac->hHdd, pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 7727 | csrRoamCopyProfile(pMac, pCurRoamProfile, pSession->pCurRoamProfile); |
| 7728 | //make sure to put it at the head of the cmd queue |
| 7729 | status = csrRoamIssueConnect(pMac, sessionId, pCurRoamProfile, |
| 7730 | hBSSList, eCsrSmeIssuedAssocToSimilarAP, |
| 7731 | roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE); |
| 7732 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7733 | if(!HAL_STATUS_SUCCESS(status)) |
| 7734 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7735 | smsLog( pMac, LOGE,"%s: csrRoamIssueConnect failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7736 | __func__, status); |
| 7737 | fCallCallback = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7738 | } |
| 7739 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7740 | /* Notify sub-modules like QoS etc. that handoff happening */ |
| 7741 | sme_QosCsrEventInd(pMac, sessionId, SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 7742 | csrReleaseProfile(pMac, pCurRoamProfile); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7743 | palFreeMemory(pMac->hHdd, pCurRoamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7744 | csrFreeScanFilter(pMac, pScanFilter); |
| 7745 | palFreeMemory( pMac->hHdd, pScanFilter ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7746 | return; |
| 7747 | } |
| 7748 | |
| 7749 | POST_ROAM_FAILURE: |
| 7750 | if (pScanFilter) |
| 7751 | { |
| 7752 | csrFreeScanFilter(pMac, pScanFilter); |
| 7753 | palFreeMemory( pMac->hHdd, pScanFilter ); |
| 7754 | } |
| 7755 | if (pCurRoamProfile) |
| 7756 | palFreeMemory(pMac->hHdd, pCurRoamProfile); |
| 7757 | |
| 7758 | /* Inform the upper layers that the reassoc failed */ |
| 7759 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7760 | csrRoamCallCallback(pMac, sessionId, |
| 7761 | &roamInfo, 0, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
| 7762 | |
| 7763 | /* |
| 7764 | * Issue a disassoc request so that PE/LIM uses this to clean-up the FT session. |
| 7765 | * Upon success, we would re-enter this routine after receiving the disassoc |
| 7766 | * response and will fall into the reassoc fail sub-state. And, eventually |
| 7767 | * call csrRoamComplete which would remove the roam command from SME active |
| 7768 | * queue. |
| 7769 | */ |
| 7770 | if (!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate(pMac, sessionId, |
| 7771 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE))) |
| 7772 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7773 | smsLog( pMac, LOGE,"%s: csrRoamIssueDisassociate failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7774 | __func__, status); |
| 7775 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7776 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7777 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7778 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7779 | } //else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) ) |
| 7780 | else if ( CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, sessionId ) ) |
| 7781 | { |
| 7782 | // Disassoc due to Reassoc failure falls into this codepath.... |
| 7783 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7784 | } |
| 7785 | else |
| 7786 | { |
| 7787 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7788 | { |
| 7789 | // Successfully disassociated from the 'old' Bss... |
| 7790 | // |
| 7791 | // We get Disassociate response in three conditions. |
| 7792 | // - First is the case where we are disasociating from an Infra Bss to start an IBSS. |
| 7793 | // - Second is the when we are disassociating from an Infra Bss to join an IBSS or a new |
| 7794 | // Infrastructure network. |
| 7795 | // - Third is where we are doing an Infra to Infra roam between networks with different |
| 7796 | // SSIDs. In all cases, we set the new Bss configuration here and attempt to join |
| 7797 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7798 | smsLog( pMac, LOG2, "CSR SmeDisassocReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7799 | } |
| 7800 | else |
| 7801 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7802 | smsLog( pMac, LOGE, "SmeDisassocReq failed with statusCode= 0x%08lX", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7803 | } |
| 7804 | //We are not done yet. Get the data and continue roaming |
| 7805 | csrRoamReissueRoamCommand(pMac); |
| 7806 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7807 | } |
| 7808 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7809 | static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp ) |
| 7810 | { |
| 7811 | tSirResultCodes statusCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7812 | //No one is sending eWNI_SME_DEAUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7813 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7814 | statusCode = csrGetDeAuthRspStatusCode( pSmeRsp ); |
| 7815 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 7816 | { |
| 7817 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7818 | } |
| 7819 | else |
| 7820 | { |
| 7821 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7822 | { |
| 7823 | // Successfully deauth from the 'old' Bss... |
| 7824 | // |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7825 | smsLog( pMac, LOG2, "CSR SmeDeauthReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7826 | } |
| 7827 | else |
| 7828 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7829 | smsLog( pMac, LOGW, "SmeDeauthReq failed with statusCode= 0x%08lX", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7830 | } |
| 7831 | //We are not done yet. Get the data and continue roaming |
| 7832 | csrRoamReissueRoamCommand(pMac); |
| 7833 | } |
| 7834 | } |
| 7835 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7836 | static void csrRoamRoamingStateStartBssRspProcessor( tpAniSirGlobal pMac, tSirSmeStartBssRsp *pSmeStartBssRsp ) |
| 7837 | { |
| 7838 | eCsrRoamCompleteResult result; |
| 7839 | |
| 7840 | if ( eSIR_SME_SUCCESS == pSmeStartBssRsp->statusCode ) |
| 7841 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7842 | smsLog( pMac, LOGW, "SmeStartBssReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7843 | result = eCsrStartBssSuccess; |
| 7844 | } |
| 7845 | else |
| 7846 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7847 | smsLog( pMac, LOGW, "SmeStartBssReq failed with statusCode= 0x%08lX", pSmeStartBssRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7848 | //Let csrRoamComplete decide what to do |
| 7849 | result = eCsrStartBssFailure; |
| 7850 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7851 | csrRoamComplete( pMac, result, pSmeStartBssRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7852 | } |
| 7853 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7854 | /* |
| 7855 | We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of strucutres. |
| 7856 | It depends on how the message is constructed. If the message is sent by limSendSmeRsp, |
| 7857 | the pMsgBuf is only a generic response and can only be used as pointer to tSirSmeRsp. |
| 7858 | For the messages where sender allocates memory for specific structures, then it can be |
| 7859 | cast accordingly. |
| 7860 | */ |
| 7861 | void csrRoamingStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 7862 | { |
| 7863 | tSirSmeRsp *pSmeRsp; |
| 7864 | tSmeIbssPeerInd *pIbssPeerInd; |
| 7865 | tCsrRoamInfo roamInfo; |
| 7866 | // TODO Session Id need to be acquired in this function |
| 7867 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7868 | pSmeRsp = (tSirSmeRsp *)pMsgBuf; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7869 | smsLog( pMac, LOG2, "Message %d[0x%04X] received in substate %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7870 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 7871 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7872 | pSmeRsp->messageType = (pSmeRsp->messageType); |
| 7873 | pSmeRsp->length = (pSmeRsp->length); |
| 7874 | pSmeRsp->statusCode = (pSmeRsp->statusCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7875 | switch (pSmeRsp->messageType) |
| 7876 | { |
| 7877 | |
| 7878 | case eWNI_SME_JOIN_RSP: // in Roaming state, process the Join response message... |
| 7879 | if (CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, pSmeRsp->sessionId)) |
| 7880 | { |
| 7881 | //We sent a JOIN_REQ |
| 7882 | csrRoamJoinRspProcessor( pMac, (tSirSmeJoinRsp *)pSmeRsp ); |
| 7883 | } |
| 7884 | break; |
| 7885 | |
| 7886 | case eWNI_SME_AUTH_RSP: // or the Authenticate response message... |
| 7887 | if (CSR_IS_ROAM_SUBSTATE_AUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 7888 | { |
| 7889 | //We sent a AUTH_REQ |
| 7890 | csrRoamRoamingStateAuthRspProcessor( pMac, (tSirSmeAuthRsp *)pSmeRsp ); |
| 7891 | } |
| 7892 | break; |
| 7893 | |
| 7894 | case eWNI_SME_REASSOC_RSP: // or the Reassociation response message... |
| 7895 | if (CSR_IS_ROAM_SUBSTATE_REASSOC_REQ( pMac, pSmeRsp->sessionId) ) |
| 7896 | { |
| 7897 | csrRoamRoamingStateReassocRspProcessor( pMac, (tpSirSmeJoinRsp )pSmeRsp ); |
| 7898 | } |
| 7899 | break; |
| 7900 | |
| 7901 | case eWNI_SME_STOP_BSS_RSP: // or the Stop Bss response message... |
| 7902 | { |
| 7903 | csrRoamRoamingStateStopBssRspProcessor(pMac, pSmeRsp); |
| 7904 | } |
| 7905 | break; |
| 7906 | |
| 7907 | case eWNI_SME_DISASSOC_RSP: // or the Disassociate response message... |
| 7908 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, pSmeRsp->sessionId ) || |
| 7909 | CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, pSmeRsp->sessionId ) || |
| 7910 | CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, pSmeRsp->sessionId ) || |
| 7911 | CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, pSmeRsp->sessionId ) || |
| 7912 | CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId ) || |
| 7913 | //HO |
| 7914 | CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, pSmeRsp->sessionId ) ) |
| 7915 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7916 | 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] | 7917 | csrRoamRoamingStateDisassocRspProcessor( pMac, (tSirSmeDisassocRsp *)pSmeRsp ); |
| 7918 | } |
| 7919 | break; |
| 7920 | |
| 7921 | case eWNI_SME_DEAUTH_RSP: // or the Deauthentication response message... |
| 7922 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId ) ) |
| 7923 | { |
| 7924 | csrRoamRoamingStateDeauthRspProcessor( pMac, (tSirSmeDeauthRsp *)pSmeRsp ); |
| 7925 | } |
| 7926 | break; |
| 7927 | |
| 7928 | case eWNI_SME_START_BSS_RSP: // or the Start BSS response message... |
| 7929 | if (CSR_IS_ROAM_SUBSTATE_START_BSS_REQ( pMac, pSmeRsp->sessionId ) ) |
| 7930 | { |
| 7931 | csrRoamRoamingStateStartBssRspProcessor( pMac, (tSirSmeStartBssRsp *)pSmeRsp ); |
| 7932 | } |
| 7933 | break; |
| 7934 | |
| 7935 | case WNI_CFG_SET_CNF: // process the Config Confirm messages when we are in 'Config' substate... |
| 7936 | if ( CSR_IS_ROAM_SUBSTATE_CONFIG( pMac, pSmeRsp->sessionId ) ) |
| 7937 | { |
| 7938 | csrRoamingStateConfigCnfProcessor( pMac, ((tCsrCfgSetRsp *)pSmeRsp)->respStatus ); |
| 7939 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7940 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7941 | //In case CSR issues STOP_BSS, we need to tell HDD about peer departed becasue PE is removing them |
| 7942 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 7943 | pIbssPeerInd = (tSmeIbssPeerInd*)pSmeRsp; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7944 | smsLog(pMac, LOGE, "CSR: Peer departed notification from LIM in joining state"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7945 | palZeroMemory( pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo) ); |
| 7946 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 7947 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 7948 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 7949 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 7950 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 7951 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 7952 | eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 7953 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7954 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7955 | 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] | 7956 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 7957 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
| 7958 | |
| 7959 | //If we are connected, check the link status change |
| 7960 | if(!csrIsConnStateDisconnected(pMac, sessionId)) |
| 7961 | { |
| 7962 | csrRoamCheckForLinkStatusChange( pMac, pSmeRsp ); |
| 7963 | } |
| 7964 | break; |
| 7965 | } |
| 7966 | } |
| 7967 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7968 | void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 7969 | { |
| 7970 | tSirSmeRsp *pSirMsg = (tSirSmeRsp *)pMsgBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7971 | switch (pSirMsg->messageType) |
| 7972 | { |
| 7973 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7974 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7975 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 7976 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7977 | case eWNI_SME_UPPER_LAYER_ASSOC_CNF: |
| 7978 | { |
| 7979 | tCsrRoamSession *pSession; |
| 7980 | tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf; |
| 7981 | tCsrRoamInfo roamInfo; |
| 7982 | tCsrRoamInfo *pRoamInfo = NULL; |
| 7983 | tANI_U32 sessionId; |
| 7984 | eHalStatus status; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7985 | smsLog( pMac, LOG1, FL("ASSOCIATION confirmation can be given to upper layer ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7986 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 7987 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7988 | pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf; |
| 7989 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId ); |
| 7990 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7991 | |
| 7992 | if(!pSession) |
| 7993 | { |
| 7994 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7995 | return; |
| 7996 | } |
| 7997 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7998 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 7999 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8000 | pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid; |
| 8001 | pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length; |
| 8002 | pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8003 | pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length; |
| 8004 | pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8005 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, sizeof(tSirMacAddr)); |
| 8006 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8007 | pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8008 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) ) |
| 8009 | { |
| 8010 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED; |
| 8011 | pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq; |
| 8012 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 8013 | } |
| 8014 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 8015 | { |
| 8016 | vos_sleep( 100 ); |
| 8017 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta |
| 8018 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
| 8019 | } |
| 8020 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8021 | } |
| 8022 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8023 | default: |
| 8024 | csrRoamCheckForLinkStatusChange( pMac, pSirMsg ); |
| 8025 | break; |
| 8026 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8027 | } |
| 8028 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8029 | eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, |
| 8030 | tSirBssDescription *pBssDescription, |
| 8031 | tSirMacAddr *bssId, tANI_BOOLEAN addKey, |
| 8032 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 8033 | tANI_U8 keyId, tANI_U16 keyLength, |
| 8034 | tANI_U8 *pKey, tANI_U8 paeRole ) |
| 8035 | { |
| 8036 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8037 | tAniEdType edType; |
| 8038 | |
| 8039 | if(eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType) |
| 8040 | { |
| 8041 | EncryptType = eCSR_ENCRYPT_TYPE_NONE; //*** |
| 8042 | } |
| 8043 | |
| 8044 | edType = csrTranslateEncryptTypeToEdType( EncryptType ); |
| 8045 | |
| 8046 | // Allow 0 keys to be set for the non-WPA encrypt types... For WPA encrypt types, the num keys must be non-zero |
| 8047 | // or LIM will reject the set context (assumes the SET_CONTEXT does not occur until the keys are distrubuted). |
| 8048 | if ( CSR_IS_ENC_TYPE_STATIC( EncryptType ) || |
| 8049 | addKey ) |
| 8050 | { |
| 8051 | tCsrRoamSetKey setKey; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8052 | setKey.encType = EncryptType; |
| 8053 | setKey.keyDirection = aniKeyDirection; //Tx, Rx or Tx-and-Rx |
| 8054 | palCopyMemory( pMac->hHdd, &setKey.peerMac, bssId, sizeof(tCsrBssid) ); |
| 8055 | setKey.paeRole = paeRole; //0 for supplicant |
| 8056 | setKey.keyId = keyId; // Kye index |
| 8057 | setKey.keyLength = keyLength; |
| 8058 | if( keyLength ) |
| 8059 | { |
| 8060 | palCopyMemory( pMac->hHdd, setKey.Key, pKey, keyLength ); |
| 8061 | } |
| 8062 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, &setKey, 0 ); |
| 8063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8064 | return (status); |
| 8065 | } |
| 8066 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8067 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8068 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 8069 | { |
| 8070 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 8071 | tSmeCmd *pCommand = NULL; |
| 8072 | #ifdef FEATURE_WLAN_CCX |
| 8073 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8074 | #endif /* FEATURE_WLAN_CCX */ |
| 8075 | |
| 8076 | do |
| 8077 | { |
| 8078 | pCommand = csrGetCommandBuffer(pMac); |
| 8079 | if(NULL == pCommand) |
| 8080 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8081 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8082 | status = eHAL_STATUS_RESOURCES; |
| 8083 | break; |
| 8084 | } |
| 8085 | pCommand->command = eSmeCommandSetKey; |
| 8086 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8087 | // validate the key length, Adjust if too long... |
| 8088 | // for static WEP the keys are not set thru' SetContextReq |
| 8089 | if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || |
| 8090 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ) ) |
| 8091 | { |
| 8092 | //KeyLength maybe 0 for static WEP |
| 8093 | if( pSetKey->keyLength ) |
| 8094 | { |
| 8095 | if ( pSetKey->keyLength < CSR_WEP40_KEY_LEN ) |
| 8096 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8097 | smsLog( pMac, LOGW, "Invalid WEP40 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8098 | break; |
| 8099 | } |
| 8100 | |
| 8101 | pCommand->u.setKeyCmd.keyLength = CSR_WEP40_KEY_LEN; |
| 8102 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP40_KEY_LEN ); |
| 8103 | } |
| 8104 | } |
| 8105 | else if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || |
| 8106 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ) ) |
| 8107 | { |
| 8108 | //KeyLength maybe 0 for static WEP |
| 8109 | if( pSetKey->keyLength ) |
| 8110 | { |
| 8111 | if ( pSetKey->keyLength < CSR_WEP104_KEY_LEN ) |
| 8112 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8113 | smsLog( pMac, LOGW, "Invalid WEP104 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8114 | break; |
| 8115 | } |
| 8116 | |
| 8117 | pCommand->u.setKeyCmd.keyLength = CSR_WEP104_KEY_LEN; |
| 8118 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP104_KEY_LEN ); |
| 8119 | } |
| 8120 | } |
| 8121 | else if ( eCSR_ENCRYPT_TYPE_TKIP == pSetKey->encType ) |
| 8122 | { |
| 8123 | if ( pSetKey->keyLength < CSR_TKIP_KEY_LEN ) |
| 8124 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8125 | smsLog( pMac, LOGW, "Invalid TKIP keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8126 | break; |
| 8127 | } |
| 8128 | pCommand->u.setKeyCmd.keyLength = CSR_TKIP_KEY_LEN; |
| 8129 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_TKIP_KEY_LEN ); |
| 8130 | } |
| 8131 | else if ( eCSR_ENCRYPT_TYPE_AES == pSetKey->encType ) |
| 8132 | { |
| 8133 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 8134 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8135 | 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] | 8136 | break; |
| 8137 | } |
| 8138 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
| 8139 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN ); |
| 8140 | } |
| 8141 | #ifdef FEATURE_WLAN_WAPI |
| 8142 | else if ( eCSR_ENCRYPT_TYPE_WPI == pSetKey->encType ) |
| 8143 | { |
| 8144 | if ( pSetKey->keyLength < CSR_WAPI_KEY_LEN ) |
| 8145 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8146 | smsLog( pMac, LOGW, "Invalid WAPI keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8147 | break; |
| 8148 | } |
| 8149 | pCommand->u.setKeyCmd.keyLength = CSR_WAPI_KEY_LEN; |
| 8150 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WAPI_KEY_LEN ); |
| 8151 | } |
| 8152 | #endif /* FEATURE_WLAN_WAPI */ |
| 8153 | #ifdef FEATURE_WLAN_CCX |
| 8154 | else if ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 8155 | { |
| 8156 | if ( pSetKey->keyLength < CSR_KRK_KEY_LEN ) |
| 8157 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8158 | smsLog( pMac, LOGW, "Invalid KRK keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8159 | break; |
| 8160 | } |
| 8161 | palCopyMemory( pMac->hHdd, pSession->ccxCckmInfo.krk, pSetKey->Key, CSR_KRK_KEY_LEN ); |
| 8162 | pSession->ccxCckmInfo.reassoc_req_num=1; |
| 8163 | pSession->ccxCckmInfo.krk_plumbed = eANI_BOOLEAN_TRUE; |
| 8164 | status = eHAL_STATUS_SUCCESS; |
| 8165 | break; |
| 8166 | } |
| 8167 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8168 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8169 | #ifdef WLAN_FEATURE_11W |
| 8170 | //Check for 11w BIP |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8171 | else if (eCSR_ENCRYPT_TYPE_AES_CMAC == pSetKey->encType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8172 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8173 | if (pSetKey->keyLength < CSR_AES_KEY_LEN) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8174 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8175 | 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] | 8176 | break; |
| 8177 | } |
| 8178 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8179 | 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] | 8180 | } |
| 8181 | #endif |
| 8182 | status = eHAL_STATUS_SUCCESS; |
| 8183 | pCommand->u.setKeyCmd.roamId = roamId; |
| 8184 | pCommand->u.setKeyCmd.encType = pSetKey->encType; |
| 8185 | pCommand->u.setKeyCmd.keyDirection = pSetKey->keyDirection; //Tx, Rx or Tx-and-Rx |
| 8186 | palCopyMemory( pMac->hHdd, &pCommand->u.setKeyCmd.peerMac, &pSetKey->peerMac, sizeof(tCsrBssid) ); |
| 8187 | pCommand->u.setKeyCmd.paeRole = pSetKey->paeRole; //0 for supplicant |
| 8188 | pCommand->u.setKeyCmd.keyId = pSetKey->keyId; |
| 8189 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.keyRsc, pSetKey->keyRsc, CSR_MAX_RSC_LEN ); |
| 8190 | //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 |
| 8191 | |
| 8192 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 8193 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8194 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8195 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8196 | } |
| 8197 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8198 | // Free the command if there has been a failure, or it is a |
| 8199 | // "local" operation like the set CCX CCKM KRK key. |
Jeff Johnson | 74b3ec5 | 2013-04-03 13:45:51 -0700 | [diff] [blame] | 8200 | if ( ( NULL != pCommand ) && |
| 8201 | ( (!HAL_STATUS_SUCCESS( status ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8202 | #ifdef FEATURE_WLAN_CCX |
| 8203 | || ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 8204 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 74b3ec5 | 2013-04-03 13:45:51 -0700 | [diff] [blame] | 8205 | ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8206 | { |
| 8207 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 8208 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8209 | return( status ); |
| 8210 | } |
| 8211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8212 | eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8213 | tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId ) |
| 8214 | { |
| 8215 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 8216 | tSmeCmd *pCommand = NULL; |
| 8217 | tANI_BOOLEAN fImediate = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8218 | do |
| 8219 | { |
| 8220 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8221 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8222 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8223 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8224 | break; |
| 8225 | } |
| 8226 | pCommand = csrGetCommandBuffer(pMac); |
| 8227 | if(NULL == pCommand) |
| 8228 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8229 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8230 | status = eHAL_STATUS_RESOURCES; |
| 8231 | break; |
| 8232 | } |
| 8233 | pCommand->command = eSmeCommandRemoveKey; |
| 8234 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8235 | pCommand->u.removeKeyCmd.roamId = roamId; |
| 8236 | pCommand->u.removeKeyCmd.encType = pRemoveKey->encType; |
| 8237 | palCopyMemory( pMac->hHdd, &pCommand->u.removeKeyCmd.peerMac, &pRemoveKey->peerMac, sizeof(tSirMacAddr) ); |
| 8238 | pCommand->u.removeKeyCmd.keyId = pRemoveKey->keyId; |
| 8239 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8240 | { |
| 8241 | //in this case, put it to the end of the Q incase there is a set key pending. |
| 8242 | fImediate = eANI_BOOLEAN_FALSE; |
| 8243 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8244 | 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] | 8245 | pRemoveKey->encType, pRemoveKey->keyId, |
| 8246 | pCommand->u.removeKeyCmd.peerMac[0], |
| 8247 | pCommand->u.removeKeyCmd.peerMac[1], |
| 8248 | pCommand->u.removeKeyCmd.peerMac[2], |
| 8249 | pCommand->u.removeKeyCmd.peerMac[3], |
| 8250 | pCommand->u.removeKeyCmd.peerMac[4], |
| 8251 | pCommand->u.removeKeyCmd.peerMac[5]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8252 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 8253 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8254 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8255 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8256 | break; |
| 8257 | } |
| 8258 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8259 | if( !HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand ) ) |
| 8260 | { |
| 8261 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 8262 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8263 | return (status ); |
| 8264 | } |
| 8265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8266 | eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8267 | { |
| 8268 | eHalStatus status; |
| 8269 | tANI_U8 numKeys = ( pCommand->u.setKeyCmd.keyLength ) ? 1 : 0; |
| 8270 | tAniEdType edType = csrTranslateEncryptTypeToEdType( pCommand->u.setKeyCmd.encType ); |
| 8271 | tANI_BOOLEAN fUnicast = ( pCommand->u.setKeyCmd.peerMac[0] == 0xFF ) ? eANI_BOOLEAN_FALSE : eANI_BOOLEAN_TRUE; |
| 8272 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8273 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8274 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8275 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8276 | if(eSIR_ED_NONE != edType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8277 | { |
| 8278 | palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8279 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 8280 | { |
| 8281 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ; |
| 8282 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 8283 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8284 | } |
| 8285 | else |
| 8286 | { |
| 8287 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_REQ; |
| 8288 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 8289 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8290 | } |
| 8291 | palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8292 | if(CSR_IS_ENC_TYPE_STATIC(pCommand->u.setKeyCmd.encType)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8293 | { |
| 8294 | tANI_U32 defKeyId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8295 | //It has to be static WEP here |
| 8296 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, &defKeyId))) |
| 8297 | { |
| 8298 | setKeyEvent.keyId = (v_U8_t)defKeyId; |
| 8299 | } |
| 8300 | } |
| 8301 | else |
| 8302 | { |
| 8303 | setKeyEvent.keyId = pCommand->u.setKeyCmd.keyId; |
| 8304 | } |
| 8305 | setKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8306 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8307 | } |
| 8308 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8309 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8310 | { |
| 8311 | status = csrSendMBSetContextReqMsg( pMac, sessionId, |
| 8312 | ( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac, |
| 8313 | numKeys, edType, fUnicast, pCommand->u.setKeyCmd.keyDirection, |
| 8314 | pCommand->u.setKeyCmd.keyId, pCommand->u.setKeyCmd.keyLength, |
| 8315 | pCommand->u.setKeyCmd.Key, pCommand->u.setKeyCmd.paeRole, |
| 8316 | pCommand->u.setKeyCmd.keyRsc); |
| 8317 | } |
| 8318 | else |
| 8319 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8320 | smsLog( pMac, LOGW, FL(" cannot process not connected") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8321 | //Set this status so the error handling take care of the case. |
| 8322 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8323 | } |
| 8324 | if( !HAL_STATUS_SUCCESS(status) ) |
| 8325 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8326 | smsLog( pMac, LOGE, FL(" error status %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8327 | 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] | 8328 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8329 | if(eSIR_ED_NONE != edType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8330 | { |
| 8331 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 8332 | { |
| 8333 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 8334 | } |
| 8335 | else |
| 8336 | { |
| 8337 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 8338 | } |
| 8339 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 8340 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8341 | } |
| 8342 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8343 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8344 | return ( status ); |
| 8345 | } |
| 8346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8347 | eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8348 | { |
| 8349 | eHalStatus status; |
| 8350 | tpSirSmeRemoveKeyReq pMsg = NULL; |
| 8351 | tANI_U16 wMsgLen = sizeof(tSirSmeRemoveKeyReq); |
| 8352 | tANI_U8 *p; |
| 8353 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8354 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8355 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8356 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8357 | palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8358 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_REQ; |
| 8359 | removeKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8360 | removeKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8361 | palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 8362 | removeKeyEvent.keyId = pCommand->u.removeKeyCmd.keyId; |
| 8363 | removeKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8364 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8365 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8366 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8367 | { |
| 8368 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, wMsgLen ); |
| 8369 | } |
| 8370 | else |
| 8371 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8372 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8373 | //Set the error status so error handling kicks in below |
| 8374 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8375 | } |
| 8376 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8377 | { |
| 8378 | palZeroMemory(pMac->hHdd, pMsg, wMsgLen); |
| 8379 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REMOVEKEY_REQ); |
| 8380 | pMsg->length = pal_cpu_to_be16(wMsgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8381 | pMsg->sessionId = (tANI_U8)sessionId; |
| 8382 | pMsg->transactionId = 0; |
| 8383 | p = (tANI_U8 *)pMsg + sizeof(pMsg->messageType) + sizeof(pMsg->length) + |
| 8384 | sizeof(pMsg->sessionId) + sizeof(pMsg->transactionId); |
| 8385 | // bssId - copy from session Info |
| 8386 | palCopyMemory( pMac->hHdd, p, &pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 8387 | p += sizeof(tSirMacAddr); |
| 8388 | // peerMacAddr |
| 8389 | palCopyMemory( pMac->hHdd, p, pCommand->u.removeKeyCmd.peerMac, sizeof(tSirMacAddr) ); |
| 8390 | p += sizeof(tSirMacAddr); |
| 8391 | // edType |
| 8392 | *p = (tANI_U8)csrTranslateEncryptTypeToEdType( pCommand->u.removeKeyCmd.encType ); |
| 8393 | p++; |
| 8394 | // weptype |
| 8395 | if( ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pCommand->u.removeKeyCmd.encType ) || |
| 8396 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pCommand->u.removeKeyCmd.encType ) ) |
| 8397 | { |
| 8398 | *p = (tANI_U8)eSIR_WEP_STATIC; |
| 8399 | } |
| 8400 | else |
| 8401 | { |
| 8402 | *p = (tANI_U8)eSIR_WEP_DYNAMIC; |
| 8403 | } |
| 8404 | p++; |
| 8405 | //keyid |
| 8406 | *p = pCommand->u.removeKeyCmd.keyId; |
| 8407 | p++; |
| 8408 | *p = (pCommand->u.removeKeyCmd.peerMac[0] == 0xFF ) ? 0 : 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8409 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 8410 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8411 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8412 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8413 | smsLog( pMac, LOGE, FL(" error status "), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8414 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8415 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 8416 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8417 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8418 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8419 | csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.removeKeyCmd.roamId, eCSR_ROAM_REMOVE_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE); |
| 8420 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8421 | return ( status ); |
| 8422 | } |
| 8423 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8424 | eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 8425 | { |
| 8426 | eHalStatus status; |
| 8427 | |
| 8428 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8429 | { |
| 8430 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8431 | } |
| 8432 | else |
| 8433 | { |
| 8434 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, pSetKey, roamId ); |
| 8435 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8436 | return ( status ); |
| 8437 | } |
| 8438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8439 | /* |
| 8440 | Prepare a filter base on a profile for parsing the scan results. |
| 8441 | Upon successful return, caller MUST call csrFreeScanFilter on |
| 8442 | pScanFilter when it is done with the filter. |
| 8443 | */ |
| 8444 | eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 8445 | tCsrScanResultFilter *pScanFilter) |
| 8446 | { |
| 8447 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8448 | tANI_U32 size = 0; |
| 8449 | tANI_U8 index = 0; |
| 8450 | |
| 8451 | do |
| 8452 | { |
| 8453 | if(pProfile->BSSIDs.numOfBSSIDs) |
| 8454 | { |
| 8455 | size = sizeof(tCsrBssid) * pProfile->BSSIDs.numOfBSSIDs; |
| 8456 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, size); |
| 8457 | if(!HAL_STATUS_SUCCESS(status)) |
| 8458 | { |
| 8459 | break; |
| 8460 | } |
| 8461 | pScanFilter->BSSIDs.numOfBSSIDs = pProfile->BSSIDs.numOfBSSIDs; |
| 8462 | palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, pProfile->BSSIDs.bssid, size); |
| 8463 | } |
| 8464 | if(pProfile->SSIDs.numOfSSIDs) |
| 8465 | { |
| 8466 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 8467 | { |
| 8468 | pScanFilter->SSIDs.numOfSSIDs = pProfile->SSIDs.numOfSSIDs; |
| 8469 | } |
| 8470 | else |
| 8471 | { |
| 8472 | //For WDS station |
| 8473 | //We always use index 1 for self SSID. Index 0 for peer's SSID that we want to join |
| 8474 | pScanFilter->SSIDs.numOfSSIDs = 1; |
| 8475 | } |
| 8476 | size = sizeof(tCsrSSIDInfo) * pProfile->SSIDs.numOfSSIDs; |
| 8477 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, size); |
| 8478 | if(!HAL_STATUS_SUCCESS(status)) |
| 8479 | { |
| 8480 | break; |
| 8481 | } |
| 8482 | palCopyMemory(pMac->hHdd, pScanFilter->SSIDs.SSIDList, pProfile->SSIDs.SSIDList, size); |
| 8483 | } |
| 8484 | if(!pProfile->ChannelInfo.ChannelList || (pProfile->ChannelInfo.ChannelList[0] == 0) ) |
| 8485 | { |
| 8486 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8487 | pScanFilter->ChannelInfo.ChannelList = NULL; |
| 8488 | } |
| 8489 | else if(pProfile->ChannelInfo.numOfChannels) |
| 8490 | { |
| 8491 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->ChannelInfo.ChannelList, sizeof(*pScanFilter->ChannelInfo.ChannelList) * pProfile->ChannelInfo.numOfChannels); |
| 8492 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8493 | if(HAL_STATUS_SUCCESS(status)) |
| 8494 | { |
| 8495 | for(index = 0; index < pProfile->ChannelInfo.numOfChannels; index++) |
| 8496 | { |
| 8497 | if(csrRoamIsChannelValid(pMac, pProfile->ChannelInfo.ChannelList[index])) |
| 8498 | { |
| 8499 | pScanFilter->ChannelInfo.ChannelList[pScanFilter->ChannelInfo.numOfChannels] |
| 8500 | = pProfile->ChannelInfo.ChannelList[index]; |
| 8501 | pScanFilter->ChannelInfo.numOfChannels++; |
| 8502 | } |
| 8503 | else |
| 8504 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8505 | 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] | 8506 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8507 | } |
| 8508 | } |
| 8509 | else |
| 8510 | { |
| 8511 | break; |
| 8512 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8513 | } |
| 8514 | else |
| 8515 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8516 | smsLog(pMac, LOGW, FL("Channel list empty")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8517 | status = eHAL_STATUS_FAILURE; |
| 8518 | break; |
| 8519 | } |
| 8520 | pScanFilter->uapsd_mask = pProfile->uapsd_mask; |
| 8521 | pScanFilter->authType = pProfile->AuthType; |
| 8522 | pScanFilter->EncryptionType = pProfile->EncryptionType; |
| 8523 | pScanFilter->mcEncryptionType = pProfile->mcEncryptionType; |
| 8524 | pScanFilter->BSSType = pProfile->BSSType; |
| 8525 | pScanFilter->phyMode = pProfile->phyMode; |
| 8526 | #ifdef FEATURE_WLAN_WAPI |
| 8527 | //check if user asked for WAPI with 11n or auto mode, in that case modify |
| 8528 | //the phymode to 11g |
| 8529 | if(csrIsProfileWapi(pProfile)) |
| 8530 | { |
| 8531 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_11n) |
| 8532 | { |
| 8533 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 8534 | } |
| 8535 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_AUTO) |
| 8536 | { |
| 8537 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_AUTO; |
| 8538 | } |
| 8539 | if(!pScanFilter->phyMode) |
| 8540 | { |
| 8541 | pScanFilter->phyMode = eCSR_DOT11_MODE_11g; |
| 8542 | } |
| 8543 | } |
| 8544 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8545 | /*Save the WPS info*/ |
| 8546 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8547 | if( pProfile->countryCode[0] ) |
| 8548 | { |
| 8549 | //This causes the matching function to use countryCode as one of the criteria. |
| 8550 | palCopyMemory( pMac->hHdd, pScanFilter->countryCode, pProfile->countryCode, |
| 8551 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 8552 | } |
| 8553 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8554 | if (pProfile->MDID.mdiePresent) |
| 8555 | { |
| 8556 | pScanFilter->MDID.mdiePresent = 1; |
| 8557 | pScanFilter->MDID.mobilityDomain = pProfile->MDID.mobilityDomain; |
| 8558 | } |
| 8559 | #endif |
| 8560 | |
| 8561 | }while(0); |
| 8562 | |
| 8563 | if(!HAL_STATUS_SUCCESS(status)) |
| 8564 | { |
| 8565 | csrFreeScanFilter(pMac, pScanFilter); |
| 8566 | } |
| 8567 | |
| 8568 | return(status); |
| 8569 | } |
| 8570 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8571 | tANI_BOOLEAN csrRoamIssueWmStatusChange( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8572 | eCsrRoamWmStatusChangeTypes Type, tSirSmeRsp *pSmeRsp ) |
| 8573 | { |
| 8574 | tANI_BOOLEAN fCommandQueued = eANI_BOOLEAN_FALSE; |
| 8575 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8576 | do |
| 8577 | { |
| 8578 | // Validate the type is ok... |
| 8579 | if ( ( eCsrDisassociated != Type ) && ( eCsrDeauthenticated != Type ) ) break; |
| 8580 | pCommand = csrGetCommandBuffer( pMac ); |
| 8581 | if ( !pCommand ) |
| 8582 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8583 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8584 | break; |
| 8585 | } |
| 8586 | //Change the substate in case it is waiting for key |
| 8587 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8588 | { |
| 8589 | csrRoamStopWaitForKeyTimer( pMac ); |
| 8590 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 8591 | } |
| 8592 | pCommand->command = eSmeCommandWmStatusChange; |
| 8593 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8594 | pCommand->u.wmStatusChangeCmd.Type = Type; |
| 8595 | if ( eCsrDisassociated == Type ) |
| 8596 | { |
| 8597 | palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg, pSmeRsp, |
| 8598 | sizeof( pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg ) ); |
| 8599 | } |
| 8600 | else |
| 8601 | { |
| 8602 | palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg, pSmeRsp, |
| 8603 | sizeof( pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg ) ); |
| 8604 | } |
| 8605 | if( HAL_STATUS_SUCCESS( csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE) ) ) |
| 8606 | { |
| 8607 | fCommandQueued = eANI_BOOLEAN_TRUE; |
| 8608 | } |
| 8609 | else |
| 8610 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8611 | smsLog( pMac, LOGE, FL(" fail to send message ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8612 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 8613 | } |
| 8614 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8615 | /* AP has issued Dissac/Deauth, Set the operating mode value to configured value */ |
| 8616 | csrSetDefaultDot11Mode( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8617 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8618 | return( fCommandQueued ); |
| 8619 | } |
| 8620 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8621 | static void csrUpdateRssi(tpAniSirGlobal pMac, void* pMsg) |
| 8622 | { |
| 8623 | v_S7_t rssi = 0; |
| 8624 | tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq*)pMsg; |
| 8625 | if(pGetRssiReq) |
| 8626 | { |
| 8627 | if(NULL != pGetRssiReq->pVosContext) |
| 8628 | { |
| 8629 | WLANTL_GetRssi(pGetRssiReq->pVosContext, pGetRssiReq->staId, &rssi); |
| 8630 | } |
| 8631 | else |
| 8632 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8633 | smsLog( pMac, LOGE, FL("pGetRssiReq->pVosContext is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8634 | return; |
| 8635 | } |
| 8636 | |
| 8637 | if(NULL != pGetRssiReq->rssiCallback) |
| 8638 | { |
| 8639 | ((tCsrRssiCallback)(pGetRssiReq->rssiCallback))(rssi, pGetRssiReq->staId, pGetRssiReq->pDevContext); |
| 8640 | } |
| 8641 | else |
| 8642 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8643 | smsLog( pMac, LOGE, FL("pGetRssiReq->rssiCallback is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8644 | return; |
| 8645 | } |
| 8646 | } |
| 8647 | else |
| 8648 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8649 | smsLog( pMac, LOGE, FL("pGetRssiReq is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8650 | } |
| 8651 | return; |
| 8652 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8653 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 8654 | void csrRoamRssiRspProcessor(tpAniSirGlobal pMac, void* pMsg) |
| 8655 | { |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8656 | tAniGetRoamRssiRsp* pRoamRssiRsp = (tAniGetRoamRssiRsp*)pMsg; |
| 8657 | |
Jeff Johnson | 36d483b | 2013-04-08 11:08:53 -0700 | [diff] [blame] | 8658 | if (NULL != pRoamRssiRsp) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8659 | { |
Jeff Johnson | 36d483b | 2013-04-08 11:08:53 -0700 | [diff] [blame] | 8660 | /* Get roam Rssi request is backed up and passed back to the response, |
| 8661 | Extract the request message to fetch callback */ |
| 8662 | tpAniGetRssiReq reqBkp = (tAniGetRssiReq*)pRoamRssiRsp->rssiReq; |
| 8663 | v_S7_t rssi = pRoamRssiRsp->rssi; |
| 8664 | |
| 8665 | if ((NULL != reqBkp) && (NULL != reqBkp->rssiCallback)) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8666 | { |
| 8667 | ((tCsrRssiCallback)(reqBkp->rssiCallback))(rssi, pRoamRssiRsp->staId, reqBkp->pDevContext); |
| 8668 | reqBkp->rssiCallback = NULL; |
| 8669 | vos_mem_free(reqBkp); |
| 8670 | } |
| 8671 | else |
| 8672 | { |
| 8673 | smsLog( pMac, LOGE, FL("reqBkp->rssiCallback is NULL")); |
| 8674 | if (NULL != reqBkp) |
| 8675 | { |
| 8676 | vos_mem_free(reqBkp); |
| 8677 | } |
| 8678 | } |
| 8679 | } |
| 8680 | else |
| 8681 | { |
| 8682 | smsLog( pMac, LOGE, FL("pRoamRssiRsp is NULL")); |
| 8683 | } |
| 8684 | return; |
| 8685 | } |
| 8686 | #endif |
| 8687 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8688 | static void csrRoamRssiIndHdlr(tpAniSirGlobal pMac, void* pMsg) |
| 8689 | { |
| 8690 | WLANTL_TlIndicationReq *pTlRssiInd = (WLANTL_TlIndicationReq*)pMsg; |
| 8691 | if(pTlRssiInd) |
| 8692 | { |
| 8693 | if(NULL != pTlRssiInd->tlCallback) |
| 8694 | { |
| 8695 | ((WLANTL_RSSICrossThresholdCBType)(pTlRssiInd->tlCallback)) |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 8696 | (pTlRssiInd->pAdapter, pTlRssiInd->rssiNotification, pTlRssiInd->pUserCtxt, pTlRssiInd->avgRssi); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8697 | } |
| 8698 | else |
| 8699 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8700 | smsLog( pMac, LOGE, FL("pTlRssiInd->tlCallback is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8701 | } |
| 8702 | } |
| 8703 | else |
| 8704 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8705 | smsLog( pMac, LOGE, FL("pTlRssiInd is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8706 | } |
| 8707 | return; |
| 8708 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8709 | |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 8710 | eHalStatus csrSendResetApCapsChanged(tpAniSirGlobal pMac, tSirMacAddr *bssId) |
| 8711 | { |
| 8712 | tpSirResetAPCapsChange pMsg; |
| 8713 | tANI_U16 len; |
| 8714 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8715 | |
| 8716 | /* Create the message and send to lim */ |
| 8717 | len = sizeof(tSirResetAPCapsChange); |
| 8718 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len ); |
| 8719 | if (HAL_STATUS_SUCCESS(status)) |
| 8720 | { |
| 8721 | palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirResetAPCapsChange) ); |
| 8722 | pMsg->messageType = eWNI_SME_RESET_AP_CAPS_CHANGED; |
| 8723 | pMsg->length = len; |
| 8724 | palCopyMemory( pMac->hHdd, pMsg->bssId, bssId, sizeof(tSirMacAddr) ); |
| 8725 | smsLog( pMac, LOG1, FL("CSR reset caps change for Bssid= %02x-%02x-%02x-%02x-%02x-%02x"), |
| 8726 | pMsg->bssId[ 0 ], pMsg->bssId[ 1 ], pMsg->bssId[ 2 ], |
| 8727 | pMsg->bssId[ 3 ], pMsg->bssId[ 4 ], pMsg->bssId[ 5 ]); |
| 8728 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 8729 | } |
| 8730 | else |
| 8731 | { |
| 8732 | smsLog( pMac, LOGE, FL("Memory allocation failed\n")); |
| 8733 | } |
| 8734 | return status; |
| 8735 | } |
| 8736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8737 | void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) |
| 8738 | { |
| 8739 | tSirSmeAssocInd *pAssocInd; |
| 8740 | tSirSmeDisassocInd *pDisassocInd; |
| 8741 | tSirSmeDeauthInd *pDeauthInd; |
| 8742 | tSirSmeWmStatusChangeNtf *pStatusChangeMsg; |
| 8743 | tSirSmeNewBssInfo *pNewBss; |
| 8744 | tSmeIbssPeerInd *pIbssPeerInd; |
| 8745 | tSirMacAddr Broadcastaddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 8746 | tSirSmeApNewCaps *pApNewCaps; |
| 8747 | eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; |
| 8748 | eRoamCmdStatus roamStatus = eCSR_ROAM_FAILED; |
| 8749 | tCsrRoamInfo *pRoamInfo = NULL; |
| 8750 | tCsrRoamInfo roamInfo; |
| 8751 | eHalStatus status; |
| 8752 | tANI_U32 sessionId = CSR_SESSION_ID_INVALID; |
| 8753 | tCsrRoamSession *pSession = NULL; |
| 8754 | tpSirSmeSwitchChannelInd pSwitchChnInd; |
| 8755 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 8756 | tSmeCmd pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8757 | pSirMsg->messageType = (pSirMsg->messageType); |
| 8758 | pSirMsg->length = (pSirMsg->length); |
| 8759 | pSirMsg->statusCode = (pSirMsg->statusCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8760 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8761 | switch( pSirMsg->messageType ) |
| 8762 | { |
| 8763 | case eWNI_SME_ASSOC_IND: |
| 8764 | { |
| 8765 | tCsrRoamSession *pSession; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8766 | smsLog( pMac, LOG1, FL("ASSOCIATION Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8767 | pAssocInd = (tSirSmeAssocInd *)pSirMsg; |
| 8768 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pAssocInd->bssId, &sessionId ); |
| 8769 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8770 | { |
| 8771 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8772 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8773 | if(!pSession) |
| 8774 | { |
| 8775 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8776 | return; |
| 8777 | } |
| 8778 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8779 | pRoamInfo = &roamInfo; |
| 8780 | |
| 8781 | // Required for indicating the frames to upper layer |
| 8782 | pRoamInfo->assocReqLength = pAssocInd->assocReqLength; |
| 8783 | pRoamInfo->assocReqPtr = pAssocInd->assocReqPtr; |
| 8784 | |
| 8785 | pRoamInfo->beaconPtr = pAssocInd->beaconPtr; |
| 8786 | pRoamInfo->beaconLength = pAssocInd->beaconLength; |
| 8787 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 8788 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8789 | |
| 8790 | pRoamInfo->staId = (tANI_U8)pAssocInd->staId; |
| 8791 | pRoamInfo->rsnIELen = (tANI_U8)pAssocInd->rsnIE.length; |
| 8792 | pRoamInfo->prsnIE = pAssocInd->rsnIE.rsnIEdata; |
| 8793 | |
| 8794 | pRoamInfo->addIELen = (tANI_U8)pAssocInd->addIE.length; |
| 8795 | pRoamInfo->paddIE = pAssocInd->addIE.addIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8796 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8797 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pAssocInd->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8798 | pRoamInfo->wmmEnabledSta = pAssocInd->wmmEnabledSta; |
| 8799 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8800 | 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] | 8801 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile)) |
| 8802 | { |
| 8803 | if( CSR_IS_ENC_TYPE_STATIC( pSession->pCurRoamProfile->negotiatedUCEncryptionType )) |
| 8804 | { |
| 8805 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->pCurRoamProfile->negotiatedUCEncryptionType, |
| 8806 | pSession->pConnectBssDesc, |
| 8807 | &(pRoamInfo->peerMac), |
| 8808 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 8809 | pRoamInfo->fAuthRequired = FALSE; |
| 8810 | } |
| 8811 | else |
| 8812 | { |
| 8813 | pRoamInfo->fAuthRequired = TRUE; |
| 8814 | } |
| 8815 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND); |
| 8816 | if (!HAL_STATUS_SUCCESS(status)) |
| 8817 | pRoamInfo->statusCode = eSIR_SME_ASSOC_REFUSED;// Refused due to Mac filtering |
| 8818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8819 | /* Send Association completion message to PE */ |
| 8820 | status = csrSendAssocCnfMsg( pMac, pAssocInd, status );//Sta |
| 8821 | |
| 8822 | /* send a message to CSR itself just to avoid the EAPOL frames going |
| 8823 | * OTA before association response */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8824 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 8825 | { |
| 8826 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 8827 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8828 | else if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) && (pRoamInfo->statusCode != eSIR_SME_ASSOC_REFUSED)) |
| 8829 | { |
| 8830 | pRoamInfo->fReassocReq = pAssocInd->reassocReq; |
| 8831 | //status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 8832 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 8833 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8834 | } |
| 8835 | } |
| 8836 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8837 | case eWNI_SME_DISASSOC_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8838 | smsLog( pMac, LOGE, FL("DISASSOCIATION Indication from MAC")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8839 | // Check if AP dis-associated us because of MIC failure. If so, |
| 8840 | // then we need to take action immediately and not wait till the |
| 8841 | // the WmStatusChange requests is pushed and processed |
| 8842 | pDisassocInd = (tSirSmeDisassocInd *)pSirMsg; |
| 8843 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDisassocInd->bssId, &sessionId ); |
| 8844 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8845 | { |
| 8846 | // If we are in neighbor preauth done state then on receiving |
| 8847 | // disassoc or deauth we dont roam instead we just disassoc |
| 8848 | // from current ap and then go to disconnected state |
| 8849 | // This happens for CCX and 11r FT connections ONLY. |
| 8850 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8851 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8852 | { |
| 8853 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8854 | } |
| 8855 | #endif |
| 8856 | #ifdef FEATURE_WLAN_CCX |
| 8857 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8858 | { |
| 8859 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8860 | } |
| 8861 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8862 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 8863 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8864 | { |
| 8865 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8866 | } |
| 8867 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8868 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8869 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8870 | if(!pSession) |
| 8871 | { |
| 8872 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8873 | return; |
| 8874 | } |
| 8875 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8876 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 8877 | { |
| 8878 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8879 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8880 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 8881 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 8882 | #endif |
| 8883 | csrRoamLinkDown(pMac, sessionId); |
| 8884 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDisassociated, pSirMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8885 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 8886 | { |
| 8887 | |
| 8888 | pRoamInfo = &roamInfo; |
| 8889 | |
| 8890 | pRoamInfo->statusCode = pDisassocInd->statusCode; |
| 8891 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8892 | |
| 8893 | pRoamInfo->staId = (tANI_U8)pDisassocInd->staId; |
| 8894 | |
| 8895 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8896 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDisassocInd->bssId, sizeof(tCsrBssid)); |
| 8897 | |
| 8898 | 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] | 8899 | |
| 8900 | /* |
| 8901 | * STA/P2P client got disassociated so remove any pending deauth |
| 8902 | * commands in sme pending list |
| 8903 | */ |
| 8904 | pCommand.command = eSmeCommandRoam; |
| 8905 | pCommand.sessionId = (tANI_U8)sessionId; |
| 8906 | pCommand.u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 8907 | vos_mem_copy(pCommand.u.roamCmd.peerMac, pDisassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8908 | csrRoamRemoveDuplicateCommand(pMac, sessionId, &pCommand, eCsrForcedDeauthSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8909 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8910 | } |
| 8911 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8912 | case eWNI_SME_DEAUTH_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8913 | smsLog( pMac, LOG1, FL("DEAUTHENTICATION Indication from MAC")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8914 | pDeauthInd = (tpSirSmeDeauthInd)pSirMsg; |
| 8915 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDeauthInd->bssId, &sessionId ); |
| 8916 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8917 | { |
| 8918 | // If we are in neighbor preauth done state then on receiving |
| 8919 | // disassoc or deauth we dont roam instead we just disassoc |
| 8920 | // from current ap and then go to disconnected state |
| 8921 | // This happens for CCX and 11r FT connections ONLY. |
| 8922 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8923 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8924 | { |
| 8925 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8926 | } |
| 8927 | #endif |
| 8928 | #ifdef FEATURE_WLAN_CCX |
| 8929 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8930 | { |
| 8931 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8932 | } |
| 8933 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8934 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 8935 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8936 | { |
| 8937 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8938 | } |
| 8939 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8940 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8941 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8942 | if(!pSession) |
| 8943 | { |
| 8944 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8945 | return; |
| 8946 | } |
| 8947 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8948 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 8949 | { |
| 8950 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8951 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8952 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 8953 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 8954 | #endif |
| 8955 | csrRoamLinkDown(pMac, sessionId); |
| 8956 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDeauthenticated, pSirMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8957 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 8958 | { |
| 8959 | |
| 8960 | pRoamInfo = &roamInfo; |
| 8961 | |
| 8962 | pRoamInfo->statusCode = pDeauthInd->statusCode; |
| 8963 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8964 | |
| 8965 | pRoamInfo->staId = (tANI_U8)pDeauthInd->staId; |
| 8966 | |
| 8967 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8968 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDeauthInd->bssId, sizeof(tCsrBssid)); |
| 8969 | |
| 8970 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DEAUTH_IND); |
| 8971 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8972 | } |
| 8973 | break; |
| 8974 | |
| 8975 | 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] | 8976 | smsLog( pMac, LOGW, FL("eWNI_SME_SWITCH_CHL_REQ from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8977 | pSwitchChnInd = (tpSirSmeSwitchChannelInd)pSirMsg; |
| 8978 | //Update with the new channel id. |
| 8979 | //The channel id is hidden in the statusCode. |
| 8980 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pSwitchChnInd->bssId, &sessionId ); |
| 8981 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8982 | { |
| 8983 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8984 | if(!pSession) |
| 8985 | { |
| 8986 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8987 | return; |
| 8988 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8989 | pSession->connectedProfile.operationChannel = (tANI_U8)pSwitchChnInd->newChannelId; |
| 8990 | if(pSession->pConnectBssDesc) |
| 8991 | { |
| 8992 | pSession->pConnectBssDesc->channelId = (tANI_U8)pSwitchChnInd->newChannelId; |
| 8993 | } |
| 8994 | } |
| 8995 | break; |
| 8996 | |
| 8997 | case eWNI_SME_DEAUTH_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8998 | smsLog( pMac, LOGW, FL("eWNI_SME_DEAUTH_RSP from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8999 | { |
| 9000 | tSirSmeDeauthRsp* pDeauthRsp = (tSirSmeDeauthRsp *)pSirMsg; |
| 9001 | sessionId = pDeauthRsp->sessionId; |
| 9002 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 9003 | { |
| 9004 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9005 | if(!pSession) |
| 9006 | { |
| 9007 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9008 | return; |
| 9009 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9010 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 9011 | { |
| 9012 | pRoamInfo = &roamInfo; |
| 9013 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9014 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthRsp->peerMacAddr, sizeof(tSirMacAddr)); |
| 9015 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 9016 | pRoamInfo->statusCode = pDeauthRsp->statusCode; |
| 9017 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 9018 | } |
| 9019 | } |
| 9020 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9021 | break; |
| 9022 | |
| 9023 | case eWNI_SME_DISASSOC_RSP: |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9024 | /* 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] | 9025 | smsLog( pMac, LOGW, FL("eWNI_SME_DISASSOC_RSP from SME ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9026 | { |
| 9027 | tSirSmeDisassocRsp *pDisassocRsp = (tSirSmeDisassocRsp *)pSirMsg; |
| 9028 | sessionId = pDisassocRsp->sessionId; |
| 9029 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 9030 | { |
| 9031 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9032 | if(!pSession) |
| 9033 | { |
| 9034 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9035 | return; |
| 9036 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9037 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 9038 | { |
| 9039 | pRoamInfo = &roamInfo; |
| 9040 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9041 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocRsp->peerMacAddr, sizeof(tSirMacAddr)); |
| 9042 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 9043 | pRoamInfo->statusCode = pDisassocRsp->statusCode; |
| 9044 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 9045 | } |
| 9046 | } |
| 9047 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9048 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9049 | case eWNI_SME_MIC_FAILURE_IND: |
| 9050 | { |
| 9051 | tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg; |
| 9052 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 9053 | eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9054 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9055 | { |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9056 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9057 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9058 | if(!pSession) |
| 9059 | { |
| 9060 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9061 | return; |
| 9062 | } |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9063 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9064 | palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 9065 | secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR; |
| 9066 | secEvent.encryptionModeMulticast = |
| 9067 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9068 | secEvent.encryptionModeUnicast = |
| 9069 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9070 | secEvent.authMode = |
| 9071 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 9072 | palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 9073 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 9074 | } |
| 9075 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9076 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pMicInd->bssId, &sessionId ); |
| 9077 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9078 | { |
| 9079 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 9080 | roamInfo.u.pMICFailureInfo = &pMicInd->info; |
| 9081 | pRoamInfo = &roamInfo; |
| 9082 | if(pMicInd->info.multicast) |
| 9083 | { |
| 9084 | result = eCSR_ROAM_RESULT_MIC_ERROR_GROUP; |
| 9085 | } |
| 9086 | else |
| 9087 | { |
| 9088 | result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
| 9089 | } |
| 9090 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_MIC_ERROR_IND, result); |
| 9091 | } |
| 9092 | } |
| 9093 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9094 | case eWNI_SME_WPS_PBC_PROBE_REQ_IND: |
| 9095 | { |
| 9096 | tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd)pSirMsg; |
| 9097 | tCsrRoamInfo roamInfo; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9098 | smsLog( pMac, LOG1, FL("WPS PBC Probe request Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9099 | |
| 9100 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pProbeReqInd->bssId, &sessionId ); |
| 9101 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9102 | { |
| 9103 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 9104 | roamInfo.u.pWPSPBCProbeReq = &pProbeReqInd->WPSPBCProbeReq; |
| 9105 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_WPS_PBC_PROBE_REQ_IND, |
| 9106 | eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND); |
| 9107 | } |
| 9108 | } |
| 9109 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9110 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9111 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 9112 | pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *)pSirMsg; |
| 9113 | switch( pStatusChangeMsg->statusChangeCode ) |
| 9114 | { |
| 9115 | case eSIR_SME_IBSS_ACTIVE: |
| 9116 | sessionId = csrFindIbssSession( pMac ); |
| 9117 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9118 | { |
| 9119 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9120 | if(!pSession) |
| 9121 | { |
| 9122 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9123 | return; |
| 9124 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9125 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED; |
| 9126 | if(pSession->pConnectBssDesc) |
| 9127 | { |
| 9128 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 9129 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 9130 | pRoamInfo = &roamInfo; |
| 9131 | } |
| 9132 | else |
| 9133 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9134 | 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] | 9135 | } |
| 9136 | result = eCSR_ROAM_RESULT_IBSS_CONNECT; |
| 9137 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 9138 | } |
| 9139 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9140 | case eSIR_SME_IBSS_INACTIVE: |
| 9141 | sessionId = csrFindIbssSession( pMac ); |
| 9142 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9143 | { |
| 9144 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9145 | if(!pSession) |
| 9146 | { |
| 9147 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9148 | return; |
| 9149 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9150 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 9151 | result = eCSR_ROAM_RESULT_IBSS_INACTIVE; |
| 9152 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 9153 | } |
| 9154 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9155 | case eSIR_SME_JOINED_NEW_BSS: // IBSS coalescing. |
| 9156 | sessionId = csrFindIbssSession( pMac ); |
| 9157 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9158 | { |
| 9159 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9160 | if(!pSession) |
| 9161 | { |
| 9162 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9163 | return; |
| 9164 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9165 | // update the connection state information |
| 9166 | pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9167 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9168 | { |
| 9169 | vos_log_ibss_pkt_type *pIbssLog; |
| 9170 | tANI_U32 bi; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9171 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9172 | if(pIbssLog) |
| 9173 | { |
| 9174 | pIbssLog->eventId = WLAN_IBSS_EVENT_COALESCING; |
| 9175 | if(pNewBss) |
| 9176 | { |
| 9177 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pNewBss->bssId, 6); |
| 9178 | if(pNewBss->ssId.length) |
| 9179 | { |
| 9180 | palCopyMemory(pMac->hHdd, pIbssLog->ssid, pNewBss->ssId.ssId, pNewBss->ssId.length); |
| 9181 | } |
| 9182 | pIbssLog->operatingChannel = pNewBss->channelNumber; |
| 9183 | } |
| 9184 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 9185 | { |
| 9186 | //***U8 is not enough for beacon interval |
| 9187 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 9188 | } |
| 9189 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9190 | } |
| 9191 | } |
| 9192 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9193 | csrRoamUpdateConnectedProfileFromNewBss( pMac, sessionId, pNewBss ); |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9194 | |
| 9195 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 9196 | pSession->connectedProfile.EncryptionType )) |
| 9197 | { |
| 9198 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 9199 | pSession->connectedProfile.EncryptionType, |
| 9200 | pSession->pConnectBssDesc, |
| 9201 | &Broadcastaddr, |
| 9202 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); |
| 9203 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9204 | result = eCSR_ROAM_RESULT_IBSS_COALESCED; |
| 9205 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 9206 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pNewBss->bssId, sizeof(tCsrBssid)); |
| 9207 | pRoamInfo = &roamInfo; |
| 9208 | //This BSSID is th ereal BSSID, let's save it |
| 9209 | if(pSession->pConnectBssDesc) |
| 9210 | { |
| 9211 | palCopyMemory(pMac->hHdd, pSession->pConnectBssDesc->bssId, &pNewBss->bssId, sizeof(tCsrBssid)); |
| 9212 | } |
| 9213 | // Stop the join IBSS timer in case of join, for |
| 9214 | // genuine merge do nothing |
| 9215 | if(pSession->ibss_join_pending) |
| 9216 | { |
| 9217 | pSession->ibss_join_pending = FALSE; |
| 9218 | csrRoamStopIbssJoinTimer(pMac, sessionId); |
| 9219 | result = eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS; |
| 9220 | } |
| 9221 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9222 | smsLog(pMac, LOGW, "CSR: eSIR_SME_JOINED_NEW_BSS received from PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9223 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9224 | // detection by LIM that the capabilities of the associated AP have changed. |
| 9225 | case eSIR_SME_AP_CAPS_CHANGED: |
| 9226 | pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9227 | smsLog(pMac, LOGW, "CSR handling eSIR_SME_AP_CAPS_CHANGED"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9228 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pApNewCaps->bssId, &sessionId ); |
| 9229 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9230 | { |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9231 | if ((eCSR_ROAMING_STATE_JOINED == pMac->roam.curState[sessionId]) && |
| 9232 | ((eCSR_ROAM_SUBSTATE_JOINED_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9233 | (eCSR_ROAM_SUBSTATE_NONE == pMac->roam.curSubState[sessionId]) || |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9234 | (eCSR_ROAM_SUBSTATE_JOINED_NON_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
| 9235 | (eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC == pMac->roam.curSubState[sessionId])) |
| 9236 | ) |
| 9237 | { |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9238 | smsLog(pMac, LOGW, "Calling csrRoamDisconnectInternal"); |
| 9239 | csrRoamDisconnectInternal(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9240 | } |
| 9241 | else |
| 9242 | { |
| 9243 | smsLog(pMac, LOGW, |
| 9244 | "Skipping csrScanForCapabilityChange as " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9245 | "CSR is in state %d and sub-state %d", |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9246 | pMac->roam.curState[sessionId], |
| 9247 | pMac->roam.curSubState[sessionId]); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9248 | /* We ignore the caps change event if CSR is not in full connected state. |
| 9249 | * Send one event to PE to reset limSentCapsChangeNtf |
| 9250 | * Once limSentCapsChangeNtf set 0, lim can send sub sequent CAPS change event |
| 9251 | * otherwise lim cannot send any CAPS change events to SME */ |
| 9252 | csrSendResetApCapsChanged(pMac, &pApNewCaps->bssId); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9253 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9254 | } |
| 9255 | break; |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9257 | default: |
| 9258 | roamStatus = eCSR_ROAM_FAILED; |
| 9259 | result = eCSR_ROAM_RESULT_NONE; |
| 9260 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9261 | } // end switch on statusChangeCode |
| 9262 | if(eCSR_ROAM_RESULT_NONE != result) |
| 9263 | { |
| 9264 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, roamStatus, result); |
| 9265 | } |
| 9266 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9267 | case eWNI_SME_IBSS_NEW_PEER_IND: |
| 9268 | pIbssPeerInd = (tSmeIbssPeerInd *)pSirMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9269 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9270 | { |
| 9271 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9272 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9273 | if(pIbssLog) |
| 9274 | { |
| 9275 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_JOIN; |
| 9276 | palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
| 9277 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9278 | } |
| 9279 | } |
| 9280 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9281 | sessionId = csrFindIbssSession( pMac ); |
| 9282 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9283 | { |
| 9284 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9285 | |
| 9286 | if(!pSession) |
| 9287 | { |
| 9288 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9289 | return; |
| 9290 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9291 | // Issue the set Context request to LIM to establish the Unicast STA context for the new peer... |
| 9292 | if(pSession->pConnectBssDesc) |
| 9293 | { |
| 9294 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 9295 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 9296 | if(pIbssPeerInd->mesgLen > sizeof(tSmeIbssPeerInd)) |
| 9297 | { |
| 9298 | status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pbFrames, |
| 9299 | (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd))); |
| 9300 | if(HAL_STATUS_SUCCESS(status)) |
| 9301 | { |
| 9302 | roamInfo.nBeaconLength = (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd)); |
| 9303 | palCopyMemory(pMac->hHdd, roamInfo.pbFrames, ((tANI_U8 *)pIbssPeerInd) + sizeof(tSmeIbssPeerInd), |
| 9304 | roamInfo.nBeaconLength); |
| 9305 | } |
| 9306 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 9307 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 9308 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 9309 | status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pBssDesc, |
| 9310 | pSession->pConnectBssDesc->length); |
| 9311 | if(HAL_STATUS_SUCCESS(status)) |
| 9312 | { |
| 9313 | palCopyMemory(pMac->hHdd, roamInfo.pBssDesc, pSession->pConnectBssDesc, |
| 9314 | pSession->pConnectBssDesc->length); |
| 9315 | } |
| 9316 | if(HAL_STATUS_SUCCESS(status)) |
| 9317 | { |
| 9318 | pRoamInfo = &roamInfo; |
| 9319 | } |
| 9320 | else |
| 9321 | { |
| 9322 | if(roamInfo.pbFrames) |
| 9323 | { |
| 9324 | palFreeMemory(pMac->hHdd, roamInfo.pbFrames); |
| 9325 | } |
| 9326 | if(roamInfo.pBssDesc) |
| 9327 | { |
| 9328 | palFreeMemory(pMac->hHdd, roamInfo.pBssDesc); |
| 9329 | } |
| 9330 | } |
| 9331 | } |
| 9332 | else |
| 9333 | { |
| 9334 | pRoamInfo = &roamInfo; |
| 9335 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9336 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 9337 | pSession->connectedProfile.EncryptionType )) |
| 9338 | { |
| 9339 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 9340 | pSession->connectedProfile.EncryptionType, |
| 9341 | pSession->pConnectBssDesc, |
| 9342 | &(pIbssPeerInd->peerAddr), |
| 9343 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 9344 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9345 | } |
| 9346 | else |
| 9347 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9348 | 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] | 9349 | } |
| 9350 | //send up the sec type for the new peer |
| 9351 | if (pRoamInfo) |
| 9352 | { |
| 9353 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9354 | } |
| 9355 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, |
| 9356 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_NEW_PEER); |
| 9357 | if(pRoamInfo) |
| 9358 | { |
| 9359 | if(roamInfo.pbFrames) |
| 9360 | { |
| 9361 | palFreeMemory(pMac->hHdd, roamInfo.pbFrames); |
| 9362 | } |
| 9363 | if(roamInfo.pBssDesc) |
| 9364 | { |
| 9365 | palFreeMemory(pMac->hHdd, roamInfo.pBssDesc); |
| 9366 | } |
| 9367 | } |
| 9368 | } |
| 9369 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9370 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 9371 | pIbssPeerInd = (tSmeIbssPeerInd*)pSirMsg; |
| 9372 | sessionId = csrFindIbssSession( pMac ); |
| 9373 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9374 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9375 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9376 | { |
| 9377 | vos_log_ibss_pkt_type *pIbssLog; |
| 9378 | |
| 9379 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9380 | if(pIbssLog) |
| 9381 | { |
| 9382 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_LEAVE; |
| 9383 | if(pIbssPeerInd) |
| 9384 | { |
| 9385 | palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
| 9386 | } |
| 9387 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9388 | } |
| 9389 | } |
| 9390 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9391 | smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9392 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 9393 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 9394 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 9395 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 9396 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 9397 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 9398 | } |
| 9399 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9400 | case eWNI_SME_SETCONTEXT_RSP: |
| 9401 | { |
| 9402 | tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *)pSirMsg; |
| 9403 | tListElem *pEntry; |
| 9404 | tSmeCmd *pCommand; |
| 9405 | |
| 9406 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9407 | if ( pEntry ) |
| 9408 | { |
| 9409 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9410 | if ( eSmeCommandSetKey == pCommand->command ) |
| 9411 | { |
| 9412 | sessionId = pCommand->sessionId; |
| 9413 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9414 | |
| 9415 | if(!pSession) |
| 9416 | { |
| 9417 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9418 | return; |
| 9419 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9420 | |
| 9421 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9422 | if(eCSR_ENCRYPT_TYPE_NONE != pSession->connectedProfile.EncryptionType) |
| 9423 | { |
| 9424 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
| 9425 | palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 9426 | if( pRsp->peerMacAddr[0] & 0x01 ) |
| 9427 | { |
| 9428 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 9429 | } |
| 9430 | else |
| 9431 | { |
| 9432 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 9433 | } |
| 9434 | setKeyEvent.encryptionModeMulticast = |
| 9435 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9436 | setKeyEvent.encryptionModeUnicast = |
| 9437 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9438 | palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 9439 | setKeyEvent.authMode = |
| 9440 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9441 | if( eSIR_SME_SUCCESS != pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9442 | { |
| 9443 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 9444 | } |
| 9445 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 9446 | } |
| 9447 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9448 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 9449 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9450 | csrRoamStopWaitForKeyTimer( pMac ); |
| 9451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9452 | //We are done with authentication, whethere succeed or not |
| 9453 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9454 | //We do it here because this linkup function is not called after association |
| 9455 | //when a key needs to be set. |
| 9456 | if( csrIsConnStateConnectedInfra(pMac, sessionId) ) |
| 9457 | { |
| 9458 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 9459 | } |
| 9460 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9461 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9462 | { |
| 9463 | palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9464 | //Make sure we install the GTK before indicating to HDD as authenticated |
| 9465 | //This is to prevent broadcast packets go out after PTK and before GTK. |
| 9466 | if( palEqualMemory( pMac->hHdd, &Broadcastaddr, pRsp->peerMacAddr, |
| 9467 | sizeof(tSirMacAddr) ) ) |
| 9468 | { |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 9469 | #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE |
| 9470 | if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE) |
| 9471 | { |
| 9472 | tpSirSetActiveModeSetBncFilterReq pMsg; |
| 9473 | palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tSirSetActiveModeSetBncFilterReq)); |
| 9474 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_BCN_FILTER_REQ); |
| 9475 | pMsg->length = pal_cpu_to_be16(sizeof( tANI_U8)); |
| 9476 | pMsg->seesionId = sessionId; |
| 9477 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 9478 | } |
| 9479 | #endif |
| 9480 | result = eCSR_ROAM_RESULT_AUTHENTICATED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9481 | } |
| 9482 | else |
| 9483 | { |
| 9484 | result = eCSR_ROAM_RESULT_NONE; |
| 9485 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9486 | pRoamInfo = &roamInfo; |
| 9487 | } |
| 9488 | else |
| 9489 | { |
| 9490 | result = eCSR_ROAM_RESULT_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9491 | 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] | 9492 | pRsp->statusCode, pRsp->peerMacAddr[0], pRsp->peerMacAddr[1], pRsp->peerMacAddr[2], |
| 9493 | pRsp->peerMacAddr[3], pRsp->peerMacAddr[4], pRsp->peerMacAddr[5] ); |
| 9494 | } |
| 9495 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 9496 | eCSR_ROAM_SET_KEY_COMPLETE, result); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9497 | // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS |
| 9498 | // can go ahead and initiate the TSPEC if any are pending |
| 9499 | 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] | 9500 | #ifdef FEATURE_WLAN_CCX |
| 9501 | //Send Adjacent AP repot to new AP. |
| 9502 | if (result == eCSR_ROAM_RESULT_AUTHENTICATED && |
| 9503 | pSession->isPrevApInfoValid && |
| 9504 | pSession->connectedProfile.isCCXAssoc) |
| 9505 | { |
| 9506 | #ifdef WLAN_FEATURE_VOWIFI |
| 9507 | csrCcxSendAdjacentApRepMsg(pMac, pSession); |
| 9508 | #endif |
| 9509 | pSession->isPrevApInfoValid = FALSE; |
| 9510 | } |
| 9511 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9512 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9513 | { |
| 9514 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 9515 | } |
| 9516 | } |
| 9517 | else |
| 9518 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9519 | 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] | 9520 | } |
| 9521 | } |
| 9522 | else |
| 9523 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9524 | smsLog( pMac, LOGE, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9526 | smeProcessPendingQueue( pMac ); |
| 9527 | } |
| 9528 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9529 | case eWNI_SME_REMOVEKEY_RSP: |
| 9530 | { |
| 9531 | tSirSmeRemoveKeyRsp *pRsp = (tSirSmeRemoveKeyRsp *)pSirMsg; |
| 9532 | tListElem *pEntry; |
| 9533 | tSmeCmd *pCommand; |
| 9534 | |
| 9535 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9536 | if ( pEntry ) |
| 9537 | { |
| 9538 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9539 | if ( eSmeCommandRemoveKey == pCommand->command ) |
| 9540 | { |
| 9541 | sessionId = pCommand->sessionId; |
| 9542 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9543 | |
| 9544 | if(!pSession) |
| 9545 | { |
| 9546 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9547 | return; |
| 9548 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9549 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9550 | { |
| 9551 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
| 9552 | palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 9553 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
| 9554 | removeKeyEvent.encryptionModeMulticast = |
| 9555 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9556 | removeKeyEvent.encryptionModeUnicast = |
| 9557 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9558 | palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 9559 | removeKeyEvent.authMode = |
| 9560 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9561 | if( eSIR_SME_SUCCESS != pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9562 | { |
| 9563 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 9564 | } |
| 9565 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 9566 | } |
| 9567 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9568 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9569 | { |
| 9570 | palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) ); |
| 9571 | result = eCSR_ROAM_RESULT_NONE; |
| 9572 | pRoamInfo = &roamInfo; |
| 9573 | } |
| 9574 | else |
| 9575 | { |
| 9576 | result = eCSR_ROAM_RESULT_FAILURE; |
| 9577 | } |
| 9578 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 9579 | eCSR_ROAM_REMOVE_KEY_COMPLETE, result); |
| 9580 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9581 | { |
| 9582 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 9583 | } |
| 9584 | } |
| 9585 | else |
| 9586 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9587 | 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] | 9588 | } |
| 9589 | } |
| 9590 | else |
| 9591 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9592 | smsLog( pMac, LOGW, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9593 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9594 | smeProcessPendingQueue( pMac ); |
| 9595 | } |
| 9596 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9597 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9598 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9599 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 9600 | break; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9601 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 9602 | case eWNI_SME_GET_ROAM_RSSI_RSP: |
| 9603 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
| 9604 | csrRoamRssiRspProcessor( pMac, pSirMsg ); |
| 9605 | break; |
| 9606 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9607 | case eWNI_SME_GET_RSSI_REQ: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9608 | smsLog( pMac, LOG2, FL("GetRssiReq from self")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9609 | csrUpdateRssi( pMac, pSirMsg ); |
| 9610 | break; |
| 9611 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9612 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9613 | case eWNI_SME_FT_PRE_AUTH_RSP: |
| 9614 | csrRoamFTPreAuthRspProcessor( pMac, (tpSirFTPreAuthRsp)pSirMsg ); |
| 9615 | break; |
| 9616 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9617 | case eWNI_SME_MAX_ASSOC_EXCEEDED: |
| 9618 | pSmeMaxAssocInd = (tSmeMaxAssocInd*)pSirMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9619 | 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] | 9620 | sessionId = pSmeMaxAssocInd->sessionId; |
| 9621 | roamInfo.sessionId = sessionId; |
| 9622 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pSmeMaxAssocInd->peerMac, sizeof(tCsrBssid)); |
| 9623 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 9624 | eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED); |
| 9625 | break; |
| 9626 | |
| 9627 | case eWNI_SME_BTAMP_LOG_LINK_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9628 | 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] | 9629 | btampEstablishLogLinkHdlr( pSirMsg ); |
| 9630 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9631 | case eWNI_SME_RSSI_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9632 | smsLog( pMac, LOG1, FL("RSSI indication from TL serialized through MC thread")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9633 | csrRoamRssiIndHdlr( pMac, pSirMsg ); |
| 9634 | break; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 9635 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 9636 | case eWNI_SME_CANDIDATE_FOUND_IND: |
| 9637 | smsLog( pMac, LOG2, FL("Candidate found indication from PE")); |
| 9638 | csrNeighborRoamCandidateFoundIndHdlr( pMac, pSirMsg ); |
| 9639 | break; |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 9640 | case eWNI_SME_HANDOFF_REQ: |
| 9641 | smsLog( pMac, LOG2, FL("Handoff Req from self")); |
| 9642 | csrNeighborRoamHandoffReqHdlr( pMac, pSirMsg ); |
| 9643 | break; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 9644 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9645 | |
| 9646 | default: |
| 9647 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9648 | } // end switch on message type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9649 | } |
| 9650 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9651 | void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, |
| 9652 | tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult) |
| 9653 | { |
| 9654 | if(pSession) |
| 9655 | { |
| 9656 | if(pSession->bRefAssocStartCnt) |
| 9657 | { |
| 9658 | pSession->bRefAssocStartCnt--; |
| 9659 | VOS_ASSERT( pSession->bRefAssocStartCnt == 0); |
| 9660 | //Need to call association_completion because there is an assoc_start pending. |
| 9661 | csrRoamCallCallback(pMac, pSession->sessionId, NULL, roamId, |
| 9662 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 9663 | eCSR_ROAM_RESULT_FAILURE); |
| 9664 | } |
| 9665 | csrRoamCallCallback(pMac, pSession->sessionId, pRoamInfo, roamId, eCSR_ROAM_ROAMING_COMPLETION, roamResult); |
| 9666 | } |
| 9667 | else |
| 9668 | { |
| 9669 | smsLog(pMac, LOGW, FL(" pSession is NULL")); |
| 9670 | } |
| 9671 | } |
| 9672 | |
| 9673 | |
| 9674 | eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason) |
| 9675 | { |
| 9676 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9677 | if(CSR_IS_LOSTLINK_ROAMING(roamingReason) && |
| 9678 | (eANI_BOOLEAN_FALSE == pMac->roam.roamSession[sessionId].fCancelRoaming)) |
| 9679 | { |
| 9680 | status = csrScanRequestLostLink1( pMac, sessionId ); |
| 9681 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9682 | return(status); |
| 9683 | } |
| 9684 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9685 | //return a boolean to indicate whether roaming completed or continue. |
| 9686 | tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 9687 | tANI_BOOLEAN fForce, eCsrRoamResult roamResult) |
| 9688 | { |
| 9689 | tANI_BOOLEAN fCompleted = eANI_BOOLEAN_TRUE; |
| 9690 | tANI_TIMESTAMP roamTime = (tANI_TIMESTAMP)(pMac->roam.configParam.nRoamingTime * PAL_TICKS_PER_SECOND); |
| 9691 | tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 9692 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9693 | if(!pSession) |
| 9694 | { |
| 9695 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9696 | return eANI_BOOLEAN_FALSE; |
| 9697 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9698 | //Check whether time is up |
| 9699 | if(pSession->fCancelRoaming || fForce || |
| 9700 | ((curTime - pSession->roamingStartTime) > roamTime) || |
| 9701 | eCsrReassocRoaming == pSession->roamingReason || |
| 9702 | eCsrDynamicRoaming == pSession->roamingReason) |
| 9703 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9704 | smsLog(pMac, LOGW, FL(" indicates roaming completion")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9705 | if(pSession->fCancelRoaming && CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason)) |
| 9706 | { |
| 9707 | //roaming is cancelled, tell HDD to indicate disconnect |
| 9708 | //Because LIM overload deauth_ind for both deauth frame and missed beacon |
| 9709 | //we need to use this logic to detinguish it. For missed beacon, LIM set reason |
| 9710 | //to be eSIR_BEACON_MISSED |
| 9711 | if(eSIR_BEACON_MISSED == pSession->roamingStatusCode) |
| 9712 | { |
| 9713 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 9714 | } |
| 9715 | else if(eCsrLostlinkRoamingDisassoc == pSession->roamingReason) |
| 9716 | { |
| 9717 | roamResult = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 9718 | } |
| 9719 | else if(eCsrLostlinkRoamingDeauth == pSession->roamingReason) |
| 9720 | { |
| 9721 | roamResult = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 9722 | } |
| 9723 | else |
| 9724 | { |
| 9725 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 9726 | } |
| 9727 | } |
| 9728 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 9729 | pSession->roamingReason = eCsrNotRoaming; |
| 9730 | } |
| 9731 | else |
| 9732 | { |
| 9733 | pSession->roamResult = roamResult; |
| 9734 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoamingTimer(pMac, sessionId, PAL_TIMER_TO_SEC_UNIT))) |
| 9735 | { |
| 9736 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 9737 | pSession->roamingReason = eCsrNotRoaming; |
| 9738 | } |
| 9739 | else |
| 9740 | { |
| 9741 | fCompleted = eANI_BOOLEAN_FALSE; |
| 9742 | } |
| 9743 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9744 | return(fCompleted); |
| 9745 | } |
| 9746 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9747 | void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9748 | { |
| 9749 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9750 | |
| 9751 | if(!pSession) |
| 9752 | { |
| 9753 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9754 | return; |
| 9755 | } |
| 9756 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9757 | if(CSR_IS_ROAMING(pSession)) |
| 9758 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9759 | smsLog(pMac, LOGW, " Cancelling roaming"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9760 | pSession->fCancelRoaming = eANI_BOOLEAN_TRUE; |
| 9761 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 9762 | { |
| 9763 | //No need to do anything in here because the handler takes care of it |
| 9764 | } |
| 9765 | else |
| 9766 | { |
| 9767 | eCsrRoamResult roamResult = CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason) ? |
| 9768 | eCSR_ROAM_RESULT_LOSTLINK : eCSR_ROAM_RESULT_NONE; |
| 9769 | //Roaming is stopped after here |
| 9770 | csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_TRUE, roamResult); |
| 9771 | //Since CSR may be in lostlink roaming situation, abort all roaming related activities |
| 9772 | csrScanAbortMacScan(pMac); |
| 9773 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 9774 | } |
| 9775 | } |
| 9776 | } |
| 9777 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9778 | void csrRoamRoamingTimerHandler(void *pv) |
| 9779 | { |
| 9780 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9781 | tpAniSirGlobal pMac = pInfo->pMac; |
| 9782 | tANI_U32 sessionId = pInfo->sessionId; |
| 9783 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9784 | |
| 9785 | if(!pSession) |
| 9786 | { |
| 9787 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9788 | return; |
| 9789 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9790 | |
| 9791 | if(eANI_BOOLEAN_FALSE == pSession->fCancelRoaming) |
| 9792 | { |
| 9793 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoaming(pMac, sessionId, pSession->roamingReason))) |
| 9794 | { |
| 9795 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, pSession->roamResult); |
| 9796 | pSession->roamingReason = eCsrNotRoaming; |
| 9797 | } |
| 9798 | } |
| 9799 | } |
| 9800 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9801 | eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 9802 | { |
| 9803 | eHalStatus status; |
| 9804 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9805 | |
| 9806 | if(!pSession) |
| 9807 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9808 | smsLog(pMac, LOGE, FL(" session %d not found"), sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9809 | return eHAL_STATUS_FAILURE; |
| 9810 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9811 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9812 | smsLog(pMac, LOG1, " csrScanStartRoamingTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9813 | pSession->roamingTimerInfo.sessionId = (tANI_U8)sessionId; |
| 9814 | status = palTimerStart(pMac->hHdd, pSession->hTimerRoaming, interval, eANI_BOOLEAN_FALSE); |
| 9815 | |
| 9816 | return (status); |
| 9817 | } |
| 9818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9819 | eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9820 | { |
| 9821 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerRoaming)); |
| 9822 | } |
| 9823 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9824 | void csrRoamWaitForKeyTimeOutHandler(void *pv) |
| 9825 | { |
| 9826 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9827 | tpAniSirGlobal pMac = pInfo->pMac; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9828 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pInfo->sessionId ); |
| 9829 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9830 | smsLog(pMac, LOGW, "WaitForKey timer expired in state=%d sub-state=%d", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9831 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9832 | pMac->roam.curSubState[pInfo->sessionId]); |
| 9833 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9834 | if( CSR_IS_WAIT_FOR_KEY( pMac, pInfo->sessionId ) ) |
| 9835 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9836 | #ifdef FEATURE_WLAN_LFR |
| 9837 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9838 | { |
| 9839 | /* |
| 9840 | * Enable heartbeat timer when hand-off is in progress |
| 9841 | * and Key Wait timer expired. |
| 9842 | */ |
| 9843 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey expiry" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9844 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9845 | pMac->roam.configParam.HeartbeatThresh24); |
| 9846 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 9847 | pMac->roam.configParam.HeartbeatThresh24, |
| 9848 | NULL, eANI_BOOLEAN_FALSE); |
| 9849 | } |
| 9850 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9851 | smsLog(pMac, LOGW, " SME pre-auth state timeout. "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9852 | //Change the substate so command queue is unblocked. |
| 9853 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, pInfo->sessionId); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9854 | if (pSession) |
| 9855 | { |
| 9856 | if( csrIsConnStateConnectedInfra(pMac, pInfo->sessionId) ) |
| 9857 | { |
| 9858 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 9859 | smeProcessPendingQueue(pMac); |
| 9860 | } |
| 9861 | else |
| 9862 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9863 | smsLog(pMac, LOGW, "%s: could not post link up", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9864 | __func__); |
| 9865 | } |
| 9866 | } |
| 9867 | else |
| 9868 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9869 | smsLog(pMac, LOGW, "%s: session not found", __func__); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9870 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9871 | } |
| 9872 | |
| 9873 | } |
| 9874 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9875 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval) |
| 9876 | { |
| 9877 | eHalStatus status; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9878 | #ifdef FEATURE_WLAN_LFR |
| 9879 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9880 | { |
| 9881 | /* Disable heartbeat timer when hand-off is in progress */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9882 | 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] | 9883 | __func__, |
| 9884 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9885 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId]); |
| 9886 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE); |
| 9887 | } |
| 9888 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9889 | smsLog(pMac, LOG1, " csrScanStartWaitForKeyTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9890 | status = palTimerStart(pMac->hHdd, pMac->roam.hTimerWaitForKey, interval, eANI_BOOLEAN_FALSE); |
| 9891 | |
| 9892 | return (status); |
| 9893 | } |
| 9894 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9895 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac) |
| 9896 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9897 | smsLog(pMac, LOG2, "WaitForKey timer stopped in state=%d sub-state=%d", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9898 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9899 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId]); |
| 9900 | #ifdef FEATURE_WLAN_LFR |
| 9901 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9902 | { |
| 9903 | /* |
| 9904 | * Enable heartbeat timer when hand-off is in progress |
| 9905 | * and Key Wait timer got stopped for some reason |
| 9906 | */ |
| 9907 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey stop" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9908 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9909 | pMac->roam.configParam.HeartbeatThresh24); |
| 9910 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 9911 | pMac->roam.configParam.HeartbeatThresh24, |
| 9912 | NULL, eANI_BOOLEAN_FALSE); |
| 9913 | } |
| 9914 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9915 | return (palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey)); |
| 9916 | } |
| 9917 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9918 | void csrRoamIbssJoinTimerHandler(void *pv) |
| 9919 | { |
| 9920 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9921 | tpAniSirGlobal pMac = pInfo->pMac; |
| 9922 | eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE; |
| 9923 | tANI_U32 sessionId = pInfo->sessionId; |
| 9924 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9925 | |
| 9926 | if(!pSession) |
| 9927 | { |
| 9928 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9929 | return; |
| 9930 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9931 | |
| 9932 | pSession->ibss_join_pending = FALSE; |
| 9933 | // JEZ100225: As of main/latest "tip", we are no longer doing this. Check on this. |
| 9934 | //csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 9935 | // Send an IBSS stop request to PE |
| 9936 | csrRoamDisconnectInternal(pMac, sessionId, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9937 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9938 | eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 9939 | { |
| 9940 | eHalStatus status; |
| 9941 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9942 | |
| 9943 | if(!pSession) |
| 9944 | { |
| 9945 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9946 | return eHAL_STATUS_FAILURE; |
| 9947 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9948 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9949 | smsLog(pMac, LOG1, " csrRoamStartIbssJoinTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9950 | pSession->ibssJoinTimerInfo.sessionId = (tANI_U8)sessionId; |
| 9951 | status = palTimerStart(pMac->hHdd, pSession->hTimerIbssJoining, interval, eANI_BOOLEAN_FALSE); |
| 9952 | |
| 9953 | return (status); |
| 9954 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9955 | eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9956 | { |
| 9957 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerIbssJoining)); |
| 9958 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9959 | void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, |
| 9960 | eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess) |
| 9961 | { |
| 9962 | eRoamCmdStatus roamStatus = csrGetRoamCompleteStatus(pMac, sessionId); |
| 9963 | tANI_U32 roamId = 0; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9964 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 9965 | /* To silence the KW tool Null chaeck is added */ |
| 9966 | if(!pSession) |
| 9967 | { |
| 9968 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9969 | return; |
| 9970 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9971 | |
| 9972 | if(pCommand) |
| 9973 | { |
| 9974 | roamId = pCommand->u.roamCmd.roamId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9975 | VOS_ASSERT( sessionId == pCommand->sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9976 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9977 | if(eCSR_ROAM_ROAMING_COMPLETION == roamStatus) |
| 9978 | { |
| 9979 | //if success, force roaming completion |
| 9980 | csrRoamCompleteRoaming(pMac, sessionId, fSuccess, roamResult); |
| 9981 | } |
| 9982 | else |
| 9983 | { |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9984 | VOS_ASSERT(pSession->bRefAssocStartCnt == 0); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9985 | smsLog(pMac, LOGW, FL(" indicates association completion. roamResult = %d"), roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9986 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, roamId, roamStatus, roamResult); |
| 9987 | } |
| 9988 | } |
| 9989 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9990 | eHalStatus csrRoamLostLink( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 type, tSirSmeRsp *pSirMsg) |
| 9991 | { |
| 9992 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9993 | tSirSmeDeauthInd *pDeauthIndMsg = NULL; |
| 9994 | tSirSmeDisassocInd *pDisassocIndMsg = NULL; |
| 9995 | eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK; |
| 9996 | tCsrRoamInfo *pRoamInfo = NULL; |
| 9997 | tCsrRoamInfo roamInfo; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9998 | tANI_BOOLEAN fToRoam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9999 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10000 | /* To silence the KW tool Null chaeck is added */ |
| 10001 | if(!pSession) |
| 10002 | { |
| 10003 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10004 | return eHAL_STATUS_FAILURE; |
| 10005 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10006 | //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] | 10007 | fToRoam = CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10008 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
| 10009 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 10010 | { |
| 10011 | result = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 10012 | pDisassocIndMsg = (tSirSmeDisassocInd *)pSirMsg; |
| 10013 | pSession->roamingStatusCode = pDisassocIndMsg->statusCode; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 10014 | pSession->joinFailStatusCode.reasonCode = pDisassocIndMsg->reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10015 | } |
| 10016 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 10017 | { |
| 10018 | result = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 10019 | pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg; |
| 10020 | pSession->roamingStatusCode = pDeauthIndMsg->statusCode; |
Madan Mohan Koyyalamudi | 6a80893 | 2012-11-06 16:05:54 -0800 | [diff] [blame] | 10021 | /* Convert into proper reason code */ |
| 10022 | pSession->joinFailStatusCode.reasonCode = |
| 10023 | (pDeauthIndMsg->reasonCode == eSIR_BEACON_MISSED) ? |
Agarwal Ashish | 838f1f3 | 2013-03-11 20:54:52 +0530 | [diff] [blame] | 10024 | 0 : pDeauthIndMsg->reasonCode; |
| 10025 | /* cfg layer expects 0 as reason code if |
| 10026 | the driver dosent know the reason code |
| 10027 | eSIR_BEACON_MISSED is defined as locally */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10028 | } |
| 10029 | else |
| 10030 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10031 | smsLog(pMac, LOGW, FL("gets an unknown type (%d)"), type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10032 | result = eCSR_ROAM_RESULT_NONE; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 10033 | pSession->joinFailStatusCode.reasonCode = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10034 | } |
| 10035 | |
| 10036 | // call profile lost link routine here |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10037 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10038 | { |
| 10039 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_LOSTLINK_DETECTED, result); |
| 10040 | } |
| 10041 | |
| 10042 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 10043 | { |
| 10044 | status = csrSendMBDisassocCnfMsg(pMac, pDisassocIndMsg); |
| 10045 | } |
| 10046 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 10047 | { |
| 10048 | status = csrSendMBDeauthCnfMsg(pMac, pDeauthIndMsg); |
| 10049 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10050 | if(!HAL_STATUS_SUCCESS(status)) |
| 10051 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10052 | //If fail to send confirmation to PE, not to trigger roaming |
| 10053 | fToRoam = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10054 | } |
| 10055 | |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10056 | //prepare to tell HDD to disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10057 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 10058 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 10059 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10060 | if( eWNI_SME_DISASSOC_IND == type) |
| 10061 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10062 | //staMacAddr |
| 10063 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 10064 | roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId; |
| 10065 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10066 | else if( eWNI_SME_DEAUTH_IND == type ) |
| 10067 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10068 | //staMacAddr |
| 10069 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 10070 | roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId; |
| 10071 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10072 | smsLog(pMac, LOGW, FL("roamInfo.staId (%d)"), roamInfo.staId); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10073 | |
| 10074 | /* See if we can possibly roam. If so, start the roaming process and notify HDD |
| 10075 | that we are roaming. But if we cannot possibly roam, or if we are unable to |
| 10076 | currently roam, then notify HDD of the lost link */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10077 | if(fToRoam) |
| 10078 | { |
| 10079 | //Only remove the connected BSS in infrastructure mode |
| 10080 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 10081 | //Not to do anying for lostlink with WDS |
| 10082 | if( pMac->roam.configParam.nRoamingTime ) |
| 10083 | { |
| 10084 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac, sessionId, |
| 10085 | ( eWNI_SME_DEAUTH_IND == type ) ? |
| 10086 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc))) |
| 10087 | { |
| 10088 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 10089 | //For IBSS, we need to give some more info to HDD |
| 10090 | if(csrIsBssTypeIBSS(pSession->connectedProfile.BSSType)) |
| 10091 | { |
| 10092 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 10093 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 10094 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 10095 | } |
| 10096 | else |
| 10097 | { |
| 10098 | roamInfo.reasonCode = eCsrRoamReasonSmeIssuedForLostLink; |
| 10099 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10100 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10101 | pSession->roamingReason = ( eWNI_SME_DEAUTH_IND == type ) ? |
| 10102 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc; |
| 10103 | pSession->roamingStartTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 10104 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_LOSTLINK); |
| 10105 | } |
| 10106 | else |
| 10107 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10108 | smsLog(pMac, LOGW, " %s Fail to start roaming, status = %d", __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10109 | fToRoam = eANI_BOOLEAN_FALSE; |
| 10110 | } |
| 10111 | } |
| 10112 | else |
| 10113 | { |
| 10114 | //We are told not to roam, indicate lostlink |
| 10115 | fToRoam = eANI_BOOLEAN_FALSE; |
| 10116 | } |
| 10117 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10118 | if(!fToRoam) |
| 10119 | { |
Madan Mohan Koyyalamudi | af854cf | 2012-10-30 17:56:25 -0700 | [diff] [blame] | 10120 | //Tell HDD about the lost link |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10121 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 10122 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10123 | /* Don't call csrRoamCallCallback for GO/SoftAp case as this indication |
| 10124 | * was already given as part of eWNI_SME_DISASSOC_IND msg handling in |
| 10125 | * csrRoamCheckForLinkStatusChange API. |
| 10126 | */ |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 10127 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result); |
| 10128 | } |
| 10129 | |
| 10130 | /*No need to start idle scan in case of IBSS/SAP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10131 | Still enable idle scan for polling in case concurrent sessions are running */ |
| 10132 | if(CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile)) |
| 10133 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10134 | csrScanStartIdleScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10135 | } |
| 10136 | } |
| 10137 | |
| 10138 | return (status); |
| 10139 | } |
| 10140 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10141 | eHalStatus csrRoamLostLinkAfterhandoffFailure( tpAniSirGlobal pMac,tANI_U32 sessionId) |
| 10142 | { |
| 10143 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10144 | tListElem *pEntry = NULL; |
| 10145 | tSmeCmd *pCommand = NULL; |
| 10146 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10147 | |
| 10148 | if(!pSession) |
| 10149 | { |
| 10150 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10151 | return eHAL_STATUS_FAILURE; |
| 10152 | } |
| 10153 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10154 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10155 | //Only remove the connected BSS in infrastructure mode |
| 10156 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 10157 | if(pMac->roam.configParam.nRoamingTime) |
| 10158 | { |
| 10159 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac,sessionId, pSession->roamingReason))) |
| 10160 | { |
| 10161 | //before starting the lost link logic release the roam command for handoff |
| 10162 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 10163 | if(pEntry) |
| 10164 | { |
| 10165 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 10166 | } |
| 10167 | if(pCommand) |
| 10168 | { |
| 10169 | if (( eSmeCommandRoam == pCommand->command ) && |
| 10170 | ( eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)) |
| 10171 | { |
| 10172 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10173 | { |
| 10174 | csrReleaseCommandRoam( pMac, pCommand ); |
| 10175 | } |
| 10176 | } |
| 10177 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10178 | smsLog( pMac, LOGW, "Lost link roaming started ..."); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10179 | } |
| 10180 | } |
| 10181 | else |
| 10182 | { |
| 10183 | //We are told not to roam, indicate lostlink |
| 10184 | status = eHAL_STATUS_FAILURE; |
| 10185 | } |
| 10186 | |
| 10187 | return (status); |
| 10188 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10189 | void csrRoamWmStatusChangeComplete( tpAniSirGlobal pMac ) |
| 10190 | { |
| 10191 | tListElem *pEntry; |
| 10192 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10193 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 10194 | if ( pEntry ) |
| 10195 | { |
| 10196 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 10197 | if ( eSmeCommandWmStatusChange == pCommand->command ) |
| 10198 | { |
| 10199 | // Nothing to process in a Lost Link completion.... It just kicks off a |
| 10200 | // roaming sequence. |
| 10201 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10202 | { |
| 10203 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 10204 | } |
| 10205 | else |
| 10206 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10207 | smsLog( pMac, LOGE, " ******csrRoamWmStatusChangeComplete fail to release command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10208 | } |
| 10209 | |
| 10210 | } |
| 10211 | else |
| 10212 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10213 | 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] | 10214 | } |
| 10215 | } |
| 10216 | else |
| 10217 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10218 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10219 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10220 | smeProcessPendingQueue( pMac ); |
| 10221 | } |
| 10222 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10223 | void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 10224 | { |
| 10225 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 10226 | tSirSmeRsp *pSirSmeMsg; |
| 10227 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pCommand->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10228 | |
| 10229 | if(!pSession) |
| 10230 | { |
| 10231 | smsLog(pMac, LOGE, FL(" session %d not found "), pCommand->sessionId); |
| 10232 | return; |
| 10233 | } |
| 10234 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10235 | switch ( pCommand->u.wmStatusChangeCmd.Type ) |
| 10236 | { |
| 10237 | case eCsrDisassociated: |
| 10238 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg; |
| 10239 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DISASSOC_IND, pSirSmeMsg); |
| 10240 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10241 | case eCsrDeauthenticated: |
| 10242 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg; |
| 10243 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DEAUTH_IND, pSirSmeMsg); |
| 10244 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10245 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10246 | 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] | 10247 | break; |
| 10248 | } |
| 10249 | //For WDS, we want to stop BSS as well when it is indicated that it is disconnected. |
| 10250 | if( CSR_IS_CONN_WDS(&pSession->connectedProfile) ) |
| 10251 | { |
| 10252 | if( !HAL_STATUS_SUCCESS(csrRoamIssueStopBssCmd( pMac, pCommand->sessionId, eANI_BOOLEAN_TRUE )) ) |
| 10253 | { |
| 10254 | //This is not good |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10255 | smsLog(pMac, LOGE, FL(" failed to issue stopBSS command")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10256 | } |
| 10257 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10258 | // Lost Link just triggers a roaming sequence. We can complte the Lost Link |
| 10259 | // command here since there is nothing else to do. |
| 10260 | csrRoamWmStatusChangeComplete( pMac ); |
| 10261 | } |
| 10262 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10263 | //This function returns band and mode information. |
| 10264 | //The only tricky part is that if phyMode is set to 11abg, this function may return eCSR_CFG_DOT11_MODE_11B |
| 10265 | //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] | 10266 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 10267 | tANI_U8 operationChn, eCsrBand *pBand ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10268 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10269 | eCsrPhyMode phyModeIn = (eCsrPhyMode)pProfile->phyMode; |
| 10270 | eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pProfile, phyModeIn, |
| 10271 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10272 | eCsrBand eBand; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 10273 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10274 | //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] | 10275 | if( ((!CSR_IS_INFRA_AP(pProfile )&& !CSR_IS_WDS(pProfile )) && |
| 10276 | ((eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) || |
| 10277 | (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode))) || |
| 10278 | (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10279 | { |
| 10280 | switch( pMac->roam.configParam.uCfgDot11Mode ) |
| 10281 | { |
| 10282 | case eCSR_CFG_DOT11_MODE_11A: |
| 10283 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10284 | eBand = eCSR_BAND_5G; |
| 10285 | break; |
| 10286 | case eCSR_CFG_DOT11_MODE_11B: |
| 10287 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10288 | eBand = eCSR_BAND_24; |
| 10289 | break; |
| 10290 | case eCSR_CFG_DOT11_MODE_11G: |
| 10291 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 10292 | eBand = eCSR_BAND_24; |
| 10293 | break; |
| 10294 | case eCSR_CFG_DOT11_MODE_11N: |
| 10295 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10296 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10297 | break; |
| 10298 | #ifdef WLAN_FEATURE_11AC |
| 10299 | case eCSR_CFG_DOT11_MODE_11AC: |
| 10300 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 10301 | { |
| 10302 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 10303 | eBand = eCSR_BAND_5G; |
| 10304 | } |
| 10305 | else |
| 10306 | { |
| 10307 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10308 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10309 | } |
| 10310 | break; |
| 10311 | case eCSR_CFG_DOT11_MODE_11AC_ONLY: |
| 10312 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 10313 | { |
| 10314 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC_ONLY; |
| 10315 | eBand = eCSR_BAND_5G; |
| 10316 | } |
| 10317 | else |
| 10318 | { |
| 10319 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10320 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10321 | } |
| 10322 | break; |
| 10323 | #endif |
| 10324 | case eCSR_CFG_DOT11_MODE_AUTO: |
| 10325 | eBand = pMac->roam.configParam.eBand; |
| 10326 | if (eCSR_BAND_24 == eBand) |
| 10327 | { |
| 10328 | // WiFi tests require IBSS networks to start in 11b mode |
| 10329 | // without any change to the default parameter settings |
| 10330 | // on the adapter. We use ACU to start an IBSS through |
| 10331 | // creation of a startIBSS profile. This startIBSS profile |
| 10332 | // has Auto MACProtocol and the adapter property setting |
| 10333 | // for dot11Mode is also AUTO. So in this case, let's |
| 10334 | // start the IBSS network in 11b mode instead of 11g mode. |
| 10335 | // So this is for Auto=profile->MacProtocol && Auto=Global. |
| 10336 | // dot11Mode && profile->channel is < 14, then start the IBSS |
| 10337 | // in b mode. |
| 10338 | // |
| 10339 | // Note: we used to have this start as an 11g IBSS for best |
| 10340 | // performance... now to specify that the user will have to |
| 10341 | // set the do11Mode in the property page to 11g to force it. |
| 10342 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10343 | } |
| 10344 | else |
| 10345 | { |
| 10346 | #ifdef WLAN_FEATURE_11AC |
| 10347 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 10348 | { |
| 10349 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 10350 | eBand = eCSR_BAND_5G; |
| 10351 | } |
| 10352 | else |
| 10353 | { |
| 10354 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10355 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10356 | } |
| 10357 | #else |
| 10358 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10359 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10360 | #endif |
| 10361 | } |
| 10362 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10363 | default: |
| 10364 | // Global dot11 Mode setting is 11a/b/g. |
| 10365 | // use the channel number to determine the Mode setting. |
| 10366 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 10367 | { |
| 10368 | eBand = pMac->roam.configParam.eBand; |
| 10369 | if(eCSR_BAND_24 == eBand) |
| 10370 | { |
| 10371 | //See reason in else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) to pick 11B |
| 10372 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10373 | } |
| 10374 | else |
| 10375 | { |
| 10376 | //prefer 5GHz |
| 10377 | eBand = eCSR_BAND_5G; |
| 10378 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10379 | } |
| 10380 | } |
| 10381 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10382 | { |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10383 | // WiFi tests require IBSS networks to start in 11b mode |
| 10384 | // without any change to the default parameter settings |
| 10385 | // on the adapter. We use ACU to start an IBSS through |
| 10386 | // creation of a startIBSS profile. This startIBSS profile |
| 10387 | // has Auto MACProtocol and the adapter property setting |
| 10388 | // for dot11Mode is also AUTO. So in this case, let's |
| 10389 | // start the IBSS network in 11b mode instead of 11g mode. |
| 10390 | // So this is for Auto=profile->MacProtocol && Auto=Global. |
| 10391 | // dot11Mode && profile->channel is < 14, then start the IBSS |
| 10392 | // in b mode. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10393 | // |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10394 | // Note: we used to have this start as an 11g IBSS for best |
| 10395 | // performance... now to specify that the user will have to |
| 10396 | // set the do11Mode in the property page to 11g to force it. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10397 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10398 | eBand = eCSR_BAND_24; |
| 10399 | } |
| 10400 | else |
| 10401 | { |
| 10402 | // else, it's a 5.0GHz channel. Set mode to 11a. |
| 10403 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10404 | eBand = eCSR_BAND_5G; |
| 10405 | } |
| 10406 | break; |
| 10407 | }//switch |
| 10408 | }//if( eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 10409 | else |
| 10410 | { |
| 10411 | //dot11 mode is set, lets pick the band |
| 10412 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 10413 | { |
| 10414 | // channel is Auto also. |
| 10415 | eBand = pMac->roam.configParam.eBand; |
| 10416 | if(eCSR_BAND_ALL == eBand) |
| 10417 | { |
| 10418 | //prefer 5GHz |
| 10419 | eBand = eCSR_BAND_5G; |
| 10420 | } |
| 10421 | } |
| 10422 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10423 | { |
| 10424 | eBand = eCSR_BAND_24; |
| 10425 | } |
| 10426 | else |
| 10427 | { |
| 10428 | eBand = eCSR_BAND_5G; |
| 10429 | } |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10430 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10431 | if(pBand) |
| 10432 | { |
| 10433 | *pBand = eBand; |
| 10434 | } |
| 10435 | |
| 10436 | if (operationChn == 14){ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10437 | smsLog(pMac, LOGE, FL(" Switching to Dot11B mode ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10438 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10439 | } |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10440 | |
Madan Mohan Koyyalamudi | 5ec4b18 | 2012-11-28 16:15:17 -0800 | [diff] [blame] | 10441 | /* Incase of WEP Security encryption type is coming as part of add key. So while STart BSS dont have information */ |
| 10442 | 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] | 10443 | ((eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10444 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 10445 | (eCSR_CFG_DOT11_MODE_11AC == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10446 | #endif |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 10447 | (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode)) ) |
| 10448 | { |
| 10449 | //We cannot do 11n here |
| 10450 | if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10451 | { |
| 10452 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 10453 | } |
| 10454 | else |
| 10455 | { |
| 10456 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10457 | } |
| 10458 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10459 | return( cfgDot11Mode ); |
| 10460 | } |
| 10461 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10462 | eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 10463 | { |
| 10464 | eHalStatus status; |
| 10465 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10466 | |
| 10467 | if(!pSession) |
| 10468 | { |
| 10469 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10470 | return eHAL_STATUS_FAILURE; |
| 10471 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10472 | |
| 10473 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10474 | { |
| 10475 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10476 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 10477 | if(pIbssLog) |
| 10478 | { |
| 10479 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_REQ; |
| 10480 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 10481 | } |
| 10482 | } |
| 10483 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10484 | pSession->ibss_join_pending = FALSE; |
| 10485 | csrRoamStopIbssJoinTimer(pMac, sessionId ); |
| 10486 | // Set the roaming substate to 'stop Bss request'... |
| 10487 | csrRoamSubstateChange( pMac, NewSubstate, sessionId ); |
| 10488 | |
| 10489 | // attempt to stop the Bss (reason code is ignored...) |
| 10490 | status = csrSendMBStopBssReqMsg( pMac, sessionId ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 10491 | if(!HAL_STATUS_SUCCESS(status)) |
| 10492 | { |
| 10493 | smsLog(pMac, LOGW, FL("csrSendMBStopBssReqMsg failed with status %d"), status); |
| 10494 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10495 | return (status); |
| 10496 | } |
| 10497 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10498 | //pNumChan is a caller allocated space with the sizeof pChannels |
| 10499 | eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan) |
| 10500 | { |
| 10501 | |
| 10502 | return (ccmCfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 10503 | (tANI_U8 *)pChannels, |
| 10504 | pNumChan)); |
| 10505 | } |
| 10506 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 10507 | tPowerdBm csrGetCfgMaxTxPower (tpAniSirGlobal pMac, tANI_U8 channel) |
| 10508 | { |
| 10509 | tANI_U32 cfgLength = 0; |
| 10510 | tANI_U16 cfgId = 0; |
| 10511 | tPowerdBm maxTxPwr = 0; |
| 10512 | tANI_U8 *pCountryInfo = NULL; |
| 10513 | eHalStatus status; |
| 10514 | tANI_U8 count = 0; |
| 10515 | tANI_U8 firstChannel; |
| 10516 | tANI_U8 maxChannels; |
| 10517 | |
| 10518 | if (CSR_IS_CHANNEL_5GHZ(channel)) |
| 10519 | { |
| 10520 | cfgId = WNI_CFG_MAX_TX_POWER_5; |
| 10521 | cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN; |
| 10522 | } |
| 10523 | else if (CSR_IS_CHANNEL_24GHZ(channel)) |
| 10524 | { |
| 10525 | cfgId = WNI_CFG_MAX_TX_POWER_2_4; |
| 10526 | cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN; |
| 10527 | } |
| 10528 | else |
| 10529 | return maxTxPwr; |
| 10530 | |
| 10531 | status = palAllocateMemory(pMac->hHdd, (void **)&pCountryInfo, cfgLength); |
| 10532 | if (status != eHAL_STATUS_SUCCESS) |
| 10533 | { |
| 10534 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 10535 | FL("%s: palAllocateMemory() failed, status = %d"), |
| 10536 | __FUNCTION__, status); |
| 10537 | goto error; |
| 10538 | } |
| 10539 | status = ccmCfgGetStr(pMac, cfgId, (tANI_U8 *)pCountryInfo, &cfgLength); |
| 10540 | if (status != eHAL_STATUS_SUCCESS) |
| 10541 | { |
| 10542 | goto error; |
| 10543 | } |
| 10544 | /* Identify the channel and maxtxpower */ |
| 10545 | while (count <= (cfgLength - (sizeof(tSirMacChanInfo)))) |
| 10546 | { |
| 10547 | firstChannel = pCountryInfo[count++]; |
| 10548 | maxChannels = pCountryInfo[count++]; |
| 10549 | maxTxPwr = pCountryInfo[count++]; |
| 10550 | |
| 10551 | if ((channel >= firstChannel) && |
| 10552 | (channel < (firstChannel + maxChannels))) |
| 10553 | { |
| 10554 | break; |
| 10555 | } |
| 10556 | } |
| 10557 | |
| 10558 | error: |
| 10559 | if (NULL != pCountryInfo) |
| 10560 | palFreeMemory(pMac->hHdd, pCountryInfo); |
| 10561 | |
| 10562 | return maxTxPwr; |
| 10563 | } |
| 10564 | |
| 10565 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10566 | tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel ) |
| 10567 | { |
| 10568 | tANI_BOOLEAN fValid = FALSE; |
| 10569 | tANI_U32 idxValidChannels; |
| 10570 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10571 | |
| 10572 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len))) |
| 10573 | { |
| 10574 | for ( idxValidChannels = 0; ( idxValidChannels < len ); idxValidChannels++ ) |
| 10575 | { |
| 10576 | if ( channel == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10577 | { |
| 10578 | fValid = TRUE; |
| 10579 | break; |
| 10580 | } |
| 10581 | } |
| 10582 | } |
| 10583 | pMac->roam.numValidChannels = len; |
| 10584 | return fValid; |
| 10585 | } |
| 10586 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10587 | tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel) |
| 10588 | { |
| 10589 | tANI_BOOLEAN fValid = eANI_BOOLEAN_FALSE; |
| 10590 | tANI_U8 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10591 | for(i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++) |
| 10592 | { |
| 10593 | if(channel == pMac->scan.base40MHzChannels.channelList[i]) |
| 10594 | { |
| 10595 | fValid = eANI_BOOLEAN_TRUE; |
| 10596 | break; |
| 10597 | } |
| 10598 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10599 | return (fValid); |
| 10600 | } |
| 10601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10602 | //This function check and validate whether the NIC can do CB (40MHz) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10603 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10604 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10605 | ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10606 | tANI_U8 centerChn; |
| 10607 | tANI_U32 ChannelBondingMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10608 | if(CSR_IS_CHANNEL_24GHZ(primaryChn)) |
| 10609 | { |
| 10610 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 10611 | } |
| 10612 | else |
| 10613 | { |
| 10614 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 10615 | } |
| 10616 | //Figure what the other side's CB mode |
| 10617 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 10618 | { |
| 10619 | if(pIes->HTCaps.present && (eHT_CHANNEL_WIDTH_40MHZ == pIes->HTCaps.supportedChannelWidthSet)) |
| 10620 | { |
| 10621 | if(pIes->HTInfo.present) |
| 10622 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10623 | /* This is called during INFRA STA/CLIENT and should use the merged value of |
| 10624 | * supported channel width and recommended tx width as per standard |
| 10625 | */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10626 | smsLog(pMac, LOG1, "scws %u rtws %u sco %u", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10627 | pIes->HTCaps.supportedChannelWidthSet, |
| 10628 | pIes->HTInfo.recommendedTxWidthSet, |
| 10629 | pIes->HTInfo.secondaryChannelOffset); |
| 10630 | |
| 10631 | if (pIes->HTInfo.recommendedTxWidthSet == eHT_CHANNEL_WIDTH_40MHZ) |
| 10632 | eRet = (ePhyChanBondState)pIes->HTInfo.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10633 | else |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10634 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 10635 | switch (eRet) { |
| 10636 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 10637 | centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET; |
| 10638 | break; |
| 10639 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 10640 | centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET; |
| 10641 | break; |
| 10642 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 10643 | default: |
| 10644 | centerChn = primaryChn; |
| 10645 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10646 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10647 | if((PHY_SINGLE_CHANNEL_CENTERED != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10648 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10649 | smsLog(pMac, LOGE, " Invalid center channel (%d), disable 40MHz mode", centerChn); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10650 | //eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10651 | } |
| 10652 | } |
| 10653 | } |
| 10654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10655 | return eRet; |
| 10656 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10657 | tANI_BOOLEAN csrIsEncryptionInList( tpAniSirGlobal pMac, tCsrEncryptionList *pCipherList, eCsrEncryptionType encryptionType ) |
| 10658 | { |
| 10659 | tANI_BOOLEAN fFound = FALSE; |
| 10660 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10661 | for( idx = 0; idx < pCipherList->numEntries; idx++ ) |
| 10662 | { |
| 10663 | if( pCipherList->encryptionType[idx] == encryptionType ) |
| 10664 | { |
| 10665 | fFound = TRUE; |
| 10666 | break; |
| 10667 | } |
| 10668 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10669 | return fFound; |
| 10670 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10671 | tANI_BOOLEAN csrIsAuthInList( tpAniSirGlobal pMac, tCsrAuthList *pAuthList, eCsrAuthType authType ) |
| 10672 | { |
| 10673 | tANI_BOOLEAN fFound = FALSE; |
| 10674 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10675 | for( idx = 0; idx < pAuthList->numEntries; idx++ ) |
| 10676 | { |
| 10677 | if( pAuthList->authType[idx] == authType ) |
| 10678 | { |
| 10679 | fFound = TRUE; |
| 10680 | break; |
| 10681 | } |
| 10682 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10683 | return fFound; |
| 10684 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10685 | tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2) |
| 10686 | { |
| 10687 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 10688 | tCsrScanResultFilter *pScanFilter = NULL; |
| 10689 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10690 | |
| 10691 | if(pProfile1 && pProfile2) |
| 10692 | { |
| 10693 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 10694 | if(HAL_STATUS_SUCCESS(status)) |
| 10695 | { |
| 10696 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 10697 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile2, pScanFilter); |
| 10698 | if(HAL_STATUS_SUCCESS(status)) |
| 10699 | { |
| 10700 | fCheck = eANI_BOOLEAN_FALSE; |
| 10701 | do |
| 10702 | { |
| 10703 | tANI_U32 i; |
| 10704 | for(i = 0; i < pScanFilter->SSIDs.numOfSSIDs; i++) |
| 10705 | { |
| 10706 | fCheck = csrIsSsidMatch( pMac, pScanFilter->SSIDs.SSIDList[i].SSID.ssId, |
| 10707 | pScanFilter->SSIDs.SSIDList[i].SSID.length, |
| 10708 | pProfile1->SSID.ssId, pProfile1->SSID.length, eANI_BOOLEAN_FALSE ); |
| 10709 | if ( fCheck ) break; |
| 10710 | } |
| 10711 | if(!fCheck) |
| 10712 | { |
| 10713 | break; |
| 10714 | } |
| 10715 | if( !csrIsAuthInList( pMac, &pProfile2->AuthType, pProfile1->AuthType) |
| 10716 | || pProfile2->BSSType != pProfile1->BSSType |
| 10717 | || !csrIsEncryptionInList( pMac, &pProfile2->EncryptionType, pProfile1->EncryptionType ) |
| 10718 | ) |
| 10719 | { |
| 10720 | fCheck = eANI_BOOLEAN_FALSE; |
| 10721 | break; |
| 10722 | } |
| 10723 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10724 | if (pProfile1->MDID.mdiePresent || pProfile2->MDID.mdiePresent) |
| 10725 | { |
| 10726 | if (pProfile1->MDID.mobilityDomain != pProfile2->MDID.mobilityDomain) |
| 10727 | { |
| 10728 | fCheck = eANI_BOOLEAN_FALSE; |
| 10729 | break; |
| 10730 | } |
| 10731 | } |
| 10732 | #endif |
| 10733 | //Match found |
| 10734 | fCheck = eANI_BOOLEAN_TRUE; |
| 10735 | }while(0); |
| 10736 | csrFreeScanFilter(pMac, pScanFilter); |
| 10737 | } |
| 10738 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 10739 | } |
| 10740 | } |
| 10741 | |
| 10742 | return (fCheck); |
| 10743 | } |
| 10744 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10745 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2) |
| 10746 | { |
| 10747 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 10748 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10749 | do |
| 10750 | { |
| 10751 | //Only check for static WEP |
| 10752 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) && |
| 10753 | !csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) |
| 10754 | { |
| 10755 | fCheck = eANI_BOOLEAN_TRUE; |
| 10756 | break; |
| 10757 | } |
| 10758 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, pConnProfile->EncryptionType)) break; |
| 10759 | if(pConnProfile->Keys.defaultIndex != pProfile2->Keys.defaultIndex) break; |
| 10760 | for(i = 0; i < CSR_MAX_NUM_KEY; i++) |
| 10761 | { |
| 10762 | if(pConnProfile->Keys.KeyLength[i] != pProfile2->Keys.KeyLength[i]) break; |
| 10763 | if(!palEqualMemory(pMac->hHdd, &pConnProfile->Keys.KeyMaterial[i], |
| 10764 | &pProfile2->Keys.KeyMaterial[i], pProfile2->Keys.KeyLength[i])) |
| 10765 | { |
| 10766 | break; |
| 10767 | } |
| 10768 | } |
| 10769 | if( i == CSR_MAX_NUM_KEY) |
| 10770 | { |
| 10771 | fCheck = eANI_BOOLEAN_TRUE; |
| 10772 | } |
| 10773 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10774 | return (fCheck); |
| 10775 | } |
| 10776 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10777 | //IBSS |
| 10778 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10779 | tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac ) |
| 10780 | { |
| 10781 | tANI_U8 channel = 0; |
| 10782 | tANI_U32 idx; |
| 10783 | tANI_U32 idxValidChannels; |
| 10784 | tANI_BOOLEAN fFound = FALSE; |
| 10785 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10786 | |
| 10787 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel5G) |
| 10788 | { |
| 10789 | channel = pMac->roam.configParam.AdHocChannel5G; |
| 10790 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 10791 | { |
| 10792 | channel = 0; |
| 10793 | } |
| 10794 | } |
| 10795 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 10796 | { |
| 10797 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_50 ) && !fFound; idx++ ) |
| 10798 | { |
| 10799 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 10800 | { |
| 10801 | if ( csrStartIbssChannels50[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10802 | { |
| 10803 | fFound = TRUE; |
| 10804 | channel = csrStartIbssChannels50[ idx ]; |
| 10805 | } |
| 10806 | } |
| 10807 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10808 | // this is rare, but if it does happen, we find anyone in 11a bandwidth and return the first 11a channel found! |
| 10809 | if (!fFound) |
| 10810 | { |
| 10811 | for ( idxValidChannels = 0; idxValidChannels < len ; idxValidChannels++ ) |
| 10812 | { |
| 10813 | if ( CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ idx ]) ) // the max channel# in 11g is 14 |
| 10814 | { |
| 10815 | channel = csrStartIbssChannels50[ idx ]; |
| 10816 | break; |
| 10817 | } |
| 10818 | } |
| 10819 | } |
| 10820 | }//if |
| 10821 | |
| 10822 | return( channel ); |
| 10823 | } |
| 10824 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10825 | tANI_U8 csrRoamGetIbssStartChannelNumber24( tpAniSirGlobal pMac ) |
| 10826 | { |
| 10827 | tANI_U8 channel = 1; |
| 10828 | tANI_U32 idx; |
| 10829 | tANI_U32 idxValidChannels; |
| 10830 | tANI_BOOLEAN fFound = FALSE; |
| 10831 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10832 | |
| 10833 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel24) |
| 10834 | { |
| 10835 | channel = pMac->roam.configParam.AdHocChannel24; |
| 10836 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 10837 | { |
| 10838 | channel = 0; |
| 10839 | } |
| 10840 | } |
| 10841 | |
| 10842 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 10843 | { |
| 10844 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_24 ) && !fFound; idx++ ) |
| 10845 | { |
| 10846 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 10847 | { |
| 10848 | if ( csrStartIbssChannels24[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10849 | { |
| 10850 | fFound = TRUE; |
| 10851 | channel = csrStartIbssChannels24[ idx ]; |
| 10852 | } |
| 10853 | } |
| 10854 | } |
| 10855 | } |
| 10856 | |
| 10857 | return( channel ); |
| 10858 | } |
| 10859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10860 | static void csrRoamGetBssStartParms( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 10861 | tCsrRoamStartBssParams *pParam ) |
| 10862 | { |
| 10863 | eCsrCfgDot11Mode cfgDot11Mode; |
| 10864 | eCsrBand eBand; |
| 10865 | tANI_U8 channel = 0; |
| 10866 | tSirNwType nwType; |
| 10867 | tANI_U8 operationChannel = 0; |
| 10868 | |
| 10869 | if(pProfile->ChannelInfo.numOfChannels && pProfile->ChannelInfo.ChannelList) |
| 10870 | { |
| 10871 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 10872 | } |
| 10873 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10874 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10875 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10876 | if( ( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 10877 | (pProfile->csrPersona == VOS_P2P_GO_MODE) ) |
| 10878 | && ( cfgDot11Mode == eCSR_CFG_DOT11_MODE_11B) |
| 10879 | ) |
| 10880 | { |
| 10881 | /* This should never happen */ |
| 10882 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10883 | FL("For P2PClient/P2P-GO (persona %d) cfgDot11Mode is 11B"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10884 | pProfile->csrPersona); |
| 10885 | VOS_ASSERT(0); |
| 10886 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10887 | switch( cfgDot11Mode ) |
| 10888 | { |
| 10889 | case eCSR_CFG_DOT11_MODE_11G: |
| 10890 | nwType = eSIR_11G_NW_TYPE; |
| 10891 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10892 | case eCSR_CFG_DOT11_MODE_11B: |
| 10893 | nwType = eSIR_11B_NW_TYPE; |
| 10894 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10895 | case eCSR_CFG_DOT11_MODE_11A: |
| 10896 | nwType = eSIR_11A_NW_TYPE; |
| 10897 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10898 | default: |
| 10899 | case eCSR_CFG_DOT11_MODE_11N: |
| 10900 | case eCSR_CFG_DOT11_MODE_TAURUS: |
| 10901 | //Because LIM only verifies it against 11a, 11b or 11g, set only 11g or 11a here |
| 10902 | if(eCSR_BAND_24 == eBand) |
| 10903 | { |
| 10904 | nwType = eSIR_11G_NW_TYPE; |
| 10905 | } |
| 10906 | else |
| 10907 | { |
| 10908 | nwType = eSIR_11A_NW_TYPE; |
| 10909 | } |
| 10910 | break; |
| 10911 | } |
| 10912 | |
| 10913 | pParam->extendedRateSet.numRates = 0; |
| 10914 | |
| 10915 | switch ( nwType ) |
| 10916 | { |
| 10917 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10918 | smsLog(pMac, LOGE, FL("sees an unknown pSirNwType (%d)"), nwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10919 | case eSIR_11A_NW_TYPE: |
| 10920 | |
| 10921 | pParam->operationalRateSet.numRates = 8; |
| 10922 | |
| 10923 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 10924 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10925 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 10926 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10927 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 10928 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10929 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10930 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10931 | |
| 10932 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10933 | { |
| 10934 | channel = csrRoamGetIbssStartChannelNumber50( pMac ); |
| 10935 | if( 0 == channel && |
| 10936 | CSR_IS_PHY_MODE_DUAL_BAND(pProfile->phyMode) && |
| 10937 | CSR_IS_PHY_MODE_DUAL_BAND(pMac->roam.configParam.phyMode) |
| 10938 | ) |
| 10939 | { |
| 10940 | //We could not find a 5G channel by auto pick, let's try 2.4G channels |
| 10941 | //We only do this here because csrRoamGetPhyModeBandForBss always picks 11a for AUTO |
| 10942 | nwType = eSIR_11B_NW_TYPE; |
| 10943 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10944 | pParam->operationalRateSet.numRates = 4; |
| 10945 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10946 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10947 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10948 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 10949 | } |
| 10950 | } |
| 10951 | else |
| 10952 | { |
| 10953 | channel = operationChannel; |
| 10954 | } |
| 10955 | break; |
| 10956 | |
| 10957 | case eSIR_11B_NW_TYPE: |
| 10958 | pParam->operationalRateSet.numRates = 4; |
| 10959 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10960 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10961 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10962 | 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] | 10963 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10964 | { |
| 10965 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10966 | } |
| 10967 | else |
| 10968 | { |
| 10969 | channel = operationChannel; |
| 10970 | } |
| 10971 | |
| 10972 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10973 | case eSIR_11G_NW_TYPE: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10974 | /* For P2P Client and P2P GO, disable 11b rates */ |
| 10975 | if( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 10976 | (pProfile->csrPersona == VOS_P2P_GO_MODE) |
| 10977 | ) |
| 10978 | { |
| 10979 | pParam->operationalRateSet.numRates = 8; |
| 10980 | |
| 10981 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 10982 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10983 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 10984 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10985 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 10986 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10987 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10988 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10989 | } |
| 10990 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10991 | { |
| 10992 | pParam->operationalRateSet.numRates = 4; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10993 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10994 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10995 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10996 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 10997 | |
| 10998 | pParam->extendedRateSet.numRates = 8; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10999 | pParam->extendedRateSet.rate[0] = SIR_MAC_RATE_6; |
| 11000 | pParam->extendedRateSet.rate[1] = SIR_MAC_RATE_9; |
| 11001 | pParam->extendedRateSet.rate[2] = SIR_MAC_RATE_12; |
| 11002 | pParam->extendedRateSet.rate[3] = SIR_MAC_RATE_18; |
| 11003 | pParam->extendedRateSet.rate[4] = SIR_MAC_RATE_24; |
| 11004 | pParam->extendedRateSet.rate[5] = SIR_MAC_RATE_36; |
| 11005 | pParam->extendedRateSet.rate[6] = SIR_MAC_RATE_48; |
| 11006 | pParam->extendedRateSet.rate[7] = SIR_MAC_RATE_54; |
| 11007 | } |
| 11008 | |
| 11009 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 11010 | { |
| 11011 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 11012 | } |
| 11013 | else |
| 11014 | { |
| 11015 | channel = operationChannel; |
| 11016 | } |
| 11017 | |
| 11018 | break; |
| 11019 | } |
| 11020 | pParam->operationChn = channel; |
| 11021 | pParam->sirNwType = nwType; |
| 11022 | } |
| 11023 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11024 | static void csrRoamGetBssStartParmsFromBssDesc( tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, |
| 11025 | tDot11fBeaconIEs *pIes, tCsrRoamStartBssParams *pParam ) |
| 11026 | { |
| 11027 | |
| 11028 | if( pParam ) |
| 11029 | { |
| 11030 | pParam->sirNwType = pBssDesc->nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11031 | pParam->cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11032 | pParam->operationChn = pBssDesc->channelId; |
| 11033 | palCopyMemory( pMac->hHdd, &pParam->bssid, pBssDesc->bssId, sizeof(tCsrBssid) ); |
| 11034 | |
| 11035 | if( pIes ) |
| 11036 | { |
| 11037 | if(pIes->SuppRates.present) |
| 11038 | { |
| 11039 | pParam->operationalRateSet.numRates = pIes->SuppRates.num_rates; |
| 11040 | if(pIes->SuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) |
| 11041 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11042 | 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] | 11043 | pIes->SuppRates.num_rates); |
| 11044 | pIes->SuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
| 11045 | } |
| 11046 | palCopyMemory(pMac->hHdd, pParam->operationalRateSet.rate, pIes->SuppRates.rates, |
| 11047 | sizeof(*pIes->SuppRates.rates) * pIes->SuppRates.num_rates); |
| 11048 | } |
| 11049 | if( pIes->SSID.present ) |
| 11050 | { |
| 11051 | pParam->ssId.length = pIes->SSID.num_ssid; |
| 11052 | palCopyMemory(pMac->hHdd, pParam->ssId.ssId, pIes->SSID.ssid, pParam->ssId.length); |
| 11053 | } |
| 11054 | pParam->cbMode = csrGetCBModeFromIes(pMac, pParam->operationChn, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11055 | } |
| 11056 | else |
| 11057 | { |
| 11058 | pParam->ssId.length = 0; |
| 11059 | pParam->operationalRateSet.numRates = 0; |
| 11060 | } |
| 11061 | } |
| 11062 | } |
| 11063 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11064 | static void csrRoamDetermineMaxRateForAdHoc( tpAniSirGlobal pMac, tSirMacRateSet *pSirRateSet ) |
| 11065 | { |
| 11066 | tANI_U8 MaxRate = 0; |
| 11067 | tANI_U32 i; |
| 11068 | tANI_U8 *pRate; |
| 11069 | |
| 11070 | pRate = pSirRateSet->rate; |
| 11071 | for ( i = 0; i < pSirRateSet->numRates; i++ ) |
| 11072 | { |
| 11073 | MaxRate = CSR_MAX( MaxRate, ( pRate[ i ] & (~CSR_DOT11_BASIC_RATE_MASK) ) ); |
| 11074 | } |
| 11075 | |
| 11076 | // Save the max rate in the connected state information... |
| 11077 | |
| 11078 | // modify LastRates variable as well |
| 11079 | |
| 11080 | return; |
| 11081 | } |
| 11082 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11083 | eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, |
| 11084 | tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId ) |
| 11085 | { |
| 11086 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11087 | eCsrBand eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11088 | // Set the roaming substate to 'Start BSS attempt'... |
| 11089 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11090 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11091 | //Need to figure out whether we need to log WDS??? |
| 11092 | if( CSR_IS_IBSS( pProfile ) ) |
| 11093 | { |
| 11094 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11095 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 11096 | if(pIbssLog) |
| 11097 | { |
| 11098 | if(pBssDesc) |
| 11099 | { |
| 11100 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_REQ; |
| 11101 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pBssDesc->bssId, 6); |
| 11102 | } |
| 11103 | else |
| 11104 | { |
| 11105 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_REQ; |
| 11106 | } |
| 11107 | palCopyMemory(pMac->hHdd, pIbssLog->ssid, pParam->ssId.ssId, |
| 11108 | pParam->ssId.length); |
| 11109 | if(pProfile->ChannelInfo.numOfChannels == 0) |
| 11110 | { |
| 11111 | pIbssLog->channelSetting = AUTO_PICK; |
| 11112 | } |
| 11113 | else |
| 11114 | { |
| 11115 | pIbssLog->channelSetting = SPECIFIED; |
| 11116 | } |
| 11117 | pIbssLog->operatingChannel = pParam->operationChn; |
| 11118 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 11119 | } |
| 11120 | } |
| 11121 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11122 | //Put RSN information in for Starting BSS |
| 11123 | pParam->nRSNIELength = (tANI_U16)pProfile->nRSNReqIELength; |
| 11124 | pParam->pRSNIE = pProfile->pRSNReqIE; |
| 11125 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11126 | pParam->privacy = pProfile->privacy; |
| 11127 | pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq; |
| 11128 | pParam->authType = pProfile->csr80211AuthType; |
| 11129 | pParam->beaconInterval = pProfile->beaconInterval; |
| 11130 | pParam->dtimPeriod = pProfile->dtimPeriod; |
| 11131 | pParam->ApUapsdEnable = pProfile->ApUapsdEnable; |
| 11132 | pParam->ssidHidden = pProfile->SSIDs.SSIDList[0].ssidHidden; |
| 11133 | if (CSR_IS_INFRA_AP(pProfile)&& (pParam->operationChn != 0)) |
| 11134 | { |
| 11135 | if (csrIsValidChannel(pMac, pParam->operationChn) != eHAL_STATUS_SUCCESS) |
| 11136 | { |
| 11137 | pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL; |
| 11138 | } |
| 11139 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11140 | pParam->protEnabled = pProfile->protEnabled; |
| 11141 | pParam->obssProtEnabled = pProfile->obssProtEnabled; |
| 11142 | pParam->ht_protection = pProfile->cfg_protection; |
| 11143 | pParam->wps_state = pProfile->wps_state; |
Jeff Johnson | 96fbeeb | 2013-02-26 21:23:00 -0800 | [diff] [blame] | 11144 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11145 | pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, pParam->operationChn /* pProfile->operationChannel*/, |
| 11146 | &eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11147 | pParam->bssPersona = pProfile->csrPersona; |
| 11148 | // When starting an IBSS, start on the channel from the Profile. |
| 11149 | status = csrSendMBStartBssReqMsg( pMac, sessionId, pProfile->BSSType, pParam, pBssDesc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11150 | return (status); |
| 11151 | } |
| 11152 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11153 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11154 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11155 | { |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11156 | tANI_U8 Channel; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11157 | ePhyChanBondState cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11158 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11159 | |
| 11160 | if(!pSession) |
| 11161 | { |
| 11162 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11163 | return; |
| 11164 | } |
| 11165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11166 | if( pBssDesc ) |
| 11167 | { |
| 11168 | csrRoamGetBssStartParmsFromBssDesc( pMac, pBssDesc, pIes, &pSession->bssParams ); |
| 11169 | //Since csrRoamGetBssStartParmsFromBssDesc fills in the bssid for pSession->bssParams |
| 11170 | //The following code has to be do after that. |
| 11171 | //For WDS station, use selfMac as the self BSSID |
| 11172 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 11173 | { |
| 11174 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid)); |
| 11175 | } |
| 11176 | } |
| 11177 | else |
| 11178 | { |
| 11179 | csrRoamGetBssStartParms(pMac, pProfile, &pSession->bssParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11180 | //Use the first SSID |
| 11181 | if(pProfile->SSIDs.numOfSSIDs) |
| 11182 | { |
| 11183 | palCopyMemory(pMac->hHdd, &pSession->bssParams.ssId, pProfile->SSIDs.SSIDList, sizeof(tSirMacSSid)); |
| 11184 | } |
| 11185 | //For WDS station, use selfMac as the self BSSID |
| 11186 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 11187 | { |
| 11188 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid)); |
| 11189 | } |
| 11190 | //Use the first BSSID |
| 11191 | else if( pProfile->BSSIDs.numOfBSSIDs ) |
| 11192 | { |
| 11193 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 11194 | } |
| 11195 | else |
| 11196 | { |
| 11197 | palZeroMemory( pMac->hHdd, &pSession->bssParams.bssid, sizeof(tCsrBssid) ); |
| 11198 | } |
| 11199 | } |
| 11200 | Channel = pSession->bssParams.operationChn; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11201 | //Set operating channel in pProfile which will be used |
| 11202 | //in csrRoamSetBssConfigCfg() to determine channel bonding |
| 11203 | //mode and will be configured in CFG later |
| 11204 | pProfile->operationChannel = Channel; |
| 11205 | |
| 11206 | if(Channel == 0) |
| 11207 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11208 | smsLog(pMac, LOGW, " CSR cannot find a channel to start IBSS"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11209 | } |
| 11210 | else |
| 11211 | { |
| 11212 | |
| 11213 | csrRoamDetermineMaxRateForAdHoc( pMac, &pSession->bssParams.operationalRateSet ); |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11214 | if (CSR_IS_INFRA_AP(pProfile) || CSR_IS_START_IBSS( pProfile ) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11215 | { |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11216 | if(CSR_IS_CHANNEL_24GHZ(Channel) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11217 | { |
| 11218 | cbMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 11219 | } |
| 11220 | else |
| 11221 | { |
| 11222 | cbMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 11223 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11224 | smsLog(pMac, LOG1, "## cbMode %d", cbMode); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11225 | pBssConfig->cbMode = cbMode; |
| 11226 | pSession->bssParams.cbMode = cbMode; |
| 11227 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11228 | } |
| 11229 | } |
| 11230 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11231 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 11232 | tANI_BOOLEAN *pfSameIbss ) |
| 11233 | { |
| 11234 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11235 | tANI_BOOLEAN fSameIbss = FALSE; |
| 11236 | |
| 11237 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 11238 | { |
| 11239 | // Check if any profile parameter has changed ? If any profile parameter |
| 11240 | // has changed then stop old BSS and start a new one with new parameters |
| 11241 | if ( csrIsSameProfile( pMac, &pMac->roam.roamSession[sessionId].connectedProfile, pProfile ) ) |
| 11242 | { |
| 11243 | fSameIbss = TRUE; |
| 11244 | } |
| 11245 | else |
| 11246 | { |
| 11247 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 11248 | } |
| 11249 | } |
| 11250 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 11251 | { |
| 11252 | // Disassociate from the connected Infrastructure network... |
| 11253 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 11254 | } |
| 11255 | else |
| 11256 | { |
| 11257 | tBssConfigParam *pBssConfig; |
| 11258 | |
| 11259 | status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); |
| 11260 | if(HAL_STATUS_SUCCESS(status)) |
| 11261 | { |
| 11262 | palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam)); |
| 11263 | // there is no Bss description before we start an IBSS so we need to adopt |
| 11264 | // all Bss configuration parameters from the Profile. |
| 11265 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, pBssConfig, NULL); |
| 11266 | if(HAL_STATUS_SUCCESS(status)) |
| 11267 | { |
| 11268 | //save dotMode |
| 11269 | pMac->roam.roamSession[sessionId].bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
| 11270 | //Prepare some more parameters for this IBSS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11271 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11272 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
| 11273 | } |
| 11274 | |
| 11275 | palFreeMemory(pMac->hHdd, pBssConfig); |
| 11276 | }//Allocate memory |
| 11277 | } |
| 11278 | |
| 11279 | if(pfSameIbss) |
| 11280 | { |
| 11281 | *pfSameIbss = fSameIbss; |
| 11282 | } |
| 11283 | return( status ); |
| 11284 | } |
| 11285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11286 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11287 | tSirSmeNewBssInfo *pNewBss ) |
| 11288 | { |
| 11289 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11290 | |
| 11291 | if(!pSession) |
| 11292 | { |
| 11293 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11294 | return; |
| 11295 | } |
| 11296 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11297 | if( pNewBss ) |
| 11298 | { |
| 11299 | // Set the operating channel. |
| 11300 | pSession->connectedProfile.operationChannel = pNewBss->channelNumber; |
| 11301 | // move the BSSId from the BSS description into the connected state information. |
| 11302 | palCopyMemory( pMac->hHdd, &pSession->connectedProfile.bssid, |
| 11303 | &(pNewBss->bssId), sizeof( tCsrBssid ) ); |
| 11304 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11305 | return; |
| 11306 | } |
| 11307 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11308 | #ifdef FEATURE_WLAN_WAPI |
| 11309 | eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, |
| 11310 | tANI_U32 numItems ) |
| 11311 | { |
| 11312 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11313 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11314 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11315 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11316 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11317 | return status; |
| 11318 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11319 | smsLog(pMac, LOGW, "csrRoamSetBKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11320 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11321 | if(numItems <= CSR_MAX_BKID_ALLOWED) |
| 11322 | { |
| 11323 | status = eHAL_STATUS_SUCCESS; |
| 11324 | //numItems may be 0 to clear the cache |
| 11325 | pSession->NumBkidCache = (tANI_U16)numItems; |
| 11326 | if(numItems && pBKIDCache) |
| 11327 | { |
| 11328 | status = palCopyMemory( pMac->hHdd, pSession->BkidCacheInfo, pBKIDCache, |
| 11329 | sizeof(tBkidCacheInfo) * numItems ); |
| 11330 | } |
| 11331 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11332 | return (status); |
| 11333 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11334 | eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, |
| 11335 | tBkidCacheInfo *pBkidCache) |
| 11336 | { |
| 11337 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11338 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11339 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11340 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11341 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11342 | return status; |
| 11343 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11344 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11345 | if(pNum && pBkidCache) |
| 11346 | { |
| 11347 | if(pSession->NumBkidCache == 0) |
| 11348 | { |
| 11349 | *pNum = 0; |
| 11350 | status = eHAL_STATUS_SUCCESS; |
| 11351 | } |
| 11352 | else if(*pNum >= pSession->NumBkidCache) |
| 11353 | { |
| 11354 | if(pSession->NumBkidCache > CSR_MAX_PMKID_ALLOWED) |
| 11355 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11356 | 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] | 11357 | pSession->NumBkidCache); |
| 11358 | pSession->NumBkidCache = CSR_MAX_PMKID_ALLOWED; |
| 11359 | } |
| 11360 | palCopyMemory( pMac->hHdd, pBkidCache, pSession->BkidCacheInfo, |
| 11361 | sizeof(tBkidCacheInfo) * pSession->NumBkidCache ); |
| 11362 | *pNum = pSession->NumBkidCache; |
| 11363 | status = eHAL_STATUS_SUCCESS; |
| 11364 | } |
| 11365 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11366 | return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11367 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11368 | tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11369 | { |
| 11370 | return (pMac->roam.roamSession[sessionId].NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11371 | } |
| 11372 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11373 | eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11374 | tPmkidCacheInfo *pPMKIDCache, tANI_U32 numItems ) |
| 11375 | { |
| 11376 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11377 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11378 | |
| 11379 | if(!pSession) |
| 11380 | { |
| 11381 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11382 | return eHAL_STATUS_FAILURE; |
| 11383 | } |
| 11384 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11385 | smsLog(pMac, LOGW, "csrRoamSetPMKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11386 | if(numItems <= CSR_MAX_PMKID_ALLOWED) |
| 11387 | { |
| 11388 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11389 | { |
| 11390 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
| 11391 | palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 11392 | secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_UPDATE; |
| 11393 | secEvent.encryptionModeMulticast = |
| 11394 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 11395 | secEvent.encryptionModeUnicast = |
| 11396 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 11397 | palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 11398 | secEvent.authMode = |
| 11399 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 11400 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 11401 | } |
| 11402 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11403 | status = eHAL_STATUS_SUCCESS; |
| 11404 | //numItems may be 0 to clear the cache |
| 11405 | pSession->NumPmkidCache = (tANI_U16)numItems; |
| 11406 | if(numItems && pPMKIDCache) |
| 11407 | { |
| 11408 | status = palCopyMemory( pMac->hHdd, pSession->PmkidCacheInfo, pPMKIDCache, |
| 11409 | sizeof(tPmkidCacheInfo) * numItems ); |
| 11410 | } |
| 11411 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11412 | return (status); |
| 11413 | } |
| 11414 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11415 | tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11416 | { |
| 11417 | return (pMac->roam.roamSession[sessionId].NumPmkidCache); |
| 11418 | } |
| 11419 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11420 | eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache) |
| 11421 | { |
| 11422 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11423 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11424 | |
| 11425 | if(!pSession) |
| 11426 | { |
| 11427 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11428 | return eHAL_STATUS_FAILURE; |
| 11429 | } |
| 11430 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11431 | if(pNum && pPmkidCache) |
| 11432 | { |
| 11433 | if(pSession->NumPmkidCache == 0) |
| 11434 | { |
| 11435 | *pNum = 0; |
| 11436 | status = eHAL_STATUS_SUCCESS; |
| 11437 | } |
| 11438 | else if(*pNum >= pSession->NumPmkidCache) |
| 11439 | { |
| 11440 | if(pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED) |
| 11441 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11442 | 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] | 11443 | pSession->NumPmkidCache); |
| 11444 | pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED; |
| 11445 | } |
| 11446 | palCopyMemory( pMac->hHdd, pPmkidCache, pSession->PmkidCacheInfo, |
| 11447 | sizeof(tPmkidCacheInfo) * pSession->NumPmkidCache ); |
| 11448 | *pNum = pSession->NumPmkidCache; |
| 11449 | status = eHAL_STATUS_SUCCESS; |
| 11450 | } |
| 11451 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11452 | return (status); |
| 11453 | } |
| 11454 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11455 | eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11456 | { |
| 11457 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11458 | tANI_U32 len; |
| 11459 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11460 | |
| 11461 | if(!pSession) |
| 11462 | { |
| 11463 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11464 | return eHAL_STATUS_FAILURE; |
| 11465 | } |
| 11466 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11467 | if(pLen) |
| 11468 | { |
| 11469 | len = *pLen; |
| 11470 | *pLen = pSession->nWpaRsnReqIeLength; |
| 11471 | if(pBuf) |
| 11472 | { |
| 11473 | if(len >= pSession->nWpaRsnReqIeLength) |
| 11474 | { |
| 11475 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnReqIE, pSession->nWpaRsnReqIeLength); |
| 11476 | } |
| 11477 | } |
| 11478 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11479 | return (status); |
| 11480 | } |
| 11481 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11482 | eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11483 | { |
| 11484 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11485 | tANI_U32 len; |
| 11486 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11487 | |
| 11488 | if(!pSession) |
| 11489 | { |
| 11490 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11491 | return eHAL_STATUS_FAILURE; |
| 11492 | } |
| 11493 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11494 | if(pLen) |
| 11495 | { |
| 11496 | len = *pLen; |
| 11497 | *pLen = pSession->nWpaRsnRspIeLength; |
| 11498 | if(pBuf) |
| 11499 | { |
| 11500 | if(len >= pSession->nWpaRsnRspIeLength) |
| 11501 | { |
| 11502 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnRspIE, pSession->nWpaRsnRspIeLength); |
| 11503 | } |
| 11504 | } |
| 11505 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11506 | return (status); |
| 11507 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11508 | #ifdef FEATURE_WLAN_WAPI |
| 11509 | eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11510 | { |
| 11511 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11512 | tANI_U32 len; |
| 11513 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11514 | |
| 11515 | if(!pSession) |
| 11516 | { |
| 11517 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11518 | return eHAL_STATUS_FAILURE; |
| 11519 | } |
| 11520 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11521 | if(pLen) |
| 11522 | { |
| 11523 | len = *pLen; |
| 11524 | *pLen = pSession->nWapiReqIeLength; |
| 11525 | if(pBuf) |
| 11526 | { |
| 11527 | if(len >= pSession->nWapiReqIeLength) |
| 11528 | { |
| 11529 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiReqIE, pSession->nWapiReqIeLength); |
| 11530 | } |
| 11531 | } |
| 11532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11533 | return (status); |
| 11534 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11535 | eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11536 | { |
| 11537 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11538 | tANI_U32 len; |
| 11539 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11540 | |
| 11541 | if(!pSession) |
| 11542 | { |
| 11543 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11544 | return eHAL_STATUS_FAILURE; |
| 11545 | } |
| 11546 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11547 | if(pLen) |
| 11548 | { |
| 11549 | len = *pLen; |
| 11550 | *pLen = pSession->nWapiRspIeLength; |
| 11551 | if(pBuf) |
| 11552 | { |
| 11553 | if(len >= pSession->nWapiRspIeLength) |
| 11554 | { |
| 11555 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiRspIE, pSession->nWapiRspIeLength); |
| 11556 | } |
| 11557 | } |
| 11558 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11559 | return (status); |
| 11560 | } |
| 11561 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11562 | eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11563 | { |
| 11564 | eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION; |
| 11565 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11566 | |
| 11567 | if(!pSession) |
| 11568 | { |
| 11569 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11570 | return (retStatus); |
| 11571 | } |
| 11572 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11573 | if(CSR_IS_ROAMING(pSession)) |
| 11574 | { |
| 11575 | retStatus = eCSR_ROAM_ROAMING_COMPLETION; |
| 11576 | pSession->fRoaming = eANI_BOOLEAN_FALSE; |
| 11577 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11578 | return (retStatus); |
| 11579 | } |
| 11580 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11581 | //This function remove the connected BSS from te cached scan result |
| 11582 | eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac, |
| 11583 | tCsrRoamConnectedProfile *pConnProfile) |
| 11584 | { |
| 11585 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 11586 | tCsrScanResultFilter *pScanFilter = NULL; |
| 11587 | tListElem *pEntry; |
| 11588 | tCsrScanResult *pResult; |
| 11589 | tDot11fBeaconIEs *pIes; |
| 11590 | tANI_BOOLEAN fMatch; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11591 | if(!(csrIsMacAddressZero(pMac, &pConnProfile->bssid) || |
| 11592 | csrIsMacAddressBroadcast(pMac, &pConnProfile->bssid))) |
| 11593 | { |
| 11594 | do |
| 11595 | { |
| 11596 | //Prepare the filter. Only fill in the necessary fields. Not all fields are needed |
| 11597 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 11598 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11599 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 11600 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 11601 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11602 | palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, &pConnProfile->bssid, sizeof(tCsrBssid)); |
| 11603 | pScanFilter->BSSIDs.numOfBSSIDs = 1; |
| 11604 | if(!csrIsNULLSSID(pConnProfile->SSID.ssId, pConnProfile->SSID.length)) |
| 11605 | { |
| 11606 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, sizeof(tCsrSSIDInfo)); |
| 11607 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11608 | palCopyMemory(pMac->hHdd, &pScanFilter->SSIDs.SSIDList[0].SSID, &pConnProfile->SSID, sizeof(tSirMacSSid)); |
| 11609 | } |
| 11610 | pScanFilter->authType.numEntries = 1; |
| 11611 | pScanFilter->authType.authType[0] = pConnProfile->AuthType; |
| 11612 | pScanFilter->BSSType = pConnProfile->BSSType; |
| 11613 | pScanFilter->EncryptionType.numEntries = 1; |
| 11614 | pScanFilter->EncryptionType.encryptionType[0] = pConnProfile->EncryptionType; |
| 11615 | pScanFilter->mcEncryptionType.numEntries = 1; |
| 11616 | pScanFilter->mcEncryptionType.encryptionType[0] = pConnProfile->mcEncryptionType; |
| 11617 | //We ignore the channel for now, BSSID should be enough |
| 11618 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 11619 | //Also ignore the following fields |
| 11620 | pScanFilter->uapsd_mask = 0; |
| 11621 | pScanFilter->bWPSAssociation = eANI_BOOLEAN_FALSE; |
| 11622 | pScanFilter->countryCode[0] = 0; |
| 11623 | pScanFilter->phyMode = eCSR_DOT11_MODE_TAURUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11624 | csrLLLock(&pMac->scan.scanResultList); |
| 11625 | pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK ); |
| 11626 | while( pEntry ) |
| 11627 | { |
| 11628 | pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link ); |
| 11629 | pIes = (tDot11fBeaconIEs *)( pResult->Result.pvIes ); |
| 11630 | fMatch = csrMatchBSS(pMac, &pResult->Result.BssDescriptor, |
| 11631 | pScanFilter, NULL, NULL, NULL, &pIes); |
| 11632 | //Release the IEs allocated by csrMatchBSS is needed |
| 11633 | if( !pResult->Result.pvIes ) |
| 11634 | { |
| 11635 | //need to free the IEs since it is allocated by csrMatchBSS |
| 11636 | palFreeMemory(pMac->hHdd, pIes); |
| 11637 | } |
| 11638 | if(fMatch) |
| 11639 | { |
| 11640 | //We found the one |
| 11641 | if( csrLLRemoveEntry(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK) ) |
| 11642 | { |
| 11643 | //Free the memory |
| 11644 | csrFreeScanResultEntry( pMac, pResult ); |
| 11645 | } |
| 11646 | break; |
| 11647 | } |
| 11648 | pEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK); |
| 11649 | }//while |
| 11650 | csrLLUnlock(&pMac->scan.scanResultList); |
| 11651 | }while(0); |
| 11652 | if(pScanFilter) |
| 11653 | { |
| 11654 | csrFreeScanFilter(pMac, pScanFilter); |
| 11655 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 11656 | } |
| 11657 | } |
| 11658 | return (status); |
| 11659 | } |
| 11660 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11661 | //BT-AMP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11662 | eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId ) |
| 11663 | { |
| 11664 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11665 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11666 | for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 11667 | { |
| 11668 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 11669 | { |
| 11670 | if( csrIsConnStateIbss( pMac, sessionId ) || csrIsBTAMP( pMac, sessionId ) ) |
| 11671 | { |
| 11672 | //co-exist with IBSS or BT-AMP is not supported |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11673 | 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] | 11674 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 11675 | break; |
| 11676 | } |
| 11677 | if( csrIsConnStateInfra( pMac, sessionId ) ) |
| 11678 | { |
| 11679 | if( chnId && |
| 11680 | ( (tANI_U8)chnId != pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ) ) |
| 11681 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11682 | 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] | 11683 | chnId, pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ); |
| 11684 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 11685 | break; |
| 11686 | } |
| 11687 | } |
| 11688 | } |
| 11689 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11690 | return ( status ); |
| 11691 | } |
| 11692 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11693 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ) |
| 11694 | { |
| 11695 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11696 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11697 | tBssConfigParam bssConfig; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11698 | |
| 11699 | if(!pSession) |
| 11700 | { |
| 11701 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11702 | return eHAL_STATUS_FAILURE; |
| 11703 | } |
| 11704 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11705 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 11706 | { |
| 11707 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 11708 | } |
| 11709 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 11710 | { |
| 11711 | // Disassociate from the connected Infrastructure network... |
| 11712 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 11713 | } |
| 11714 | else |
| 11715 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11716 | //We don't expect Bt-AMP HDD not to disconnect the last connection first at this time. |
| 11717 | //Otherwise we need to add code to handle the |
| 11718 | //situation just like IBSS. Though for WDS station, we need to send disassoc to PE first then |
| 11719 | //send stop_bss to PE, before we can continue. |
| 11720 | VOS_ASSERT( !csrIsConnStateWds( pMac, sessionId ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11721 | palZeroMemory(pMac->hHdd, &bssConfig, sizeof(tBssConfigParam)); |
| 11722 | /* Assume HDD provide bssid in profile */ |
| 11723 | palCopyMemory( pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid[0], sizeof(tCsrBssid) ); |
| 11724 | // there is no Bss description before we start an WDS so we need |
| 11725 | // to adopt all Bss configuration parameters from the Profile. |
| 11726 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, &bssConfig, pBssDesc); |
| 11727 | if(HAL_STATUS_SUCCESS(status)) |
| 11728 | { |
| 11729 | //Save profile for late use |
| 11730 | csrFreeRoamProfile( pMac, sessionId ); |
| 11731 | if (HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 11732 | (void **)&pSession->pCurRoamProfile, |
| 11733 | sizeof(tCsrRoamProfile)))) |
| 11734 | { |
| 11735 | palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 11736 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile); |
| 11737 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11738 | //Prepare some more parameters for this WDS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11739 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11740 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
| 11741 | } |
| 11742 | } |
| 11743 | |
| 11744 | return( status ); |
| 11745 | } |
| 11746 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11747 | ////////////////////Mail box |
| 11748 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11749 | //pBuf is caller allocated memory point to &(tSirSmeJoinReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 11750 | //or &(tSirSmeReassocReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 11751 | static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, |
| 11752 | tSirBssDescription *pBssDescription, |
| 11753 | tANI_U8 *pBuf, tANI_U8 uapsdMask) |
| 11754 | { |
| 11755 | tCsrChannelSet channelGroup; |
| 11756 | tSirMacCapabilityInfo *pAP_capabilityInfo; |
| 11757 | tAniBool fTmp; |
| 11758 | tANI_BOOLEAN found = FALSE; |
| 11759 | tANI_U32 size = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11760 | tANI_S8 pwrLimit = 0; |
| 11761 | tANI_U16 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11762 | // plug in neighborhood occupancy info (i.e. BSSes on primary or secondary channels) |
| 11763 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundPri |
| 11764 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecDown |
| 11765 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecUp |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11766 | // 802.11h |
| 11767 | //We can do this because it is in HOST CPU order for now. |
| 11768 | pAP_capabilityInfo = (tSirMacCapabilityInfo *)&pBssDescription->capabilityInfo; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11769 | //tell the target AP my 11H capability only if both AP and STA support 11H and the channel being used is 11a |
| 11770 | if ( csrIs11hSupported( pMac ) && pAP_capabilityInfo->spectrumMgt && eSIR_11A_NW_TYPE == pBssDescription->nwType ) |
| 11771 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11772 | fTmp = (tAniBool)pal_cpu_to_be32(1); |
| 11773 | } |
| 11774 | else |
| 11775 | fTmp = (tAniBool)0; |
| 11776 | |
| 11777 | // corresponds to --- pMsg->spectrumMgtIndicator = ON; |
| 11778 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&fTmp, sizeof(tAniBool) ); |
| 11779 | pBuf += sizeof(tAniBool); |
| 11780 | *pBuf++ = MIN_STA_PWR_CAP_DBM; // it is for pMsg->powerCap.minTxPower = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11781 | found = csrSearchChannelListForTxPower(pMac, pBssDescription, &channelGroup); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11782 | // This is required for 11k test VoWiFi Ent: Test 2. |
| 11783 | // We need the power capabilities for Assoc Req. |
| 11784 | // This macro is provided by the halPhyCfg.h. We pick our |
| 11785 | // max and min capability by the halPhy provided macros |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11786 | pwrLimit = csrGetCfgMaxTxPower (pMac, pBssDescription->channelId); |
| 11787 | if (0 != pwrLimit) |
| 11788 | { |
| 11789 | *pBuf++ = pwrLimit; |
| 11790 | } |
| 11791 | else |
| 11792 | { |
| 11793 | *pBuf++ = MAX_STA_PWR_CAP_DBM; |
| 11794 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11795 | size = sizeof(pMac->roam.validChannelList); |
| 11796 | if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size))) |
| 11797 | { |
| 11798 | *pBuf++ = (tANI_U8)size; //tSirSupChnl->numChnl |
| 11799 | for ( i = 0; i < size; i++) |
| 11800 | { |
| 11801 | *pBuf++ = pMac->roam.validChannelList[ i ]; //tSirSupChnl->channelList[ i ] |
| 11802 | |
| 11803 | } |
| 11804 | } |
| 11805 | else |
| 11806 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11807 | smsLog(pMac, LOGE, FL("can not find any valid channel")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11808 | *pBuf++ = 0; //tSirSupChnl->numChnl |
| 11809 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11810 | //Check whether it is ok to enter UAPSD |
| 11811 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 11812 | if( btcIsReadyForUapsd(pMac) ) |
| 11813 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 11814 | { |
| 11815 | *pBuf++ = uapsdMask; |
| 11816 | } |
| 11817 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 11818 | else |
| 11819 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11820 | 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] | 11821 | *pBuf++ = 0; |
| 11822 | } |
| 11823 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 11824 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11825 | // move the entire BssDescription into the join request. |
| 11826 | palCopyMemory( pMac->hHdd, pBuf, pBssDescription, |
| 11827 | pBssDescription->length + sizeof( pBssDescription->length ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11828 | pBuf += pBssDescription->length + sizeof( pBssDescription->length ); // update to new location |
| 11829 | } |
| 11830 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11831 | /* |
| 11832 | * The communication between HDD and LIM is thru mailbox (MB). |
| 11833 | * Both sides will access the data structure "tSirSmeJoinReq". |
| 11834 | * The rule is, while the components of "tSirSmeJoinReq" can be accessed in the regular way like tSirSmeJoinReq.assocType, this guideline |
| 11835 | * stops at component tSirRSNie; any acces to the components after tSirRSNie is forbidden because the space from tSirRSNie is quueezed |
| 11836 | * with the component "tSirBssDescription". And since the size of actual 'tSirBssDescription' varies, the receiving side (which is the routine |
| 11837 | * limJoinReqSerDes() of limSerDesUtils.cc) should keep in mind not to access the components DIRECTLY after tSirRSNie. |
| 11838 | */ |
| 11839 | eHalStatus csrSendJoinReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11840 | tCsrRoamProfile *pProfile, tDot11fBeaconIEs *pIes, tANI_U16 messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11841 | { |
| 11842 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11843 | tSirSmeJoinReq *pMsg; |
| 11844 | tANI_U8 *pBuf; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11845 | v_U8_t acm_mask = 0, uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11846 | tANI_U16 msgLen, wTmp, ieLen; |
| 11847 | tSirMacRateSet OpRateSet; |
| 11848 | tSirMacRateSet ExRateSet; |
| 11849 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11850 | tANI_U32 dwTmp; |
| 11851 | tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN]; //RSN MAX is bigger than WPA MAX |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 11852 | tANI_U32 ucDot11Mode = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11853 | |
| 11854 | if(!pSession) |
| 11855 | { |
| 11856 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11857 | return eHAL_STATUS_FAILURE; |
| 11858 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11859 | /* To satisfy klockworks */ |
| 11860 | if (NULL == pBssDescription) |
| 11861 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11862 | smsLog(pMac, LOGE, FL(" pBssDescription is NULL")); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11863 | return eHAL_STATUS_FAILURE; |
| 11864 | } |
| 11865 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11866 | do { |
| 11867 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 11868 | pSession->joinFailStatusCode.reasonCode = 0; |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 11869 | memcpy (&pSession->joinFailStatusCode.bssId, &pBssDescription->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11870 | // There are a number of variable length fields to consider. First, the tSirSmeJoinReq |
| 11871 | // includes a single bssDescription. bssDescription includes a single tANI_U32 for the |
| 11872 | // IE fields, but the length field in the bssDescription needs to be interpreted to |
| 11873 | // determine length of the IE fields. |
| 11874 | // |
| 11875 | // So, take the size of the JoinReq, subtract the size of the bssDescription and |
| 11876 | // add in the length from the bssDescription (then add the size of the 'length' field |
| 11877 | // itself because that is NOT included in the length field). |
| 11878 | msgLen = sizeof( tSirSmeJoinReq ) - sizeof( *pBssDescription ) + |
| 11879 | pBssDescription->length + sizeof( pBssDescription->length ) + |
| 11880 | 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] | 11881 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 11882 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11883 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11884 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)messageType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11885 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 11886 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11887 | // sessionId |
| 11888 | *pBuf = (tANI_U8)sessionId; |
| 11889 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11890 | // transactionId |
| 11891 | *pBuf = 0; |
| 11892 | *( pBuf + 1 ) = 0; |
| 11893 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11894 | // ssId |
| 11895 | if( pIes->SSID.present && pIes->SSID.num_ssid ) |
| 11896 | { |
| 11897 | // ssId len |
| 11898 | *pBuf = pIes->SSID.num_ssid; |
| 11899 | pBuf++; |
| 11900 | palCopyMemory( pMac->hHdd, pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid ); |
| 11901 | pBuf += pIes->SSID.num_ssid; |
| 11902 | } |
| 11903 | else |
| 11904 | { |
| 11905 | *pBuf = 0; |
| 11906 | pBuf++; |
| 11907 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11908 | // selfMacAddr |
| 11909 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 11910 | pBuf += sizeof(tSirMacAddr); |
| 11911 | // bsstype |
| 11912 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) ); |
| 11913 | if (dwTmp == eSIR_BTAMP_STA_MODE) dwTmp = eSIR_BTAMP_AP_MODE; // Override BssType for BTAMP |
| 11914 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 11915 | pBuf += sizeof(tSirBssType); |
| 11916 | // dot11mode |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 11917 | ucDot11Mode = csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode ); |
| 11918 | if (pBssDescription->channelId <= 14 && |
| 11919 | FALSE == pMac->roam.configParam.enableVhtFor24GHz && |
| 11920 | WNI_CFG_DOT11_MODE_11AC == ucDot11Mode) |
| 11921 | { |
| 11922 | //Need to disable VHT operation in 2.4 GHz band |
| 11923 | ucDot11Mode = WNI_CFG_DOT11_MODE_11N; |
| 11924 | } |
| 11925 | *pBuf = (tANI_U8)ucDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11926 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11927 | //Persona |
| 11928 | *pBuf = (tANI_U8)pProfile->csrPersona; |
| 11929 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11930 | //CBMode |
| 11931 | *pBuf = (tANI_U8)pSession->bssParams.cbMode; |
| 11932 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11933 | |
| 11934 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11935 | FL("CSR PERSONA=%d CSR CbMode %d"), pProfile->csrPersona, pSession->bssParams.cbMode); |
| 11936 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11937 | // uapsdPerAcBitmask |
| 11938 | *pBuf = pProfile->uapsd_mask; |
| 11939 | pBuf++; |
| 11940 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11941 | |
| 11942 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11943 | status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11944 | if (HAL_STATUS_SUCCESS(status) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11945 | { |
| 11946 | // OperationalRateSet |
| 11947 | if (OpRateSet.numRates) { |
| 11948 | *pBuf++ = OpRateSet.numRates; |
| 11949 | palCopyMemory(pMac->hHdd, pBuf, OpRateSet.rate, OpRateSet.numRates); |
| 11950 | pBuf += OpRateSet.numRates; |
| 11951 | } else *pBuf++ = 0; |
| 11952 | // ExtendedRateSet |
| 11953 | if (ExRateSet.numRates) { |
| 11954 | *pBuf++ = ExRateSet.numRates; |
| 11955 | palCopyMemory(pMac->hHdd, pBuf, ExRateSet.rate, ExRateSet.numRates); |
| 11956 | pBuf += ExRateSet.numRates; |
| 11957 | } else *pBuf++ = 0; |
| 11958 | } |
| 11959 | else |
| 11960 | { |
| 11961 | *pBuf++ = 0; |
| 11962 | *pBuf++ = 0; |
| 11963 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11964 | // rsnIE |
| 11965 | if ( csrIsProfileWpa( pProfile ) ) |
| 11966 | { |
| 11967 | // Insert the Wpa IE into the join request |
| 11968 | ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes, |
| 11969 | (tCsrWpaIe *)( wpaRsnIE ) ); |
| 11970 | } |
| 11971 | else if( csrIsProfileRSN( pProfile ) ) |
| 11972 | { |
| 11973 | // Insert the RSN IE into the join request |
| 11974 | ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 11975 | (tCsrRSNIe *)( wpaRsnIE ) ); |
| 11976 | } |
| 11977 | #ifdef FEATURE_WLAN_WAPI |
| 11978 | else if( csrIsProfileWapi( pProfile ) ) |
| 11979 | { |
| 11980 | // Insert the WAPI IE into the join request |
| 11981 | ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 11982 | (tCsrWapiIe *)( wpaRsnIE ) ); |
| 11983 | } |
| 11984 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11985 | else |
| 11986 | { |
| 11987 | ieLen = 0; |
| 11988 | } |
| 11989 | //remember the IE for future use |
| 11990 | if( ieLen ) |
| 11991 | { |
| 11992 | if(ieLen > DOT11F_IE_RSN_MAX_LEN) |
| 11993 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11994 | 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] | 11995 | ieLen = DOT11F_IE_RSN_MAX_LEN; |
| 11996 | } |
| 11997 | #ifdef FEATURE_WLAN_WAPI |
| 11998 | if( csrIsProfileWapi( pProfile ) ) |
| 11999 | { |
| 12000 | //Check whether we need to allocate more memory |
| 12001 | if(ieLen > pSession->nWapiReqIeLength) |
| 12002 | { |
| 12003 | if(pSession->pWapiReqIE && pSession->nWapiReqIeLength) |
| 12004 | { |
| 12005 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 12006 | } |
| 12007 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiReqIE, ieLen); |
| 12008 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 12009 | } |
| 12010 | pSession->nWapiReqIeLength = ieLen; |
| 12011 | palCopyMemory(pMac->hHdd, pSession->pWapiReqIE, wpaRsnIE, ieLen); |
| 12012 | wTmp = pal_cpu_to_be16( ieLen ); |
| 12013 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12014 | pBuf += sizeof(tANI_U16); |
| 12015 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 12016 | pBuf += ieLen; |
| 12017 | } |
| 12018 | else//should be WPA/WPA2 otherwise |
| 12019 | #endif /* FEATURE_WLAN_WAPI */ |
| 12020 | { |
| 12021 | //Check whether we need to allocate more memory |
| 12022 | if(ieLen > pSession->nWpaRsnReqIeLength) |
| 12023 | { |
| 12024 | if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength) |
| 12025 | { |
| 12026 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 12027 | } |
| 12028 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnReqIE, ieLen); |
| 12029 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 12030 | } |
| 12031 | pSession->nWpaRsnReqIeLength = ieLen; |
| 12032 | palCopyMemory(pMac->hHdd, pSession->pWpaRsnReqIE, wpaRsnIE, ieLen); |
| 12033 | wTmp = pal_cpu_to_be16( ieLen ); |
| 12034 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12035 | pBuf += sizeof(tANI_U16); |
| 12036 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 12037 | pBuf += ieLen; |
| 12038 | } |
| 12039 | } |
| 12040 | else |
| 12041 | { |
| 12042 | //free whatever old info |
| 12043 | pSession->nWpaRsnReqIeLength = 0; |
| 12044 | if(pSession->pWpaRsnReqIE) |
| 12045 | { |
| 12046 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 12047 | pSession->pWpaRsnReqIE = NULL; |
| 12048 | } |
| 12049 | #ifdef FEATURE_WLAN_WAPI |
| 12050 | pSession->nWapiReqIeLength = 0; |
| 12051 | if(pSession->pWapiReqIE) |
| 12052 | { |
| 12053 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 12054 | pSession->pWapiReqIE = NULL; |
| 12055 | } |
| 12056 | #endif /* FEATURE_WLAN_WAPI */ |
| 12057 | //length is two bytes |
| 12058 | *pBuf = 0; |
| 12059 | *(pBuf + 1) = 0; |
| 12060 | pBuf += 2; |
| 12061 | } |
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 | if( eWNI_SME_JOIN_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12064 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12065 | // Never include the cckmIE in an Join Request |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12066 | //length is two bytes |
| 12067 | *pBuf = 0; |
| 12068 | *(pBuf + 1) = 0; |
| 12069 | pBuf += 2; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12070 | } |
| 12071 | else if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12072 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12073 | // cckmIE |
| 12074 | if( csrIsProfileCCX( pProfile ) ) |
| 12075 | { |
| 12076 | // Insert the CCKM IE into the join request |
| 12077 | ieLen = csrConstructCcxCckmIe( pMac, |
| 12078 | pSession, |
| 12079 | pProfile, |
| 12080 | pBssDescription, |
| 12081 | pSession->pWpaRsnReqIE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12082 | pSession->nWpaRsnReqIeLength, |
| 12083 | (void *)( wpaRsnIE ) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12084 | } |
| 12085 | else |
| 12086 | { |
| 12087 | ieLen = 0; |
| 12088 | } |
| 12089 | //If present, copy the IE into the eWNI_SME_REASSOC_REQ message buffer |
| 12090 | if( ieLen ) |
| 12091 | { |
| 12092 | //Copy the CCKM IE over from the temp buffer (wpaRsnIE) |
| 12093 | wTmp = pal_cpu_to_be16( ieLen ); |
| 12094 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12095 | pBuf += sizeof(tANI_U16); |
| 12096 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 12097 | pBuf += ieLen; |
| 12098 | } |
| 12099 | else |
| 12100 | { |
| 12101 | //Indicate you have no CCKM IE |
| 12102 | //length is two bytes |
| 12103 | *pBuf = 0; |
| 12104 | *(pBuf + 1) = 0; |
| 12105 | pBuf += 2; |
| 12106 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12107 | } |
| 12108 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12109 | // addIEScan |
| 12110 | if(pProfile->nAddIEScanLength && pProfile->pAddIEScan) |
| 12111 | { |
| 12112 | ieLen = pProfile->nAddIEScanLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12113 | if(ieLen > pSession->nAddIEScanLength) |
| 12114 | { |
| 12115 | if(pSession->pAddIEScan && pSession->nAddIEScanLength) |
| 12116 | { |
| 12117 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 12118 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12119 | status = palAllocateMemory(pMac->hHdd, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12120 | (void **)&pSession->pAddIEScan, ieLen); |
| 12121 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 12122 | } |
| 12123 | pSession->nAddIEScanLength = ieLen; |
| 12124 | palCopyMemory(pMac->hHdd, pSession->pAddIEScan, |
| 12125 | pProfile->pAddIEScan, ieLen); |
| 12126 | wTmp = pal_cpu_to_be16( ieLen ); |
| 12127 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12128 | pBuf += sizeof(tANI_U16); |
| 12129 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEScan, ieLen ); |
| 12130 | pBuf += ieLen; |
| 12131 | } |
| 12132 | else |
| 12133 | { |
| 12134 | pSession->nAddIEScanLength = 0; |
| 12135 | if(pSession->pAddIEScan) |
| 12136 | { |
| 12137 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 12138 | pSession->pAddIEScan = NULL; |
| 12139 | } |
| 12140 | *pBuf = 0; |
| 12141 | *(pBuf + 1) = 0; |
| 12142 | pBuf += 2; |
| 12143 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12144 | // addIEAssoc |
| 12145 | if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc) |
| 12146 | { |
| 12147 | ieLen = pProfile->nAddIEAssocLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12148 | if(ieLen > pSession->nAddIEAssocLength) |
| 12149 | { |
| 12150 | if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength) |
| 12151 | { |
| 12152 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 12153 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12154 | status = palAllocateMemory(pMac->hHdd, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12155 | (void **)&pSession->pAddIEAssoc, ieLen); |
| 12156 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 12157 | } |
| 12158 | pSession->nAddIEAssocLength = ieLen; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12159 | palCopyMemory(pMac->hHdd, pSession->pAddIEAssoc, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12160 | pProfile->pAddIEAssoc, ieLen); |
| 12161 | wTmp = pal_cpu_to_be16( ieLen ); |
| 12162 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12163 | pBuf += sizeof(tANI_U16); |
| 12164 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEAssoc, ieLen ); |
| 12165 | pBuf += ieLen; |
| 12166 | } |
| 12167 | else |
| 12168 | { |
| 12169 | pSession->nAddIEAssocLength = 0; |
| 12170 | if(pSession->pAddIEAssoc) |
| 12171 | { |
| 12172 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 12173 | pSession->pAddIEAssoc = NULL; |
| 12174 | } |
| 12175 | *pBuf = 0; |
| 12176 | *(pBuf + 1) = 0; |
| 12177 | pBuf += 2; |
| 12178 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12179 | |
| 12180 | if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12181 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12182 | //Unmask any AC in reassoc that is ACM-set |
| 12183 | uapsd_mask = (v_U8_t)pProfile->uapsd_mask; |
| 12184 | if( uapsd_mask && ( NULL != pBssDescription ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12185 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12186 | if( CSR_IS_QOS_BSS(pIes) && CSR_IS_UAPSD_BSS(pIes) ) |
| 12187 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12188 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12189 | acm_mask = sme_QosGetACMMask(pMac, pBssDescription, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12190 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12191 | uapsd_mask &= ~(acm_mask); |
| 12192 | } |
| 12193 | else |
| 12194 | { |
| 12195 | uapsd_mask = 0; |
| 12196 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12197 | } |
| 12198 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12199 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12200 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) ); |
| 12201 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12202 | pBuf += sizeof(tANI_U32); |
| 12203 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12204 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) ); |
| 12205 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12206 | pBuf += sizeof(tANI_U32); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12207 | #ifdef WLAN_FEATURE_11W |
| 12208 | //MgmtEncryption |
| 12209 | if (pProfile->MFPEnabled) |
| 12210 | { |
| 12211 | dwTmp = pal_cpu_to_be32(eSIR_ED_AES_128_CMAC); |
| 12212 | } |
| 12213 | else |
| 12214 | { |
| 12215 | dwTmp = pal_cpu_to_be32(eSIR_ED_NONE); |
| 12216 | } |
| 12217 | palCopyMemory(pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32)); |
| 12218 | pBuf += sizeof(tANI_U32); |
| 12219 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12220 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12221 | pProfile->MDID.mdiePresent = pBssDescription->mdiePresent; |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 12222 | if (csrIsProfile11r( pProfile ) |
| 12223 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 09dd66b | 2013-04-01 17:13:01 +0530 | [diff] [blame] | 12224 | && !((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) && |
| 12225 | (pIes->CCXVersion.present) && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 12226 | #endif |
| 12227 | ) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12228 | { |
| 12229 | // is11Rconnection; |
| 12230 | dwTmp = pal_cpu_to_be32(TRUE); |
| 12231 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 12232 | pBuf += sizeof(tAniBool); |
| 12233 | } |
| 12234 | else |
| 12235 | { |
| 12236 | // is11Rconnection; |
| 12237 | dwTmp = pal_cpu_to_be32(FALSE); |
| 12238 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 12239 | pBuf += sizeof(tAniBool); |
| 12240 | } |
| 12241 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12242 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 12243 | |
| 12244 | // isCCXFeatureIniEnabled |
| 12245 | if (TRUE == pMac->roam.configParam.isCcxIniFeatureEnabled) |
| 12246 | { |
| 12247 | dwTmp = pal_cpu_to_be32(TRUE); |
| 12248 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 12249 | pBuf += sizeof(tAniBool); |
| 12250 | } |
| 12251 | else |
| 12252 | { |
| 12253 | dwTmp = pal_cpu_to_be32(FALSE); |
| 12254 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 12255 | pBuf += sizeof(tAniBool); |
| 12256 | } |
| 12257 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12258 | /* A profile can not be both CCX and 11R. But an 802.11R AP |
| 12259 | * may be advertising support for CCX as well. So if we are |
| 12260 | * associating Open or explicitly CCX then we will get CCX. |
| 12261 | * If we are associating explictly 11R only then we will get |
| 12262 | * 11R. |
| 12263 | */ |
| 12264 | if ((csrIsProfileCCX(pProfile) || |
| 12265 | ((pIes->CCXVersion.present) |
| 12266 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12267 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 12268 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 12269 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12270 | #ifdef WLAN_FEATURE_11W |
| 12271 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 12272 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12273 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12274 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
| 12275 | { |
| 12276 | // isCCXconnection; |
| 12277 | dwTmp = pal_cpu_to_be32(TRUE); |
| 12278 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 12279 | pBuf += sizeof(tAniBool); |
| 12280 | } |
| 12281 | else |
| 12282 | { |
| 12283 | //isCCXconnection; |
| 12284 | dwTmp = pal_cpu_to_be32(FALSE); |
| 12285 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 12286 | pBuf += sizeof(tAniBool); |
| 12287 | } |
| 12288 | |
| 12289 | if (eWNI_SME_JOIN_REQ == messageType) |
| 12290 | { |
| 12291 | tCCXTspecInfo ccxTspec; |
| 12292 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 12293 | // so nullify the TSPEC parameters |
| 12294 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 12295 | palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 12296 | pBuf += sizeof(tCCXTspecInfo); |
| 12297 | } |
| 12298 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 12299 | { |
| 12300 | if ((csrIsProfileCCX(pProfile) || |
| 12301 | ((pIes->CCXVersion.present) |
| 12302 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12303 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 12304 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 12305 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12306 | #ifdef WLAN_FEATURE_11W |
| 12307 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 12308 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12309 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12310 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12311 | { |
| 12312 | tCCXTspecInfo ccxTspec; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12313 | // CCX Tspec information |
| 12314 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 12315 | ccxTspec.numTspecs = sme_QosCCxRetrieveTspecInfo(pMac, sessionId, (tTspecInfo *) &ccxTspec.tspec[0]); |
| 12316 | *pBuf = ccxTspec.numTspecs; |
| 12317 | pBuf += sizeof(tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12318 | // Copy the TSPEC information only if present |
| 12319 | if (ccxTspec.numTspecs) { |
| 12320 | palCopyMemory(pMac->hHdd, pBuf, (void*)&ccxTspec.tspec[0], (ccxTspec.numTspecs*sizeof(tTspecInfo))); |
| 12321 | } |
| 12322 | pBuf += sizeof(ccxTspec.tspec); |
| 12323 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12324 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12325 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12326 | tCCXTspecInfo ccxTspec; |
| 12327 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 12328 | // so nullify the TSPEC parameters |
| 12329 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 12330 | palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 12331 | pBuf += sizeof(tCCXTspecInfo); |
| 12332 | } |
| 12333 | } |
| 12334 | #endif // FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12335 | #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] | 12336 | // Fill in isFastTransitionEnabled |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12337 | if (pMac->roam.configParam.isFastTransitionEnabled |
| 12338 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 12339 | || csrRoamIsFastRoamEnabled(pMac, sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12340 | #endif |
| 12341 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12342 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12343 | dwTmp = pal_cpu_to_be32(TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12344 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12345 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12346 | } |
| 12347 | else |
| 12348 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12349 | dwTmp = pal_cpu_to_be32(FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12350 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12351 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12352 | } |
| 12353 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12354 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 12355 | if(csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12356 | { |
| 12357 | //legacy fast roaming enabled |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12358 | dwTmp = pal_cpu_to_be32(TRUE); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12359 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12360 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12361 | } |
| 12362 | else |
| 12363 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12364 | dwTmp = pal_cpu_to_be32(FALSE); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12365 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12366 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12367 | } |
| 12368 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12369 | |
| 12370 | // txLdpcIniFeatureEnabled |
| 12371 | *pBuf = (tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 12372 | pBuf++; |
| 12373 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12374 | if ((csrIs11hSupported (pMac)) && (CSR_IS_CHANNEL_5GHZ(pBssDescription->channelId)) && |
| 12375 | (pIes->Country.present) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)) |
| 12376 | { |
| 12377 | csrSaveToChannelPower2G_5G( pMac, pIes->Country.num_triplets * sizeof(tSirMacChanInfo), |
| 12378 | (tSirMacChanInfo *)(&pIes->Country.triplets[0]) ); |
| 12379 | csrApplyPower2Current(pMac); |
| 12380 | } |
| 12381 | |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 12382 | #ifdef WLAN_FEATURE_11AC |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12383 | // txBFIniFeatureEnabled |
| 12384 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFEnable; |
| 12385 | pBuf++; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 12386 | |
| 12387 | // txBFCsnValue |
| 12388 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFCsnValue; |
| 12389 | pBuf++; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 12390 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12391 | //BssDesc |
| 12392 | csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, |
| 12393 | (tANI_U8)pProfile->uapsd_mask); |
| 12394 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 12395 | if(!HAL_STATUS_SUCCESS(status)) |
| 12396 | { |
| 12397 | break; |
| 12398 | } |
| 12399 | else |
| 12400 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12401 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12402 | if (eWNI_SME_JOIN_REQ == messageType) |
| 12403 | { |
| 12404 | //Tush-QoS: notify QoS module that join happening |
| 12405 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_JOIN_REQ, NULL); |
| 12406 | } |
| 12407 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 12408 | { |
| 12409 | //Tush-QoS: notify QoS module that reassoc happening |
| 12410 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_REASSOC_REQ, NULL); |
| 12411 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12412 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12413 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12414 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12415 | return( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12416 | } |
| 12417 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12418 | // |
| 12419 | eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 12420 | { |
| 12421 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12422 | tSirSmeDisassocReq *pMsg; |
| 12423 | tANI_U8 *pBuf; |
| 12424 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12425 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12426 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 12427 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12428 | do { |
| 12429 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocReq )); |
| 12430 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12431 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocReq )); |
| 12432 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_REQ); |
| 12433 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12434 | pBuf = &pMsg->sessionId; |
| 12435 | // sessionId |
| 12436 | *pBuf++ = (tANI_U8)sessionId; |
| 12437 | // transactionId |
| 12438 | *pBuf = 0; |
| 12439 | *( pBuf + 1 ) = 0; |
| 12440 | pBuf += sizeof(tANI_U16); |
| 12441 | |
Gopichand Nakkala | 06a7b3f | 2013-03-05 17:56:50 +0530 | [diff] [blame] | 12442 | if ( (pSession->pCurRoamProfile != NULL) && |
| 12443 | ((CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
| 12444 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile))) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12445 | { |
| 12446 | // Set the bssid address before sending the message to LIM |
| 12447 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( tSirMacAddr ) ); |
| 12448 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12449 | // Set the peer MAC address before sending the message to LIM |
| 12450 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); //perMacAddr is passed as bssId for softAP |
| 12451 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 12452 | } |
| 12453 | else |
| 12454 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12455 | // Set the peer MAC address before sending the message to LIM |
| 12456 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); |
| 12457 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12458 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->bssId ) ); |
| 12459 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12460 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12461 | if(!HAL_STATUS_SUCCESS(status)) |
| 12462 | { |
| 12463 | palFreeMemory(pMac->hHdd, pMsg); |
| 12464 | break; |
| 12465 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12466 | // reasonCode |
| 12467 | wTmp = pal_cpu_to_be16(reasonCode); |
| 12468 | status = palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12469 | if(!HAL_STATUS_SUCCESS(status)) |
| 12470 | { |
| 12471 | palFreeMemory(pMac->hHdd, pMsg); |
| 12472 | break; |
| 12473 | } |
| 12474 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12475 | /* The state will be DISASSOC_HANDOFF only when we are doing handoff. |
| 12476 | Here we should not send the disassoc over the air to the AP */ |
| 12477 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId) |
| 12478 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 12479 | && csrRoamIs11rAssoc(pMac) |
| 12480 | #endif |
| 12481 | ) |
| 12482 | { |
| 12483 | *pBuf = CSR_DONT_SEND_DISASSOC_OVER_THE_AIR; /* Set DoNotSendOverTheAir flag to 1 only for handoff case */ |
| 12484 | } |
| 12485 | pBuf += sizeof(tANI_U8); |
| 12486 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12487 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12488 | return( status ); |
| 12489 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12490 | eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable, tSirMacAddr bssId ) |
| 12491 | { |
| 12492 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12493 | tSirSmeTkipCntrMeasReq *pMsg; |
| 12494 | tANI_U8 *pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12495 | do |
| 12496 | { |
| 12497 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeTkipCntrMeasReq )); |
| 12498 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12499 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeTkipCntrMeasReq )); |
| 12500 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_TKIP_CNTR_MEAS_REQ); |
| 12501 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeTkipCntrMeasReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12502 | pBuf = &pMsg->sessionId; |
| 12503 | // sessionId |
| 12504 | *pBuf++ = (tANI_U8)sessionId; |
| 12505 | // transactionId |
| 12506 | *pBuf = 0; |
| 12507 | *( pBuf + 1 ) = 0; |
| 12508 | pBuf += sizeof(tANI_U16); |
| 12509 | // bssid |
| 12510 | status = palCopyMemory( pMac->hHdd, pMsg->bssId, bssId, sizeof( tSirMacAddr ) ); |
| 12511 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 12512 | // bEnable |
| 12513 | *pBuf = (tANI_BOOLEAN)bEnable; |
| 12514 | if(!HAL_STATUS_SUCCESS(status)) |
| 12515 | { |
| 12516 | palFreeMemory(pMac->hHdd, pMsg); |
| 12517 | break; |
| 12518 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12519 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12520 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12521 | return( status ); |
| 12522 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12523 | eHalStatus |
| 12524 | csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12525 | VOS_MODULE_ID modId, tSirMacAddr bssId, |
| 12526 | void *pUsrContext, void *pfnSapEventCallback, |
| 12527 | tANI_U8 *pAssocStasBuf ) |
| 12528 | { |
| 12529 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12530 | tSirSmeGetAssocSTAsReq *pMsg; |
| 12531 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 12532 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12533 | do |
| 12534 | { |
| 12535 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeGetAssocSTAsReq ) ); |
| 12536 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12537 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetAssocSTAsReq ) ); |
| 12538 | 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] | 12539 | pBuf = (tANI_U8 *)&pMsg->bssId; |
| 12540 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12541 | // bssId |
| 12542 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) ); |
| 12543 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12544 | // modId |
| 12545 | dwTmp = pal_cpu_to_be16((tANI_U16)modId); |
| 12546 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U16)); |
| 12547 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12548 | // pUsrContext |
| 12549 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
| 12550 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12551 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12552 | // pfnSapEventCallback |
| 12553 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
| 12554 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12555 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12556 | // pAssocStasBuf |
| 12557 | dwTmp = pal_cpu_to_be32((tANI_U32)pAssocStasBuf); |
| 12558 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12559 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12560 | 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] | 12561 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12562 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12563 | return( status ); |
| 12564 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12565 | eHalStatus |
| 12566 | csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12567 | tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac) |
| 12568 | { |
| 12569 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12570 | tSirSmeGetWPSPBCSessionsReq *pMsg; |
| 12571 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 12572 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12573 | do |
| 12574 | { |
| 12575 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirSmeGetWPSPBCSessionsReq) ); |
| 12576 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12577 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetWPSPBCSessionsReq ) ); |
| 12578 | 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] | 12579 | pBuf = (tANI_U8 *)&pMsg->pUsrContext; |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 12580 | VOS_ASSERT(pBuf); |
| 12581 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12582 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12583 | // pUsrContext |
| 12584 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
| 12585 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12586 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12587 | // pSapEventCallback |
| 12588 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
| 12589 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12590 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12591 | // bssId |
| 12592 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) ); |
| 12593 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12594 | // MAC Address of STA in WPS session |
| 12595 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pRemoveMac.bytes, sizeof(v_MACADDR_t)); |
| 12596 | pBuf += sizeof(v_MACADDR_t); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12597 | 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] | 12598 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12599 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12600 | return( status ); |
| 12601 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 12602 | |
| 12603 | eHalStatus |
| 12604 | csrSendChngMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12605 | { |
| 12606 | tpSirChangeBIParams pMsg; |
| 12607 | tANI_U16 len = 0; |
| 12608 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12609 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12610 | |
| 12611 | if(!pSession) |
| 12612 | { |
| 12613 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12614 | return eHAL_STATUS_FAILURE; |
| 12615 | } |
| 12616 | |
| 12617 | //NO need to update the Beacon Params if update beacon parameter flag is not set |
| 12618 | if(!pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval ) |
| 12619 | return eHAL_STATUS_SUCCESS; |
| 12620 | |
| 12621 | pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE; |
| 12622 | |
| 12623 | /* Create the message and send to lim */ |
| 12624 | len = sizeof(tSirChangeBIParams); |
| 12625 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len ); |
| 12626 | if(HAL_STATUS_SUCCESS(status)) |
| 12627 | { |
| 12628 | palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirChangeBIParams) ); |
| 12629 | pMsg->messageType = eWNI_SME_CHNG_MCC_BEACON_INTERVAL; |
| 12630 | pMsg->length = len; |
| 12631 | |
| 12632 | // bssId |
| 12633 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12634 | 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] | 12635 | pMsg->bssId[ 0 ], pMsg->bssId[ 1 ], pMsg->bssId[ 2 ], |
| 12636 | pMsg->bssId[ 3 ], pMsg->bssId[ 4 ], pMsg->bssId[ 5 ] ); |
| 12637 | pMsg->sessionId = sessionId; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12638 | 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] | 12639 | pMsg->beaconInterval = pMac->roam.roamSession[sessionId].bssParams.beaconInterval; |
| 12640 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 12641 | } |
| 12642 | return status; |
| 12643 | } |
| 12644 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12645 | eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 12646 | { |
| 12647 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12648 | tSirSmeDeauthReq *pMsg; |
| 12649 | tANI_U8 *pBuf; |
| 12650 | tANI_U16 wTmp; |
| 12651 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12652 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 12653 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12654 | do { |
| 12655 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthReq )); |
| 12656 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12657 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthReq )); |
| 12658 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_REQ); |
| 12659 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthReq )); |
| 12660 | //sessionId |
| 12661 | pBuf = &pMsg->sessionId; |
| 12662 | *pBuf++ = (tANI_U8)sessionId; |
| 12663 | |
| 12664 | //tansactionId |
| 12665 | *pBuf = 0; |
| 12666 | *(pBuf + 1 ) = 0; |
| 12667 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12668 | if ((pSession->pCurRoamProfile != NULL) && ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12669 | (CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12670 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))){ |
| 12671 | // Set the BSSID before sending the message to LIM |
| 12672 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( pMsg->peerMacAddr ) ); |
| 12673 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 12674 | } |
| 12675 | else |
| 12676 | { |
| 12677 | // Set the BSSID before sending the message to LIM |
| 12678 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 12679 | pBuf = pBuf + sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12680 | } |
| 12681 | if(!HAL_STATUS_SUCCESS(status)) |
| 12682 | { |
| 12683 | palFreeMemory(pMac->hHdd, pMsg); |
| 12684 | break; |
| 12685 | } |
| 12686 | // Set the peer MAC address before sending the message to LIM |
| 12687 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *) pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 12688 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 12689 | if(!HAL_STATUS_SUCCESS(status)) |
| 12690 | { |
| 12691 | palFreeMemory(pMac->hHdd, pMsg); |
| 12692 | break; |
| 12693 | } |
| 12694 | wTmp = pal_cpu_to_be16(reasonCode); |
| 12695 | status = palCopyMemory( pMac->hHdd, pBuf, &wTmp,sizeof( tANI_U16 ) ); |
| 12696 | if(!HAL_STATUS_SUCCESS(status)) |
| 12697 | { |
| 12698 | palFreeMemory(pMac->hHdd, pMsg); |
| 12699 | break; |
| 12700 | } |
| 12701 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12702 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12703 | return( status ); |
| 12704 | } |
| 12705 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12706 | eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd ) |
| 12707 | { |
| 12708 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12709 | tSirSmeDisassocCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12710 | do { |
| 12711 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocCnf )); |
| 12712 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12713 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocCnf )); |
| 12714 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_CNF); |
| 12715 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12716 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocCnf )); |
| 12717 | status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDisassocInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); |
| 12718 | if(!HAL_STATUS_SUCCESS(status)) |
| 12719 | { |
| 12720 | palFreeMemory(pMac->hHdd, pMsg); |
| 12721 | break; |
| 12722 | } |
| 12723 | //To test reconn |
| 12724 | status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDisassocInd->bssId, sizeof(pMsg->peerMacAddr)); |
| 12725 | if(!HAL_STATUS_SUCCESS(status)) |
| 12726 | { |
| 12727 | palFreeMemory(pMac->hHdd, pMsg); |
| 12728 | break; |
| 12729 | } |
| 12730 | //To test reconn ends |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12731 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12732 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12733 | return( status ); |
| 12734 | } |
| 12735 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12736 | eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd ) |
| 12737 | { |
| 12738 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12739 | tSirSmeDeauthCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12740 | do { |
| 12741 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthCnf )); |
| 12742 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12743 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthCnf )); |
| 12744 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_CNF); |
| 12745 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12746 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthCnf )); |
| 12747 | status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDeauthInd->bssId, sizeof(pMsg->bssId)); |
| 12748 | if(!HAL_STATUS_SUCCESS(status)) |
| 12749 | { |
| 12750 | palFreeMemory(pMac->hHdd, pMsg); |
| 12751 | break; |
| 12752 | } |
| 12753 | status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDeauthInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); |
| 12754 | if(!HAL_STATUS_SUCCESS(status)) |
| 12755 | { |
| 12756 | palFreeMemory(pMac->hHdd, pMsg); |
| 12757 | break; |
| 12758 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12759 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12760 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12761 | return( status ); |
| 12762 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12763 | eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus ) |
| 12764 | { |
| 12765 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12766 | tSirSmeAssocCnf *pMsg; |
| 12767 | tANI_U8 *pBuf; |
| 12768 | tSirResultCodes statusCode; |
| 12769 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12770 | do { |
| 12771 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocCnf )); |
| 12772 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12773 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocCnf )); |
| 12774 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ASSOC_CNF); |
| 12775 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocCnf )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12776 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 12777 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 12778 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12779 | else |
| 12780 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
| 12781 | palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) ); |
| 12782 | pBuf += sizeof(tSirResultCodes); |
| 12783 | // bssId |
| 12784 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12785 | pBuf += sizeof (tSirMacAddr); |
| 12786 | // peerMacAddr |
| 12787 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 12788 | pBuf += sizeof (tSirMacAddr); |
| 12789 | // aid |
| 12790 | wTmp = pal_cpu_to_be16(pAssocInd->aid); |
| 12791 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12792 | pBuf += sizeof (tANI_U16); |
| 12793 | // alternateBssId |
| 12794 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12795 | pBuf += sizeof (tSirMacAddr); |
| 12796 | // alternateChannelId |
| 12797 | *pBuf = 11; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12798 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12799 | if(!HAL_STATUS_SUCCESS(status)) |
| 12800 | { |
| 12801 | //pMsg is freed by palSendMBMessage |
| 12802 | break; |
| 12803 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12804 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12805 | return( status ); |
| 12806 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12807 | eHalStatus csrSendAssocIndToUpperLayerCnfMsg( tpAniSirGlobal pMac, |
| 12808 | tpSirSmeAssocInd pAssocInd, |
| 12809 | eHalStatus Halstatus, |
| 12810 | tANI_U8 sessionId) |
| 12811 | { |
| 12812 | tSirMsgQ msgQ; |
| 12813 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12814 | tSirSmeAssocIndToUpperLayerCnf *pMsg; |
| 12815 | tANI_U8 *pBuf; |
| 12816 | tSirResultCodes statusCode; |
| 12817 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12818 | do { |
| 12819 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 12820 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12821 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12822 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12823 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPPER_LAYER_ASSOC_CNF); |
| 12824 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 12825 | |
| 12826 | pMsg->sessionId = sessionId; |
| 12827 | |
| 12828 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 12829 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 12830 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12831 | else |
| 12832 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
| 12833 | palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) ); |
| 12834 | pBuf += sizeof(tSirResultCodes); |
| 12835 | // bssId |
| 12836 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12837 | pBuf += sizeof (tSirMacAddr); |
| 12838 | // peerMacAddr |
| 12839 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 12840 | pBuf += sizeof (tSirMacAddr); |
| 12841 | // StaId |
| 12842 | wTmp = pal_cpu_to_be16(pAssocInd->staId); |
| 12843 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12844 | pBuf += sizeof (tANI_U16); |
| 12845 | // alternateBssId |
| 12846 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12847 | pBuf += sizeof (tSirMacAddr); |
| 12848 | // alternateChannelId |
| 12849 | *pBuf = 11; |
| 12850 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12851 | // Instead of copying roam Info, we just copy only WmmEnabled , RsnIE information |
| 12852 | //Wmm |
| 12853 | *pBuf = pAssocInd->wmmEnabledSta; |
| 12854 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12855 | //RSN IE |
| 12856 | status = palCopyMemory(pMac->hHdd, (tSirRSNie *)pBuf, &pAssocInd->rsnIE, sizeof(tSirRSNie)); |
| 12857 | pBuf += sizeof (tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12858 | //Additional IE |
| 12859 | status = palCopyMemory(pMac->hHdd, (void *)pBuf, &pAssocInd->addIE, sizeof(tSirAddie)); |
| 12860 | pBuf += sizeof (tSirAddie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12861 | //reassocReq |
| 12862 | *pBuf = pAssocInd->reassocReq; |
| 12863 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12864 | msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF; |
| 12865 | msgQ.bodyptr = pMsg; |
| 12866 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12867 | SysProcessMmhMsg(pMac, &msgQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12868 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12869 | return( status ); |
| 12870 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12871 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12872 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId , |
| 12873 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 12874 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 12875 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 12876 | tANI_U8 *pKeyRsc ) |
| 12877 | { |
| 12878 | tSirSmeSetContextReq *pMsg; |
| 12879 | tANI_U16 msgLen; |
| 12880 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12881 | tAniEdType tmpEdType; |
| 12882 | tAniKeyDirection tmpDirection; |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 12883 | tANI_U8 *pBuf = NULL; |
| 12884 | tANI_U8 *p = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12885 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12886 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12887 | if( ( 1 != numKeys ) && ( 0 != numKeys ) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12888 | // all of these fields appear in every SET_CONTEXT message. Below we'll add in the size for each |
| 12889 | // key set. Since we only support upto one key, we always allocate memory for 1 key |
| 12890 | msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) + |
| 12891 | sizeof( tSirMacAddr ) + 1 + sizeof(tANI_U16) + |
| 12892 | sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + |
| 12893 | ( sizeof( pMsg->keyMaterial.key ) ); |
| 12894 | |
| 12895 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12896 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12897 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 12898 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SETCONTEXT_REQ); |
| 12899 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12900 | //sessionId |
| 12901 | pBuf = &pMsg->sessionId; |
| 12902 | *pBuf = (tANI_U8)sessionId; |
| 12903 | pBuf++; |
| 12904 | // transactionId |
| 12905 | *pBuf = 0; |
| 12906 | *(pBuf + 1) = 0; |
| 12907 | pBuf += sizeof(tANI_U16); |
| 12908 | // peerMacAddr |
| 12909 | palCopyMemory( pMac->hHdd, pBuf, |
| 12910 | (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr) ); |
| 12911 | |
| 12912 | pBuf += sizeof(tSirMacAddr); |
| 12913 | |
| 12914 | // bssId |
| 12915 | palCopyMemory( pMac->hHdd, pBuf, |
| 12916 | (tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 12917 | |
| 12918 | pBuf += sizeof(tSirMacAddr); |
| 12919 | |
| 12920 | p = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12921 | // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field |
| 12922 | // in the tSirKeyMaterial keyMaterial; field). |
| 12923 | // |
| 12924 | // !!NOTE: This keyMaterial.length contains the length of a MAX size key, though the keyLength can be |
| 12925 | // shorter than this max size. Is LIM interpreting this ok ? |
| 12926 | 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] | 12927 | // set pMsg->keyMaterial.edType |
| 12928 | tmpEdType = (tAniEdType)pal_cpu_to_be32(edType); |
| 12929 | palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType) ); |
| 12930 | p += sizeof( pMsg->keyMaterial.edType ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12931 | // set the pMsg->keyMaterial.numKeys field |
| 12932 | *p = numKeys; |
| 12933 | p += sizeof( pMsg->keyMaterial.numKeys ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12934 | // set pSirKey->keyId = keyId; |
| 12935 | *p = keyId; |
| 12936 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12937 | // set pSirKey->unicast = (tANI_U8)fUnicast; |
| 12938 | *p = (tANI_U8)fUnicast; |
| 12939 | p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12940 | // set pSirKey->keyDirection = aniKeyDirection; |
| 12941 | tmpDirection = (tAniKeyDirection)pal_cpu_to_be32(aniKeyDirection); |
| 12942 | palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection) ); |
| 12943 | p += sizeof(tAniKeyDirection); |
| 12944 | // pSirKey->keyRsc = ;; |
| 12945 | palCopyMemory( pMac->hHdd, p, pKeyRsc, CSR_MAX_RSC_LEN ); |
| 12946 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12947 | // set pSirKey->paeRole |
| 12948 | *p = paeRole; // 0 is Supplicant |
| 12949 | p++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12950 | // set pSirKey->keyLength = keyLength; |
| 12951 | p = pal_set_U16( p, pal_cpu_to_be16(keyLength) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12952 | if ( keyLength && pKey ) |
| 12953 | { |
| 12954 | palCopyMemory( pMac->hHdd, p, pKey, keyLength ); |
| 12955 | if(keyLength == 16) |
| 12956 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12957 | 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] | 12958 | keyId, edType, pKey[0], pKey[1], pKey[2], pKey[3], pKey[4], |
| 12959 | pKey[5], pKey[6], pKey[7], pKey[8], |
| 12960 | pKey[9], pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], pKey[15]); |
| 12961 | } |
| 12962 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12963 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12964 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12965 | return( status ); |
| 12966 | } |
| 12967 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12968 | eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, |
| 12969 | tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc ) |
| 12970 | { |
| 12971 | eHalStatus status; |
| 12972 | tSirSmeStartBssReq *pMsg; |
| 12973 | tANI_U8 *pBuf = NULL; |
| 12974 | tANI_U8 *wTmpBuf = NULL; |
| 12975 | tANI_U16 msgLen, wTmp; |
| 12976 | tANI_U32 dwTmp; |
| 12977 | tSirNwType nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12978 | ePhyChanBondState cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12979 | tANI_U32 authType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12980 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12981 | |
| 12982 | if(!pSession) |
| 12983 | { |
| 12984 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12985 | return eHAL_STATUS_FAILURE; |
| 12986 | } |
| 12987 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12988 | do { |
| 12989 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 12990 | pSession->joinFailStatusCode.reasonCode = 0; |
| 12991 | msgLen = sizeof(tSirSmeStartBssReq); |
| 12992 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12993 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12994 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 12995 | 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] | 12996 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12997 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12998 | //sessionId |
| 12999 | *pBuf = (tANI_U8)sessionId; |
| 13000 | pBuf++; |
| 13001 | // transactionId |
| 13002 | *pBuf = 0; |
| 13003 | *(pBuf + 1) = 0; |
| 13004 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13005 | // bssid |
| 13006 | palCopyMemory( pMac->hHdd, pBuf, pParam->bssid, sizeof(tSirMacAddr) ); |
| 13007 | pBuf += sizeof(tSirMacAddr); |
| 13008 | // selfMacAddr |
| 13009 | palCopyMemory( pMac->hHdd, pBuf, pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 13010 | pBuf += sizeof(tSirMacAddr); |
| 13011 | // beaconInterval |
| 13012 | if( pBssDesc && pBssDesc->beaconInterval ) |
| 13013 | { |
| 13014 | wTmp = pal_cpu_to_be16( pBssDesc->beaconInterval ); |
| 13015 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13016 | else if(pParam->beaconInterval) |
| 13017 | { |
| 13018 | wTmp = pal_cpu_to_be16( pParam->beaconInterval ); |
| 13019 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13020 | else |
| 13021 | { |
| 13022 | wTmp = pal_cpu_to_be16( WNI_CFG_BEACON_INTERVAL_STADEF ); |
| 13023 | } |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame] | 13024 | if(csrIsconcurrentsessionValid (pMac, sessionId, |
| 13025 | pParam->bssPersona) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13026 | == eHAL_STATUS_SUCCESS ) |
| 13027 | { |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13028 | csrValidateMCCBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13029 | pParam->bssPersona); |
| 13030 | //Update the beacon Interval |
| 13031 | pParam->beaconInterval = wTmp; |
| 13032 | } |
| 13033 | else |
| 13034 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13035 | smsLog( pMac,LOGE, FL("****Start BSS failed persona already exists***")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13036 | status = eHAL_STATUS_FAILURE; |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 13037 | palFreeMemory( pMac->hHdd, pMsg ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13038 | return status; |
| 13039 | } |
| 13040 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13041 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); |
| 13042 | pBuf += sizeof(tANI_U16); |
| 13043 | // dot11mode |
| 13044 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pParam->uCfgDot11Mode ); |
| 13045 | pBuf += 1; |
| 13046 | // bssType |
| 13047 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( bssType ) ); |
| 13048 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 13049 | pBuf += sizeof(tSirBssType); |
| 13050 | // ssId |
| 13051 | if( pParam->ssId.length ) |
| 13052 | { |
| 13053 | // ssId len |
| 13054 | *pBuf = pParam->ssId.length; |
| 13055 | pBuf++; |
| 13056 | palCopyMemory( pMac->hHdd, pBuf, pParam->ssId.ssId, pParam->ssId.length ); |
| 13057 | pBuf += pParam->ssId.length; |
| 13058 | } |
| 13059 | else |
| 13060 | { |
| 13061 | *pBuf = 0; |
| 13062 | pBuf++; |
| 13063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13064 | // set the channel Id |
| 13065 | *pBuf = pParam->operationChn; |
| 13066 | pBuf++; |
| 13067 | //What should we really do for the cbmode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13068 | cbMode = (ePhyChanBondState)pal_cpu_to_be32(pParam->cbMode); |
| 13069 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState) ); |
| 13070 | pBuf += sizeof(ePhyChanBondState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13071 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13072 | // Set privacy |
| 13073 | *pBuf = pParam->privacy; |
| 13074 | pBuf++; |
| 13075 | |
| 13076 | //Set Uapsd |
| 13077 | *pBuf = pParam->ApUapsdEnable; |
| 13078 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13079 | //Set SSID hidden |
| 13080 | *pBuf = pParam->ssidHidden; |
| 13081 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13082 | *pBuf = (tANI_U8)pParam->fwdWPSPBCProbeReq; |
| 13083 | pBuf++; |
| 13084 | |
| 13085 | //Ht protection Enable/Disable |
| 13086 | *pBuf = (tANI_U8)pParam->protEnabled; |
| 13087 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13088 | //Enable Beacons to Receive for OBSS protection Enable/Disable |
| 13089 | *pBuf = (tANI_U8)pParam->obssProtEnabled; |
| 13090 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13091 | //set cfg related to protection |
| 13092 | wTmp = pal_cpu_to_be16( pParam->ht_protection ); |
| 13093 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); |
| 13094 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13095 | // Set Auth type |
| 13096 | authType = pal_cpu_to_be32(pParam->authType); |
| 13097 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&authType, sizeof(tANI_U32)); |
| 13098 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13099 | // Set DTIM |
| 13100 | dwTmp = pal_cpu_to_be32(pParam->dtimPeriod); |
| 13101 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 13102 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13103 | // Set wps_state |
| 13104 | *pBuf = pParam->wps_state; |
| 13105 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13106 | //Persona |
| 13107 | *pBuf = (tANI_U8)pParam->bssPersona; |
| 13108 | pBuf++; |
| 13109 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 13110 | //txLdpcIniFeatureEnabled |
| 13111 | *pBuf = (tANI_U8)(tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 13112 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13113 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13114 | |
| 13115 | // set RSN IE |
| 13116 | if( pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata) ) |
| 13117 | { |
| 13118 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 13119 | palFreeMemory( pMac->hHdd, pMsg ); |
| 13120 | break; |
| 13121 | } |
| 13122 | wTmp = pal_cpu_to_be16( pParam->nRSNIELength ); |
| 13123 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 13124 | pBuf += sizeof(tANI_U16); |
| 13125 | if( wTmp ) |
| 13126 | { |
| 13127 | wTmp = pParam->nRSNIELength; |
| 13128 | palCopyMemory( pMac->hHdd, pBuf, pParam->pRSNIE, wTmp ); |
| 13129 | pBuf += wTmp; |
| 13130 | } |
| 13131 | nwType = (tSirNwType)pal_cpu_to_be32(pParam->sirNwType); |
| 13132 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType) ); |
| 13133 | pBuf += sizeof(tSirNwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13134 | *pBuf = pParam->operationalRateSet.numRates; //tSirMacRateSet->numRates |
| 13135 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13136 | palCopyMemory( pMac->hHdd, pBuf, pParam->operationalRateSet.rate, pParam->operationalRateSet.numRates ); |
| 13137 | pBuf += pParam->operationalRateSet.numRates ; |
| 13138 | *pBuf++ = pParam->extendedRateSet.numRates; |
| 13139 | if(0 != pParam->extendedRateSet.numRates) |
| 13140 | { |
| 13141 | palCopyMemory( pMac->hHdd, pBuf, pParam->extendedRateSet.rate, pParam->extendedRateSet.numRates ); |
| 13142 | pBuf += pParam->extendedRateSet.numRates; |
| 13143 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13144 | msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg |
| 13145 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 13146 | |
| 13147 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13148 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13149 | return( status ); |
| 13150 | } |
| 13151 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13152 | eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 13153 | { |
| 13154 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13155 | tSirSmeStopBssReq *pMsg; |
| 13156 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13157 | tANI_U8 *pBuf; |
| 13158 | tANI_U16 msgLen; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13159 | |
| 13160 | if(!pSession) |
| 13161 | { |
| 13162 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13163 | return eHAL_STATUS_FAILURE; |
| 13164 | } |
| 13165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13166 | do { |
| 13167 | status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq)); |
| 13168 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 13169 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq )); |
| 13170 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 13171 | pBuf = &pMsg->sessionId; |
| 13172 | //sessionId |
| 13173 | *pBuf = (tANI_U8)sessionId; |
| 13174 | pBuf++; |
| 13175 | // transactionId |
| 13176 | *pBuf = 0; |
| 13177 | pBuf += sizeof(tANI_U16); |
| 13178 | //reason code |
| 13179 | *pBuf = 0; |
| 13180 | pBuf += sizeof(tSirResultCodes); |
| 13181 | // bssid |
| 13182 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 13183 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 13184 | { |
| 13185 | palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 13186 | } |
| 13187 | else |
| 13188 | { |
| 13189 | palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 13190 | } |
| 13191 | pBuf += sizeof(tSirMacAddr); |
| 13192 | msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr); |
| 13193 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13194 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13195 | #if 0 |
| 13196 | status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq)); |
| 13197 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 13198 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq )); |
| 13199 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 13200 | pMsg->reasonCode = 0; |
| 13201 | // bssid |
| 13202 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 13203 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 13204 | { |
| 13205 | pbBssid = (tANI_U8 *)&pSession->selfMacAddr; |
| 13206 | } |
| 13207 | else |
| 13208 | { |
| 13209 | pbBssid = (tANI_U8 *)&pSession->connectedProfile.bssid; |
| 13210 | } |
| 13211 | palCopyMemory( pMac->hHdd, &pMsg->bssId, pbBssid, sizeof(tSirMacAddr) ); |
| 13212 | pMsg->transactionId = 0; |
| 13213 | pMsg->sessionId = (tANI_U8)sessionId; |
| 13214 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeStopBssReq )); |
| 13215 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13216 | #endif |
| 13217 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13218 | return( status ); |
| 13219 | } |
| 13220 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13221 | eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13222 | tCsrRoamModifyProfileFields *pModProfileFields, |
| 13223 | tANI_U32 *pRoamId, v_BOOL_t fForce) |
| 13224 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13225 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13226 | tANI_U32 roamId = 0; |
| 13227 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13228 | if((csrIsConnStateConnected(pMac, sessionId)) && |
| 13229 | (fForce || (!palEqualMemory(pMac->hHdd, &pModProfileFields, |
| 13230 | &pSession->connectedProfile.modifyProfileFields, |
| 13231 | sizeof(tCsrRoamModifyProfileFields)))) ) |
| 13232 | { |
| 13233 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 13234 | if(pRoamId) |
| 13235 | { |
| 13236 | *pRoamId = roamId; |
| 13237 | } |
| 13238 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13239 | status = csrRoamIssueReassoc(pMac, sessionId, NULL, pModProfileFields, |
| 13240 | eCsrSmeIssuedReassocToSameAP, roamId, |
| 13241 | eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13242 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13243 | return status; |
| 13244 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13245 | static eHalStatus csrRoamSessionOpened(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13246 | { |
| 13247 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13248 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13249 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 13250 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 13251 | eCSR_ROAM_SESSION_OPENED, eCSR_ROAM_RESULT_NONE); |
| 13252 | return (status); |
| 13253 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13254 | eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 13255 | { |
| 13256 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13257 | tListElem *pEntry = NULL; |
| 13258 | tSmeCmd *pCommand = NULL; |
| 13259 | tSirSmeAddStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13260 | do |
| 13261 | { |
| 13262 | if(pMsg == NULL) |
| 13263 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13264 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13265 | status = eHAL_STATUS_FAILURE; |
| 13266 | break; |
| 13267 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13268 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 13269 | if(pEntry) |
| 13270 | { |
| 13271 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13272 | if(eSmeCommandAddStaSession == pCommand->command) |
| 13273 | { |
| 13274 | pRsp = (tSirSmeAddStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13275 | smsLog( pMac, LOG1, "Add Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13276 | //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] | 13277 | csrRoamSessionOpened(pMac, pCommand->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13278 | //Remove this command out of the active list |
| 13279 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 13280 | { |
| 13281 | //Now put this command back on the avilable command list |
| 13282 | csrReleaseCommand(pMac, pCommand); |
| 13283 | } |
| 13284 | smeProcessPendingQueue( pMac ); |
| 13285 | } |
| 13286 | else |
| 13287 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13288 | 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] | 13289 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13290 | status = eHAL_STATUS_FAILURE; |
| 13291 | break; |
| 13292 | } |
| 13293 | } |
| 13294 | else |
| 13295 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13296 | 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] | 13297 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13298 | status = eHAL_STATUS_FAILURE; |
| 13299 | break; |
| 13300 | } |
| 13301 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13302 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13303 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13304 | eHalStatus csrSendMBAddSelfStaReqMsg(tpAniSirGlobal pMac, |
| 13305 | tAddStaForSessionCmd *pAddStaReq) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13306 | { |
| 13307 | tSirSmeAddStaSelfReq *pMsg; |
| 13308 | tANI_U16 msgLen; |
| 13309 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13310 | do { |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13311 | msgLen = sizeof(tSirSmeAddStaSelfReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13312 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 13313 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13314 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13315 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ADD_STA_SELF_REQ); |
| 13316 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13317 | // self station address |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13318 | palCopyMemory(pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, |
| 13319 | (tANI_U8 *)&pAddStaReq->selfMacAddr, sizeof(tSirMacAddr)); |
| 13320 | |
| 13321 | pMsg->currDeviceMode = pAddStaReq->currDeviceMode; |
| 13322 | |
| 13323 | smsLog( pMac, LOG1, FL("selfMac=%02x, %02x, %02x, %02x, %02x, %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13324 | pMsg->selfMacAddr[0], |
| 13325 | pMsg->selfMacAddr[1], |
| 13326 | pMsg->selfMacAddr[2], |
| 13327 | pMsg->selfMacAddr[3], |
| 13328 | pMsg->selfMacAddr[4], |
| 13329 | pMsg->selfMacAddr[5]); |
| 13330 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13331 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13332 | return( status ); |
| 13333 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13334 | eHalStatus csrIssueAddStaForSessionReq(tpAniSirGlobal pMac, |
| 13335 | tANI_U32 sessionId, |
| 13336 | tSirMacAddr sessionMacAddr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13337 | { |
| 13338 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13339 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13340 | pCommand = csrGetCommandBuffer(pMac); |
| 13341 | if(NULL == pCommand) |
| 13342 | { |
| 13343 | status = eHAL_STATUS_RESOURCES; |
| 13344 | } |
| 13345 | else |
| 13346 | { |
| 13347 | pCommand->command = eSmeCommandAddStaSession; |
| 13348 | pCommand->sessionId = (tANI_U8)sessionId; |
| 13349 | palCopyMemory( pMac->hHdd, pCommand->u.addStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) ); |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13350 | pCommand->u.addStaSessionCmd.currDeviceMode = pMac->sme.currDeviceMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13351 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 13352 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 13353 | { |
| 13354 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13355 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13356 | } |
| 13357 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13358 | return (status); |
| 13359 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13360 | eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 13361 | { |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13362 | return csrSendMBAddSelfStaReqMsg(pMac, &pCommand->u.addStaSessionCmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13363 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13364 | eHalStatus csrRoamOpenSession(tpAniSirGlobal pMac, |
| 13365 | csrRoamCompleteCallback callback, |
| 13366 | void *pContext, tANI_U8 *pSelfMacAddr, |
| 13367 | tANI_U8 *pbSessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13368 | { |
| 13369 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13370 | tANI_U32 i; |
| 13371 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13372 | *pbSessionId = CSR_SESSION_ID_INVALID; |
| 13373 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13374 | { |
| 13375 | if( !CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13376 | { |
| 13377 | pSession = CSR_GET_SESSION( pMac, i ); |
| 13378 | status = eHAL_STATUS_SUCCESS; |
| 13379 | pSession->sessionActive = eANI_BOOLEAN_TRUE; |
| 13380 | pSession->sessionId = (tANI_U8)i; |
| 13381 | pSession->callback = callback; |
| 13382 | pSession->pContext = pContext; |
| 13383 | palCopyMemory( pMac->hHdd, &pSession->selfMacAddr, pSelfMacAddr, sizeof(tCsrBssid) ); |
| 13384 | *pbSessionId = (tANI_U8)i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13385 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerRoaming, csrRoamRoamingTimerHandler, |
| 13386 | &pSession->roamingTimerInfo); |
| 13387 | if(!HAL_STATUS_SUCCESS(status)) |
| 13388 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13389 | smsLog(pMac, LOGE, FL("cannot allocate memory for Roaming timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13390 | break; |
| 13391 | } |
| 13392 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 13393 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerJoinRetry, csrRoamJoinRetryTimerHandler, |
| 13394 | &pSession->joinRetryTimerInfo); |
| 13395 | if(!HAL_STATUS_SUCCESS(status)) |
| 13396 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13397 | smsLog(pMac, LOGE, FL("cannot allocate memory for joinretry timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13398 | break; |
| 13399 | } |
| 13400 | #endif |
| 13401 | pSession->ibssJoinTimerInfo.pMac = pMac; |
| 13402 | pSession->ibssJoinTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13403 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerIbssJoining, csrRoamIbssJoinTimerHandler, |
| 13404 | &pSession->ibssJoinTimerInfo); |
| 13405 | if(!HAL_STATUS_SUCCESS(status)) |
| 13406 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13407 | smsLog(pMac, LOGE, FL("cannot allocate memory for IbssJoining timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13408 | break; |
| 13409 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13410 | status = csrIssueAddStaForSessionReq (pMac, i, pSelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13411 | break; |
| 13412 | } |
| 13413 | } |
| 13414 | if( CSR_ROAM_SESSION_MAX == i ) |
| 13415 | { |
| 13416 | //No session is available |
| 13417 | status = eHAL_STATUS_RESOURCES; |
| 13418 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13419 | return ( status ); |
| 13420 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13421 | eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 13422 | { |
| 13423 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13424 | tListElem *pEntry = NULL; |
| 13425 | tSmeCmd *pCommand = NULL; |
| 13426 | tSirSmeDelStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13427 | do |
| 13428 | { |
| 13429 | if(pMsg == NULL) |
| 13430 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13431 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13432 | status = eHAL_STATUS_FAILURE; |
| 13433 | break; |
| 13434 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13435 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 13436 | if(pEntry) |
| 13437 | { |
| 13438 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13439 | if(eSmeCommandDelStaSession == pCommand->command) |
| 13440 | { |
| 13441 | tANI_U8 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13442 | pRsp = (tSirSmeDelStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13443 | smsLog( pMac, LOG1, "Del Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13444 | //This session is done. |
| 13445 | csrCleanupSession(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13446 | if(pCommand->u.delStaSessionCmd.callback) |
| 13447 | { |
| 13448 | |
| 13449 | status = sme_ReleaseGlobalLock( &pMac->sme ); |
| 13450 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 13451 | { |
| 13452 | pCommand->u.delStaSessionCmd.callback( |
| 13453 | pCommand->u.delStaSessionCmd.pContext); |
| 13454 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 13455 | if (! HAL_STATUS_SUCCESS( status ) ) |
| 13456 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13457 | smsLog(pMac, LOGP, "%s: Failed to Acquire Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13458 | return status; |
| 13459 | } |
| 13460 | } |
| 13461 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13462 | smsLog(pMac, LOGE, "%s: Failed to Release Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13463 | } |
| 13464 | } |
| 13465 | |
| 13466 | //Remove this command out of the active list |
| 13467 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 13468 | { |
| 13469 | //Now put this command back on the avilable command list |
| 13470 | csrReleaseCommand(pMac, pCommand); |
| 13471 | } |
| 13472 | smeProcessPendingQueue( pMac ); |
| 13473 | } |
| 13474 | else |
| 13475 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13476 | 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] | 13477 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13478 | status = eHAL_STATUS_FAILURE; |
| 13479 | break; |
| 13480 | } |
| 13481 | } |
| 13482 | else |
| 13483 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13484 | 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] | 13485 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13486 | status = eHAL_STATUS_FAILURE; |
| 13487 | break; |
| 13488 | } |
| 13489 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13490 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13491 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13492 | eHalStatus csrSendMBDelSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 13493 | { |
| 13494 | tSirSmeDelStaSelfReq *pMsg; |
| 13495 | tANI_U16 msgLen; |
| 13496 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13497 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13498 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 13499 | sizeof( tSirBssType )*/; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13500 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 13501 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 13502 | |
| 13503 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13504 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_STA_SELF_REQ); |
| 13505 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13506 | // self station address |
| 13507 | palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13508 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13509 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13510 | return( status ); |
| 13511 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13512 | eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13513 | tSirMacAddr sessionMacAddr, |
| 13514 | csrRoamSessionCloseCallback callback, |
| 13515 | void *pContext) |
| 13516 | { |
| 13517 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13518 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13519 | pCommand = csrGetCommandBuffer(pMac); |
| 13520 | if(NULL == pCommand) |
| 13521 | { |
| 13522 | status = eHAL_STATUS_RESOURCES; |
| 13523 | } |
| 13524 | else |
| 13525 | { |
| 13526 | pCommand->command = eSmeCommandDelStaSession; |
| 13527 | pCommand->sessionId = (tANI_U8)sessionId; |
| 13528 | pCommand->u.delStaSessionCmd.callback = callback; |
| 13529 | pCommand->u.delStaSessionCmd.pContext = pContext; |
| 13530 | palCopyMemory( pMac->hHdd, pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13531 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 13532 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 13533 | { |
| 13534 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13535 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13536 | } |
| 13537 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13538 | return (status); |
| 13539 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13540 | eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 13541 | { |
| 13542 | return csrSendMBDelSelfStaReqMsg( pMac, |
| 13543 | pCommand->u.delStaSessionCmd.selfMacAddr ); |
| 13544 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13545 | static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13546 | { |
| 13547 | tDblLinkList *pList = &pMac->roam.roamCmdPendingList; |
| 13548 | tListElem *pEntry, *pNext; |
| 13549 | tSmeCmd *pCommand; |
| 13550 | tDblLinkList localList; |
| 13551 | |
| 13552 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 13553 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 13554 | { |
| 13555 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 13556 | return; |
| 13557 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13558 | csrLLLock(pList); |
| 13559 | pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK); |
| 13560 | while(pEntry != NULL) |
| 13561 | { |
| 13562 | pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK); |
| 13563 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13564 | if(pCommand->sessionId == sessionId) |
| 13565 | { |
| 13566 | if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK)) |
| 13567 | { |
| 13568 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 13569 | } |
| 13570 | } |
| 13571 | pEntry = pNext; |
| 13572 | } |
| 13573 | csrLLUnlock(pList); |
| 13574 | |
| 13575 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 13576 | { |
| 13577 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13578 | csrAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 13579 | } |
| 13580 | csrLLClose(&localList); |
| 13581 | } |
| 13582 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13583 | void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13584 | { |
| 13585 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 13586 | { |
| 13587 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13588 | csrRoamStop(pMac, sessionId); |
| 13589 | csrFreeConnectBssDesc(pMac, sessionId); |
| 13590 | csrRoamFreeConnectProfile( pMac, &pSession->connectedProfile ); |
| 13591 | csrRoamFreeConnectedInfo ( pMac, &pSession->connectedInfo); |
| 13592 | palTimerFree(pMac->hHdd, pSession->hTimerRoaming); |
| 13593 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 13594 | palTimerFree(pMac->hHdd, pSession->hTimerJoinRetry); |
| 13595 | #endif |
| 13596 | palTimerFree(pMac->hHdd, pSession->hTimerIbssJoining); |
| 13597 | purgeSmeSessionCmdList(pMac, sessionId); |
| 13598 | purgeCsrSessionCmdList(pMac, sessionId); |
| 13599 | csrInitSession(pMac, sessionId); |
| 13600 | } |
| 13601 | } |
| 13602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13603 | eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13604 | tANI_BOOLEAN fSync, |
| 13605 | csrRoamSessionCloseCallback callback, |
| 13606 | void *pContext ) |
| 13607 | { |
| 13608 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13609 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 13610 | { |
| 13611 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13612 | if(fSync) |
| 13613 | { |
| 13614 | csrCleanupSession(pMac, sessionId); |
| 13615 | } |
| 13616 | else |
| 13617 | { |
| 13618 | purgeSmeSessionCmdList(pMac, sessionId); |
| 13619 | purgeCsrSessionCmdList(pMac, sessionId); |
| 13620 | status = csrIssueDelStaForSessionReq( pMac, sessionId, |
| 13621 | pSession->selfMacAddr, callback, pContext); |
| 13622 | } |
| 13623 | } |
| 13624 | else |
| 13625 | { |
| 13626 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 13627 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13628 | return ( status ); |
| 13629 | } |
| 13630 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13631 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 13632 | { |
| 13633 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13634 | |
| 13635 | if(!pSession) |
| 13636 | { |
| 13637 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13638 | return; |
| 13639 | } |
| 13640 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13641 | pSession->sessionActive = eANI_BOOLEAN_FALSE; |
| 13642 | pSession->sessionId = CSR_SESSION_ID_INVALID; |
| 13643 | pSession->callback = NULL; |
| 13644 | pSession->pContext = NULL; |
| 13645 | pSession->ibss_join_pending = FALSE; |
| 13646 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 13647 | // TODO : Confirm pMac->roam.fReadyForPowerSave = eANI_BOOLEAN_FALSE; |
| 13648 | csrFreeRoamProfile( pMac, sessionId ); |
| 13649 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 13650 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 13651 | csrFreeConnectBssDesc(pMac, sessionId); |
| 13652 | csrScanEnable(pMac); |
| 13653 | palZeroMemory( pMac->hHdd, &pSession->selfMacAddr, sizeof(tCsrBssid) ); |
| 13654 | if(pSession->pWpaRsnReqIE) |
| 13655 | { |
| 13656 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 13657 | pSession->pWpaRsnReqIE = NULL; |
| 13658 | } |
| 13659 | pSession->nWpaRsnReqIeLength = 0; |
| 13660 | if(pSession->pWpaRsnRspIE) |
| 13661 | { |
| 13662 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE); |
| 13663 | pSession->pWpaRsnRspIE = NULL; |
| 13664 | } |
| 13665 | pSession->nWpaRsnRspIeLength = 0; |
| 13666 | #ifdef FEATURE_WLAN_WAPI |
| 13667 | if(pSession->pWapiReqIE) |
| 13668 | { |
| 13669 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 13670 | pSession->pWapiReqIE = NULL; |
| 13671 | } |
| 13672 | pSession->nWapiReqIeLength = 0; |
| 13673 | if(pSession->pWapiRspIE) |
| 13674 | { |
| 13675 | palFreeMemory(pMac->hHdd, pSession->pWapiRspIE); |
| 13676 | pSession->pWapiRspIE = NULL; |
| 13677 | } |
| 13678 | pSession->nWapiRspIeLength = 0; |
| 13679 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13680 | if(pSession->pAddIEScan) |
| 13681 | { |
| 13682 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 13683 | pSession->pAddIEScan = NULL; |
| 13684 | } |
| 13685 | pSession->nAddIEScanLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13686 | if(pSession->pAddIEAssoc) |
| 13687 | { |
| 13688 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 13689 | pSession->pAddIEAssoc = NULL; |
| 13690 | } |
| 13691 | pSession->nAddIEAssocLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13692 | } |
| 13693 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13694 | eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId ) |
| 13695 | { |
| 13696 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13697 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13698 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13699 | { |
| 13700 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13701 | { |
| 13702 | if( csrIsMacAddressEqual( pMac, bssid, &pMac->roam.roamSession[i].connectedProfile.bssid ) ) |
| 13703 | { |
| 13704 | //Found it |
| 13705 | status = eHAL_STATUS_SUCCESS; |
| 13706 | *pSessionId = i; |
| 13707 | break; |
| 13708 | } |
| 13709 | } |
| 13710 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13711 | return( status ); |
| 13712 | } |
| 13713 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13714 | //This function assumes that we only support one IBSS session. We cannot use BSSID to identify |
| 13715 | //session because for IBSS, the bssid changes. |
| 13716 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ) |
| 13717 | { |
| 13718 | tANI_U32 i, nRet = CSR_SESSION_ID_INVALID; |
| 13719 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13720 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13721 | { |
| 13722 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13723 | { |
| 13724 | pSession = CSR_GET_SESSION( pMac, i ); |
| 13725 | if( pSession->pCurRoamProfile && ( csrIsBssTypeIBSS( pSession->connectedProfile.BSSType ) ) ) |
| 13726 | { |
| 13727 | //Found it |
| 13728 | nRet = i; |
| 13729 | break; |
| 13730 | } |
| 13731 | } |
| 13732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13733 | return (nRet); |
| 13734 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13735 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid) |
| 13736 | { |
| 13737 | /* Update the current BSS info in ho control block based on connected |
| 13738 | profile info from pmac global structure */ |
| 13739 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13740 | 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] | 13741 | bssid[ 0 ], bssid[ 1 ], bssid[ 2 ], |
| 13742 | bssid[ 3 ], bssid[ 4 ], bssid[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13743 | /* Check for user misconfig of RSSI trigger threshold */ |
| 13744 | pMac->roam.configParam.vccRssiThreshold = |
| 13745 | ( 0 == pMac->roam.configParam.vccRssiThreshold ) ? |
| 13746 | CSR_VCC_RSSI_THRESHOLD : pMac->roam.configParam.vccRssiThreshold; |
| 13747 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13748 | /* Check for user misconfig of UL MAC Loss trigger threshold */ |
| 13749 | pMac->roam.configParam.vccUlMacLossThreshold = |
| 13750 | ( 0 == pMac->roam.configParam.vccUlMacLossThreshold ) ? |
| 13751 | CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13752 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 13753 | { |
| 13754 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13755 | /* Indicate the neighbor roal algorithm about the connect indication */ |
| 13756 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId); |
| 13757 | csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS); |
| 13758 | } |
| 13759 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13760 | } |
| 13761 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13762 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13763 | { |
| 13764 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13765 | |
| 13766 | if(!pSession) |
| 13767 | { |
| 13768 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13769 | return; |
| 13770 | } |
| 13771 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13772 | //Only to handle the case for Handover on infra link |
| 13773 | if( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 13774 | { |
| 13775 | return; |
| 13776 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13777 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 13778 | csrRoamDeregStatisticsReq(pMac); |
| 13779 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 13780 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 13781 | /* Indicate the neighbor roal algorithm about the disconnect indication */ |
| 13782 | csrNeighborRoamIndicateDisconnect(pMac, sessionId); |
| 13783 | #endif |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 13784 | |
| 13785 | //Remove this code once SLM_Sessionization is supported |
| 13786 | //BMPS_WORKAROUND_NOT_NEEDED |
| 13787 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 13788 | csrIsInfraApStarted( pMac ) && |
| 13789 | pMac->roam.configParam.doBMPSWorkaround) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13790 | { |
| 13791 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 13792 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13793 | } |
| 13794 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13795 | void csrRoamTlStatsTimerHandler(void *pv) |
| 13796 | { |
| 13797 | tpAniSirGlobal pMac = PMAC_STRUCT( pv ); |
| 13798 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13799 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 13800 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13801 | smsLog(pMac, LOG1, FL(" TL stat timer is no-op. It needs to support multiple stations")); |
| 13802 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13803 | #if 0 |
| 13804 | // TODO Persession .??? |
| 13805 | //req TL for stats |
| 13806 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId)) |
| 13807 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13808 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:couldn't get the stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13809 | } |
| 13810 | else |
| 13811 | { |
| 13812 | //save in SME |
| 13813 | csrRoamSaveStatsFromTl(pMac, tlStats); |
| 13814 | } |
| 13815 | #endif |
| 13816 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 13817 | { |
| 13818 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 13819 | { |
| 13820 | //start timer |
| 13821 | status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 13822 | pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE); |
| 13823 | if(!HAL_STATUS_SUCCESS(status)) |
| 13824 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13825 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13826 | return; |
| 13827 | } |
| 13828 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 13829 | } |
| 13830 | } |
| 13831 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13832 | void csrRoamPeStatsTimerHandler(void *pv) |
| 13833 | { |
| 13834 | tCsrPeStatsReqInfo *pPeStatsReqListEntry = (tCsrPeStatsReqInfo *)pv; |
| 13835 | eHalStatus status; |
| 13836 | tpAniSirGlobal pMac = pPeStatsReqListEntry->pMac; |
| 13837 | VOS_STATUS vosStatus; |
| 13838 | tPmcPowerState powerState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13839 | pPeStatsReqListEntry->timerRunning = FALSE; |
| 13840 | if( pPeStatsReqListEntry->timerStopFailed == TRUE ) |
| 13841 | { |
| 13842 | // If we entered here, meaning the timer could not be successfully |
| 13843 | // stopped in csrRoamRemoveEntryFromPeStatsReqList(). So do it here. |
| 13844 | |
| 13845 | /* Destroy the timer */ |
| 13846 | vosStatus = vos_timer_destroy( &pPeStatsReqListEntry->hPeStatsTimer ); |
| 13847 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13848 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13849 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13850 | } |
| 13851 | |
| 13852 | // Free the entry |
| 13853 | palFreeMemory(pMac->hHdd, pPeStatsReqListEntry); |
| 13854 | pPeStatsReqListEntry = NULL; |
| 13855 | } |
| 13856 | else |
| 13857 | { |
| 13858 | if(!pPeStatsReqListEntry->rspPending) |
| 13859 | { |
| 13860 | status = csrSendMBStatsReqMsg(pMac, pPeStatsReqListEntry->statsMask & ~(1 << eCsrGlobalClassDStats), |
| 13861 | pPeStatsReqListEntry->staId); |
| 13862 | if(!HAL_STATUS_SUCCESS(status)) |
| 13863 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13864 | 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] | 13865 | } |
| 13866 | else |
| 13867 | { |
| 13868 | pPeStatsReqListEntry->rspPending = TRUE; |
| 13869 | } |
| 13870 | } |
| 13871 | |
| 13872 | //send down a req |
| 13873 | if(pPeStatsReqListEntry->periodicity && |
| 13874 | (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pPeStatsReqListEntry->hPeStatsTimer))) |
| 13875 | { |
| 13876 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 13877 | if(ePMC_FULL_POWER == powerState) |
| 13878 | { |
| 13879 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 13880 | { |
| 13881 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 13882 | } |
| 13883 | } |
| 13884 | else |
| 13885 | { |
| 13886 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 13887 | { |
| 13888 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 13889 | } |
| 13890 | } |
| 13891 | //start timer |
| 13892 | vosStatus = vos_timer_start( &pPeStatsReqListEntry->hPeStatsTimer, pPeStatsReqListEntry->periodicity ); |
| 13893 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13894 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13895 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13896 | return; |
| 13897 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13898 | pPeStatsReqListEntry->timerRunning = TRUE; |
| 13899 | |
| 13900 | } |
| 13901 | |
| 13902 | } |
| 13903 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13904 | void csrRoamStatsClientTimerHandler(void *pv) |
| 13905 | { |
| 13906 | tCsrStatsClientReqInfo *pStaEntry = (tCsrStatsClientReqInfo *)pv; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13907 | if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pStaEntry->timer)) |
| 13908 | { |
| 13909 | #if 0 |
| 13910 | // TODO Stats fix for multisession |
| 13911 | //start the timer |
| 13912 | vosStatus = vos_timer_start( &pStaEntry->timer, pStaEntry->periodicity ); |
| 13913 | |
| 13914 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13915 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13916 | smsLog(pStaEntry->pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13917 | } |
| 13918 | #endif |
| 13919 | } |
| 13920 | #if 0 |
| 13921 | //send up the stats report |
| 13922 | csrRoamReportStatistics(pStaEntry->pMac, pStaEntry->statsMask, pStaEntry->callback, |
| 13923 | pStaEntry->staId, pStaEntry->pContext); |
| 13924 | #endif |
| 13925 | } |
| 13926 | |
| 13927 | |
| 13928 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13929 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId) |
| 13930 | { |
| 13931 | tAniGetPEStatsReq *pMsg; |
| 13932 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13933 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetPEStatsReq)); |
| 13934 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 13935 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13936 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to allocate mem for stats req "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13937 | return status; |
| 13938 | } |
| 13939 | // need to initiate a stats request to PE |
| 13940 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_STATISTICS_REQ); |
| 13941 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq); |
| 13942 | pMsg->staId = staId; |
| 13943 | pMsg->statsMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13944 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13945 | if(!HAL_STATUS_SUCCESS(status)) |
| 13946 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13947 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to send down the stats req "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13948 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13949 | return status; |
| 13950 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13951 | void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg) |
| 13952 | { |
| 13953 | tAniGetPEStatsRsp *pSmeStatsRsp; |
| 13954 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13955 | tListElem *pEntry = NULL; |
| 13956 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 13957 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 13958 | tANI_U32 tempMask = 0; |
| 13959 | tANI_U8 counter = 0; |
| 13960 | tANI_U8 *pStats = NULL; |
| 13961 | tANI_U32 length = 0; |
| 13962 | v_PVOID_t pvosGCtx; |
| 13963 | v_S7_t rssi = 0; |
| 13964 | tANI_U32 *pRssi = NULL; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 13965 | tANI_U32 linkCapacity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13966 | pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg; |
| 13967 | if(pSmeStatsRsp->rc) |
| 13968 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13969 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:stats rsp from PE shows failure")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13970 | goto post_update; |
| 13971 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13972 | tempMask = pSmeStatsRsp->statsMask; |
| 13973 | pStats = ((tANI_U8 *)&pSmeStatsRsp->statsMask) + sizeof(pSmeStatsRsp->statsMask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13974 | /* subtract all statistics from this length, and after processing the entire |
| 13975 | * 'stat' part of the message, if the length is not zero, then rssi is piggy packed |
| 13976 | * in this 'stats' message. |
| 13977 | */ |
| 13978 | length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13979 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 13980 | while(tempMask) |
| 13981 | { |
| 13982 | if(tempMask & 1) |
| 13983 | { |
| 13984 | switch(counter) |
| 13985 | { |
| 13986 | case eCsrSummaryStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13987 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13988 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 13989 | pStats, sizeof(tCsrSummaryStatsInfo)); |
| 13990 | if(!HAL_STATUS_SUCCESS(status)) |
| 13991 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13992 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13993 | } |
| 13994 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 13995 | length -= sizeof(tCsrSummaryStatsInfo); |
| 13996 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13997 | case eCsrGlobalClassAStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13998 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13999 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 14000 | pStats, sizeof(tCsrGlobalClassAStatsInfo)); |
| 14001 | if(!HAL_STATUS_SUCCESS(status)) |
| 14002 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14003 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14004 | } |
| 14005 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
| 14006 | length -= sizeof(tCsrGlobalClassAStatsInfo); |
| 14007 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14008 | case eCsrGlobalClassBStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14009 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14010 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 14011 | pStats, sizeof(tCsrGlobalClassBStatsInfo)); |
| 14012 | if(!HAL_STATUS_SUCCESS(status)) |
| 14013 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14014 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14015 | } |
| 14016 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
| 14017 | length -= sizeof(tCsrGlobalClassBStatsInfo); |
| 14018 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14019 | case eCsrGlobalClassCStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14020 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14021 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 14022 | pStats, sizeof(tCsrGlobalClassCStatsInfo)); |
| 14023 | if(!HAL_STATUS_SUCCESS(status)) |
| 14024 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14025 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14026 | } |
| 14027 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
| 14028 | length -= sizeof(tCsrGlobalClassCStatsInfo); |
| 14029 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14030 | case eCsrPerStaStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14031 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14032 | if( CSR_MAX_STA > pSmeStatsRsp->staId ) |
| 14033 | { |
| 14034 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId], |
| 14035 | pStats, sizeof(tCsrPerStaStatsInfo)); |
| 14036 | } |
| 14037 | else |
| 14038 | { |
| 14039 | status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14040 | smsLog( pMac, LOGE, FL("csrRoamStatsRspProcessor:out bound staId:%d"), pSmeStatsRsp->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14041 | VOS_ASSERT( 0 ); |
| 14042 | } |
| 14043 | if(!HAL_STATUS_SUCCESS(status)) |
| 14044 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14045 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14046 | } |
| 14047 | pStats += sizeof(tCsrPerStaStatsInfo); |
| 14048 | length -= sizeof(tCsrPerStaStatsInfo); |
| 14049 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14050 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14051 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14052 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14053 | } |
| 14054 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14055 | tempMask >>=1; |
| 14056 | counter++; |
| 14057 | } |
| 14058 | pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 14059 | if (length != 0) |
| 14060 | { |
| 14061 | pRssi = (tANI_U32*)pStats; |
| 14062 | rssi = (v_S7_t)*pRssi; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14063 | pStats += sizeof(tANI_U32); |
| 14064 | length -= sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14065 | } |
| 14066 | else |
| 14067 | { |
| 14068 | /* If riva is not sending rssi, continue to use the hack */ |
| 14069 | rssi = RSSI_HACK_BMPS; |
| 14070 | } |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14071 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14072 | WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14073 | |
| 14074 | if (length != 0) |
| 14075 | { |
| 14076 | linkCapacity = *(tANI_U32*)pStats; |
| 14077 | } |
| 14078 | else |
| 14079 | { |
| 14080 | linkCapacity = 0; |
| 14081 | } |
| 14082 | |
| 14083 | WDA_UpdateLinkCapacity(pvosGCtx, pSmeStatsRsp->staId, linkCapacity); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14084 | post_update: |
| 14085 | //make sure to update the pe stats req list |
| 14086 | pEntry = csrRoamFindInPeStatsReqList(pMac, pSmeStatsRsp->statsMask); |
| 14087 | if(pEntry) |
| 14088 | { |
| 14089 | pPeStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
| 14090 | pPeStaEntry->rspPending = FALSE; |
| 14091 | |
| 14092 | } |
| 14093 | //check the one timer cases |
| 14094 | pEntry = csrRoamCheckClientReqList(pMac, pSmeStatsRsp->statsMask); |
| 14095 | if(pEntry) |
| 14096 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14097 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14098 | if(pTempStaEntry->timerExpired) |
| 14099 | { |
| 14100 | //send up the stats report |
| 14101 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 14102 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 14103 | //also remove from the client list |
| 14104 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 14105 | pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14106 | } |
| 14107 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14108 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14109 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 14110 | { |
| 14111 | tListElem *pEntry = NULL; |
| 14112 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14113 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14114 | if(!pEntry) |
| 14115 | { |
| 14116 | //list empty |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14117 | smsLog(pMac, LOG2, "csrRoamFindInPeStatsReqList: List empty, no request to PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14118 | return NULL; |
| 14119 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14120 | while( pEntry ) |
| 14121 | { |
| 14122 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14123 | if(pTempStaEntry->statsMask == statsMask) |
| 14124 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14125 | smsLog(pMac, LOG3, "csrRoamFindInPeStatsReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14126 | break; |
| 14127 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14128 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14129 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14130 | return pEntry; |
| 14131 | } |
| 14132 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14133 | tListElem * csrRoamChecknUpdateClientReqList(tpAniSirGlobal pMac, tCsrStatsClientReqInfo *pStaEntry, |
| 14134 | tANI_BOOLEAN update) |
| 14135 | { |
| 14136 | tListElem *pEntry; |
| 14137 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14138 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14139 | if(!pEntry) |
| 14140 | { |
| 14141 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14142 | smsLog(pMac, LOG2, "csrRoamChecknUpdateClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14143 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14144 | return NULL; |
| 14145 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14146 | while( pEntry ) |
| 14147 | { |
| 14148 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14149 | if((pTempStaEntry->requesterId == pStaEntry->requesterId) && |
| 14150 | (pTempStaEntry->statsMask == pStaEntry->statsMask)) |
| 14151 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14152 | smsLog(pMac, LOG3, "csrRoamChecknUpdateClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14153 | if(update) |
| 14154 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14155 | pTempStaEntry->periodicity = pStaEntry->periodicity; |
| 14156 | pTempStaEntry->callback = pStaEntry->callback; |
| 14157 | pTempStaEntry->pContext = pStaEntry->pContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14158 | } |
| 14159 | break; |
| 14160 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14161 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14162 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14163 | return pEntry; |
| 14164 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14165 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 14166 | { |
| 14167 | tListElem *pEntry; |
| 14168 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14169 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14170 | if(!pEntry) |
| 14171 | { |
| 14172 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14173 | smsLog(pMac, LOG2, "csrRoamCheckClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14174 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14175 | return NULL; |
| 14176 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14177 | while( pEntry ) |
| 14178 | { |
| 14179 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14180 | if((pTempStaEntry->statsMask & ~(1 << eCsrGlobalClassDStats)) == statsMask) |
| 14181 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14182 | smsLog(pMac, LOG3, "csrRoamCheckClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14183 | break; |
| 14184 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14185 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14186 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14187 | return pEntry; |
| 14188 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14189 | eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac, |
| 14190 | csrRoamLinkQualityIndCallback callback, |
| 14191 | void *pContext) |
| 14192 | { |
| 14193 | pMac->roam.linkQualityIndInfo.callback = callback; |
| 14194 | pMac->roam.linkQualityIndInfo.context = pContext; |
| 14195 | if( NULL == callback ) |
| 14196 | { |
| 14197 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being deregistered"); |
| 14198 | } |
| 14199 | else |
| 14200 | { |
| 14201 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being registered"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14202 | /* do we need to invoke the callback to notify client of initial value ?? */ |
| 14203 | } |
| 14204 | return eHAL_STATUS_SUCCESS; |
| 14205 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14206 | void csrRoamVccTrigger(tpAniSirGlobal pMac) |
| 14207 | { |
| 14208 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 14209 | tANI_U32 ul_mac_loss = 0; |
| 14210 | tANI_U32 ul_mac_loss_trigger_threshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14211 | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 14212 | /*------------------------------------------------------------------------- |
| 14213 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14214 | Check for a change in link quality and notify client if necessary |
| 14215 | -------------------------------------------------------------------------*/ |
| 14216 | ul_mac_loss_trigger_threshold = |
| 14217 | pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14218 | VOS_ASSERT( ul_mac_loss_trigger_threshold != 0 ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14219 | smsLog(pMac, LOGW, "csrRoamVccTrigger: UL_MAC_LOSS_THRESHOLD is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14220 | ul_mac_loss_trigger_threshold ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14221 | if(ul_mac_loss_trigger_threshold < ul_mac_loss) |
| 14222 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14223 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is POOR "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14224 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 14225 | } |
| 14226 | else |
| 14227 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14228 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is GOOD"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14229 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 14230 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14231 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link qual : *** UL_MAC_LOSS %d *** ", |
| 14232 | ul_mac_loss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14233 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 14234 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14235 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14236 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 14237 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14238 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14239 | newVccLinkQuality ); |
| 14240 | |
| 14241 | /* we now invoke the callback once to notify client of initial value */ |
| 14242 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 14243 | pMac->roam.linkQualityIndInfo.context ); |
| 14244 | //event: EVENT_WLAN_VCC |
| 14245 | } |
| 14246 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14247 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
| 14248 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14249 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14250 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 14251 | v_U8_t rssiNotification, |
| 14252 | void * context) |
| 14253 | { |
| 14254 | tpAniSirGlobal pMac = PMAC_STRUCT( context ); |
| 14255 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 14256 | // TODO : Session info unavailable |
| 14257 | tANI_U32 sessionId = 0; |
| 14258 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 14259 | /*------------------------------------------------------------------------- |
| 14260 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14261 | Check for a change in link quality and notify client if necessary |
| 14262 | -------------------------------------------------------------------------*/ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14263 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: RSSI trigger threshold is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14264 | pMac->roam.configParam.vccRssiThreshold); |
| 14265 | if(!csrIsConnStateConnectedInfra(pMac, sessionId)) |
| 14266 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14267 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: ignoring the indication as we are not connected"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14268 | return VOS_STATUS_SUCCESS; |
| 14269 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14270 | if(WLANTL_HO_THRESHOLD_DOWN == rssiNotification) |
| 14271 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14272 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is POOR"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14273 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 14274 | } |
| 14275 | else if(WLANTL_HO_THRESHOLD_UP == rssiNotification) |
| 14276 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14277 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is GOOD "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14278 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 14279 | } |
| 14280 | else |
| 14281 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14282 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: unknown rssi notification %d", rssiNotification); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14283 | //Set to this so the code below won't do anything |
| 14284 | newVccLinkQuality = pMac->roam.vccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14285 | VOS_ASSERT(0); |
| 14286 | } |
| 14287 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14288 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 14289 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14290 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14291 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 14292 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14293 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14294 | newVccLinkQuality); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14295 | /* we now invoke the callback once to notify client of initial value */ |
| 14296 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 14297 | pMac->roam.linkQualityIndInfo.context ); |
| 14298 | //event: EVENT_WLAN_VCC |
| 14299 | } |
| 14300 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14301 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14302 | return status; |
| 14303 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14304 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 14305 | tDblLinkList *pStaList, |
| 14306 | tCsrStatsClientReqInfo *pStaEntry) |
| 14307 | { |
| 14308 | tCsrStatsClientReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14309 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14310 | //if same entity requested for same set of stats with different periodicity & |
| 14311 | // callback update it |
| 14312 | if(NULL == csrRoamChecknUpdateClientReqList(pMac, pStaEntry, TRUE)) |
| 14313 | { |
| 14314 | |
| 14315 | status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrStatsClientReqInfo)); |
| 14316 | if (!HAL_STATUS_SUCCESS(status)) |
| 14317 | { |
| 14318 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14319 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14320 | return NULL; |
| 14321 | } |
| 14322 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14323 | pNewStaEntry->callback = pStaEntry->callback; |
| 14324 | pNewStaEntry->pContext = pStaEntry->pContext; |
| 14325 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 14326 | pNewStaEntry->requesterId = pStaEntry->requesterId; |
| 14327 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 14328 | pNewStaEntry->pPeStaEntry = pStaEntry->pPeStaEntry; |
| 14329 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 14330 | pNewStaEntry->staId = pStaEntry->staId; |
| 14331 | pNewStaEntry->timerExpired = pStaEntry->timerExpired; |
| 14332 | |
| 14333 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
| 14334 | } |
| 14335 | return pNewStaEntry; |
| 14336 | } |
| 14337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14338 | tCsrPeStatsReqInfo * csrRoamInsertEntryIntoPeStatsReqList( tpAniSirGlobal pMac, |
| 14339 | tDblLinkList *pStaList, |
| 14340 | tCsrPeStatsReqInfo *pStaEntry) |
| 14341 | { |
| 14342 | tCsrPeStatsReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14343 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14344 | status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrPeStatsReqInfo)); |
| 14345 | if (!HAL_STATUS_SUCCESS(status)) |
| 14346 | { |
| 14347 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoPeStatsReqList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14348 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14349 | return NULL; |
| 14350 | } |
| 14351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14352 | pNewStaEntry->hPeStatsTimer = pStaEntry->hPeStatsTimer; |
| 14353 | pNewStaEntry->numClient = pStaEntry->numClient; |
| 14354 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 14355 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 14356 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 14357 | pNewStaEntry->staId = pStaEntry->staId; |
| 14358 | pNewStaEntry->timerRunning = pStaEntry->timerRunning; |
| 14359 | pNewStaEntry->rspPending = pStaEntry->rspPending; |
| 14360 | |
| 14361 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14362 | return pNewStaEntry; |
| 14363 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14364 | eHalStatus csrGetRssi(tpAniSirGlobal pMac, |
| 14365 | tCsrRssiCallback callback, |
| 14366 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 14367 | { |
| 14368 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14369 | vos_msg_t msg; |
| 14370 | tANI_U32 sessionId; |
| 14371 | |
| 14372 | tAniGetRssiReq *pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14373 | smsLog(pMac, LOG2, FL("called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14374 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetRssiReq)); |
| 14375 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 14376 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14377 | smsLog(pMac, LOGE, " csrGetRssi: failed to allocate mem for req "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14378 | return status; |
| 14379 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14380 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 14381 | |
| 14382 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_RSSI_REQ); |
| 14383 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 14384 | pMsg->sessionId = sessionId; |
| 14385 | pMsg->staId = staId; |
| 14386 | pMsg->rssiCallback = callback; |
| 14387 | pMsg->pDevContext = pContext; |
| 14388 | pMsg->pVosContext = pVosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14389 | msg.type = eWNI_SME_GET_RSSI_REQ; |
| 14390 | msg.bodyptr = pMsg; |
| 14391 | msg.reserved = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14392 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 14393 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14394 | smsLog(pMac, LOGE, " csrGetRssi failed to post msg to self "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14395 | palFreeMemory(pMac->hHdd, (void *)pMsg); |
| 14396 | status = eHAL_STATUS_FAILURE; |
| 14397 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14398 | smsLog(pMac, LOG2, FL("returned")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14399 | return status; |
| 14400 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 14401 | |
| 14402 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 14403 | eHalStatus csrGetRoamRssi(tpAniSirGlobal pMac, |
| 14404 | tCsrRssiCallback callback, |
| 14405 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 14406 | { |
| 14407 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14408 | tAniGetRssiReq *pMsg; |
| 14409 | |
| 14410 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetRssiReq)); |
| 14411 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 14412 | { |
| 14413 | smsLog(pMac, LOGE, " csrGetRoamRssi: failed to allocate mem for req"); |
| 14414 | return status; |
| 14415 | } |
| 14416 | // need to initiate a stats request to PE |
| 14417 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_ROAM_RSSI_REQ); |
| 14418 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 14419 | pMsg->staId = staId; |
| 14420 | pMsg->rssiCallback = callback; |
| 14421 | pMsg->pDevContext = pContext; |
| 14422 | pMsg->pVosContext = pVosContext; |
| 14423 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 14424 | if(!HAL_STATUS_SUCCESS(status)) |
| 14425 | { |
Tushnim Bhattacharyya | 41f7286 | 2013-04-03 21:34:01 -0700 | [diff] [blame] | 14426 | smsLog(pMac, LOG1, " csrGetRoamRssi: failed to send down the rssi req"); |
| 14427 | //pMsg is freed by palSendMBMessage |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 14428 | status = eHAL_STATUS_FAILURE; |
| 14429 | } |
| 14430 | return status; |
| 14431 | } |
| 14432 | #endif |
| 14433 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 14434 | /* --------------------------------------------------------------------------- |
| 14435 | \fn csrGetTLSTAState |
| 14436 | \helper function to get teh TL STA State whenever the function is called. |
| 14437 | |
| 14438 | \param staId - The staID to be passed to the TL |
| 14439 | to get the relevant TL STA State |
| 14440 | \return the state as tANI_U16 |
| 14441 | ---------------------------------------------------------------------------*/ |
| 14442 | tANI_U16 csrGetTLSTAState(tpAniSirGlobal pMac, tANI_U8 staId) |
| 14443 | { |
| 14444 | WLANTL_STAStateType tlSTAState; |
| 14445 | tlSTAState = WLANTL_STA_INIT; |
| 14446 | |
| 14447 | //request TL for STA State |
| 14448 | if ( !VOS_IS_STATUS_SUCCESS(WLANTL_GetSTAState(pMac->roam.gVosContext, staId, &tlSTAState)) ) |
| 14449 | { |
| 14450 | smsLog(pMac, LOGE, FL("csrGetTLSTAState:couldn't get the STA state from TL")); |
| 14451 | } |
| 14452 | |
| 14453 | return tlSTAState; |
| 14454 | } |
| 14455 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14456 | eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, |
| 14457 | tANI_U32 statsMask, |
| 14458 | tCsrStatsCallback callback, |
| 14459 | tANI_U32 periodicity, tANI_BOOLEAN cache, |
| 14460 | tANI_U8 staId, void *pContext) |
| 14461 | { |
| 14462 | tCsrStatsClientReqInfo staEntry; |
| 14463 | tCsrStatsClientReqInfo *pStaEntry = NULL; |
| 14464 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 14465 | tListElem *pEntry = NULL; |
| 14466 | tANI_BOOLEAN found = FALSE; |
| 14467 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14468 | tANI_BOOLEAN insertInClientList = FALSE; |
| 14469 | VOS_STATUS vosStatus; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14470 | WLANTL_TRANSFER_STA_TYPE *pTlStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14471 | |
| 14472 | if( csrIsAllSessionDisconnected(pMac) ) |
| 14473 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14474 | //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] | 14475 | return eHAL_STATUS_FAILURE; |
| 14476 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14477 | if((!statsMask) && (!callback)) |
| 14478 | { |
| 14479 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14480 | smsLog(pMac, LOGW, "csrGetStatistics: statsMask & callback empty in the request"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14481 | return eHAL_STATUS_FAILURE; |
| 14482 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14483 | //for the search list method for deregister |
| 14484 | staEntry.requesterId = requesterId; |
| 14485 | staEntry.statsMask = statsMask; |
| 14486 | //requester wants to deregister or just an error |
| 14487 | if((statsMask) && (!callback)) |
| 14488 | { |
| 14489 | pEntry = csrRoamChecknUpdateClientReqList(pMac, &staEntry, FALSE); |
| 14490 | if(!pEntry) |
| 14491 | { |
| 14492 | //msg |
| 14493 | 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] | 14494 | "find any existing request in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14495 | return eHAL_STATUS_FAILURE; |
| 14496 | } |
| 14497 | else |
| 14498 | { |
| 14499 | //clean up & return |
| 14500 | pStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 14501 | if(NULL != pStaEntry->pPeStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14502 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14503 | pStaEntry->pPeStaEntry->numClient--; |
| 14504 | //check if we need to delete the entry from peStatsReqList too |
| 14505 | if(!pStaEntry->pPeStaEntry->numClient) |
| 14506 | { |
| 14507 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pStaEntry->pPeStaEntry); |
| 14508 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14509 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 14510 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14511 | //check if we need to stop the tl stats timer too |
| 14512 | pMac->roam.tlStatsReqInfo.numClient--; |
| 14513 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 14514 | { |
| 14515 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 14516 | { |
| 14517 | status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 14518 | if(!HAL_STATUS_SUCCESS(status)) |
| 14519 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14520 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14521 | return eHAL_STATUS_FAILURE; |
| 14522 | } |
| 14523 | } |
| 14524 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 14525 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 14526 | } |
| 14527 | vos_timer_stop( &pStaEntry->timer ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14528 | // Destroy the vos timer... |
| 14529 | vosStatus = vos_timer_destroy( &pStaEntry->timer ); |
| 14530 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14531 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14532 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14533 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14534 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 14535 | pStaEntry = NULL; |
| 14536 | return eHAL_STATUS_SUCCESS; |
| 14537 | } |
| 14538 | } |
| 14539 | |
| 14540 | if(cache && !periodicity) |
| 14541 | { |
| 14542 | //return the cached stats |
| 14543 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 14544 | } |
| 14545 | else |
| 14546 | { |
| 14547 | //add the request in the client req list |
| 14548 | staEntry.callback = callback; |
| 14549 | staEntry.pContext = pContext; |
| 14550 | staEntry.periodicity = periodicity; |
| 14551 | staEntry.pPeStaEntry = NULL; |
| 14552 | staEntry.staId = staId; |
| 14553 | staEntry.pMac = pMac; |
| 14554 | staEntry.timerExpired = FALSE; |
| 14555 | |
| 14556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14557 | //if periodic report requested with non cached result from PE/TL |
| 14558 | if(periodicity) |
| 14559 | { |
| 14560 | |
| 14561 | //if looking for stats from PE |
| 14562 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 14563 | { |
| 14564 | |
| 14565 | //check if same request made already & waiting for rsp |
| 14566 | pPeStaEntry = csrRoamCheckPeStatsReqList(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), |
| 14567 | periodicity, &found, staId); |
| 14568 | if(!pPeStaEntry) |
| 14569 | { |
| 14570 | //bail out, maxed out on number of req for PE |
| 14571 | return eHAL_STATUS_FAILURE; |
| 14572 | } |
| 14573 | else |
| 14574 | { |
| 14575 | staEntry.pPeStaEntry = pPeStaEntry; |
| 14576 | } |
| 14577 | |
| 14578 | } |
| 14579 | //request stats from TL rightaway if requested by client, update tlStatsReqInfo if needed |
| 14580 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 14581 | { |
| 14582 | if(cache && pMac->roam.tlStatsReqInfo.numClient) |
| 14583 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14584 | smsLog(pMac, LOGE, FL("csrGetStatistics:Looking for cached stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14585 | } |
| 14586 | else |
| 14587 | { |
| 14588 | |
| 14589 | //update periodicity |
| 14590 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 14591 | { |
| 14592 | pMac->roam.tlStatsReqInfo.periodicity = |
| 14593 | CSR_ROAM_MIN(periodicity, pMac->roam.tlStatsReqInfo.periodicity); |
| 14594 | } |
| 14595 | else |
| 14596 | { |
| 14597 | pMac->roam.tlStatsReqInfo.periodicity = periodicity; |
| 14598 | } |
| 14599 | if(pMac->roam.tlStatsReqInfo.periodicity < CSR_MIN_TL_STAT_QUERY_PERIOD) |
| 14600 | { |
| 14601 | pMac->roam.tlStatsReqInfo.periodicity = CSR_MIN_TL_STAT_QUERY_PERIOD; |
| 14602 | } |
| 14603 | |
| 14604 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 14605 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14606 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 14607 | if(NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14608 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14609 | //req TL for class D stats |
| 14610 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId)) |
| 14611 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14612 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14613 | } |
| 14614 | else |
| 14615 | { |
| 14616 | //save in SME |
| 14617 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 14618 | } |
| 14619 | vos_mem_free(pTlStats); |
| 14620 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14621 | } |
| 14622 | else |
| 14623 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14624 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14625 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14626 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14627 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 14628 | { |
| 14629 | //start timer |
| 14630 | status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 14631 | pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE); |
| 14632 | if(!HAL_STATUS_SUCCESS(status)) |
| 14633 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14634 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14635 | return eHAL_STATUS_FAILURE; |
| 14636 | } |
| 14637 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 14638 | } |
| 14639 | } |
| 14640 | } |
| 14641 | pMac->roam.tlStatsReqInfo.numClient++; |
| 14642 | } |
| 14643 | |
| 14644 | insertInClientList = TRUE; |
| 14645 | } |
| 14646 | //if one time report requested with non cached result from PE/TL |
| 14647 | else if(!cache && !periodicity) |
| 14648 | { |
| 14649 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 14650 | { |
| 14651 | //send down a req |
| 14652 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 14653 | if(!HAL_STATUS_SUCCESS(status)) |
| 14654 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14655 | 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] | 14656 | } |
| 14657 | //so that when the stats rsp comes back from PE we respond to upper layer |
| 14658 | //right away |
| 14659 | staEntry.timerExpired = TRUE; |
| 14660 | insertInClientList = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14661 | } |
| 14662 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 14663 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14664 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 14665 | if(NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14666 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14667 | //req TL for class D stats |
| 14668 | if(!VOS_IS_STATUS_SUCCESS(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId))) |
| 14669 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14670 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14671 | } |
| 14672 | else |
| 14673 | { |
| 14674 | //save in SME |
| 14675 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 14676 | } |
| 14677 | vos_mem_free(pTlStats); |
| 14678 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14679 | } |
| 14680 | else |
| 14681 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14682 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14683 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14684 | |
| 14685 | } |
| 14686 | //if looking for stats from TL only |
| 14687 | if(!insertInClientList) |
| 14688 | { |
| 14689 | //return the stats |
| 14690 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 14691 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14692 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14693 | if(insertInClientList) |
| 14694 | { |
| 14695 | pStaEntry = csrRoamInsertEntryIntoList(pMac, &pMac->roam.statsClientReqList, &staEntry); |
| 14696 | if(!pStaEntry) |
| 14697 | { |
| 14698 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14699 | smsLog(pMac, LOGW, "csrGetStatistics: Failed to insert req in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14700 | return eHAL_STATUS_FAILURE; |
| 14701 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14702 | pStaEntry->periodicity = periodicity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14703 | //Init & start timer if needed |
| 14704 | if(periodicity) |
| 14705 | { |
| 14706 | vosStatus = vos_timer_init( &pStaEntry->timer, VOS_TIMER_TYPE_SW, |
| 14707 | csrRoamStatsClientTimerHandler, pStaEntry ); |
| 14708 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14709 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14710 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot init StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14711 | return eHAL_STATUS_FAILURE; |
| 14712 | } |
| 14713 | vosStatus = vos_timer_start( &pStaEntry->timer, periodicity ); |
| 14714 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14715 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14716 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14717 | return eHAL_STATUS_FAILURE; |
| 14718 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14719 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14720 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14721 | } |
| 14722 | return eHAL_STATUS_SUCCESS; |
| 14723 | } |
| 14724 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 14725 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 14726 | |
| 14727 | static tSirRetStatus |
| 14728 | csrRoamScanOffloadPopulateMacHeader(tpAniSirGlobal pMac, |
| 14729 | tANI_U8* pBD, |
| 14730 | tANI_U8 type, |
| 14731 | tANI_U8 subType, |
| 14732 | tSirMacAddr peerAddr, |
| 14733 | tSirMacAddr selfMacAddr) |
| 14734 | { |
| 14735 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 14736 | tpSirMacMgmtHdr pMacHdr; |
| 14737 | |
| 14738 | /* Prepare MAC management header */ |
| 14739 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 14740 | |
| 14741 | /* Prepare FC */ |
| 14742 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 14743 | pMacHdr->fc.type = type; |
| 14744 | pMacHdr->fc.subType = subType; |
| 14745 | |
| 14746 | /* Prepare Address 1 */ |
| 14747 | palCopyMemory( pMac->hHdd, |
| 14748 | (tANI_U8 *) pMacHdr->da, |
| 14749 | (tANI_U8 *) peerAddr, |
| 14750 | sizeof( tSirMacAddr )); |
| 14751 | |
| 14752 | sirCopyMacAddr(pMacHdr->sa,selfMacAddr); |
| 14753 | |
| 14754 | /* Prepare Address 3 */ |
| 14755 | palCopyMemory( pMac->hHdd, |
| 14756 | (tANI_U8 *) pMacHdr->bssId, |
| 14757 | (tANI_U8 *) peerAddr, |
| 14758 | sizeof( tSirMacAddr )); |
| 14759 | return statusCode; |
| 14760 | } /*** csrRoamScanOffloadPopulateMacHeader() ***/ |
| 14761 | |
| 14762 | static tSirRetStatus |
| 14763 | csrRoamScanOffloadPrepareProbeReqTemplate(tpAniSirGlobal pMac, |
| 14764 | tANI_U8 nChannelNum, |
| 14765 | tANI_U32 dot11mode, |
| 14766 | tSirMacAddr selfMacAddr, |
| 14767 | tANI_U8 *pFrame, |
| 14768 | tANI_U16 *pusLen) |
| 14769 | { |
| 14770 | tDot11fProbeRequest pr; |
| 14771 | tANI_U32 nStatus, nBytes, nPayload; |
| 14772 | tSirRetStatus nSirStatus; |
| 14773 | /*Bcast tx*/ |
| 14774 | tSirMacAddr bssId = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 14775 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 14776 | |
| 14777 | |
| 14778 | palZeroMemory( pMac->hHdd, ( tANI_U8* )&pr, sizeof( pr ) ); |
| 14779 | |
| 14780 | PopulateDot11fSuppRates( pMac, nChannelNum, &pr.SuppRates,NULL); |
| 14781 | |
| 14782 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 14783 | { |
| 14784 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 14785 | } |
| 14786 | |
| 14787 | |
| 14788 | if (IS_DOT11_MODE_HT(dot11mode)) |
| 14789 | { |
| 14790 | PopulateDot11fHTCaps( pMac, NULL, &pr.HTCaps ); |
| 14791 | } |
| 14792 | |
| 14793 | |
| 14794 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 14795 | if ( DOT11F_FAILED( nStatus ) ) |
| 14796 | { |
| 14797 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14798 | "Failed to calculate the packed size f" |
| 14799 | "or a Probe Request (0x%08x).\n", nStatus ); |
| 14800 | |
| 14801 | |
| 14802 | nPayload = sizeof( tDot11fProbeRequest ); |
| 14803 | } |
| 14804 | else if ( DOT11F_WARNED( nStatus ) ) |
| 14805 | { |
| 14806 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14807 | "There were warnings while calculating" |
| 14808 | "the packed size for a Probe Request (" |
| 14809 | "0x%08x).\n", nStatus ); |
| 14810 | } |
| 14811 | |
| 14812 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 14813 | |
| 14814 | /* Prepare outgoing frame*/ |
| 14815 | palZeroMemory( pMac->hHdd, pFrame, nBytes ); |
| 14816 | |
| 14817 | |
| 14818 | nSirStatus = csrRoamScanOffloadPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 14819 | SIR_MAC_MGMT_PROBE_REQ, bssId ,selfMacAddr); |
| 14820 | |
| 14821 | if ( eSIR_SUCCESS != nSirStatus ) |
| 14822 | { |
| 14823 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14824 | "Failed to populate the buffer descriptor for a Probe Request (%d).\n", |
| 14825 | nSirStatus ); |
| 14826 | return nSirStatus; |
| 14827 | } |
| 14828 | |
| 14829 | |
| 14830 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 14831 | sizeof( tSirMacMgmtHdr ), |
| 14832 | nPayload, &nPayload ); |
| 14833 | if ( DOT11F_FAILED( nStatus ) ) |
| 14834 | { |
| 14835 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14836 | "Failed to pack a Probe Request (0x%08x).\n", nStatus ); |
| 14837 | return eSIR_FAILURE; |
| 14838 | } |
| 14839 | else if ( DOT11F_WARNED( nStatus ) ) |
| 14840 | { |
| 14841 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14842 | "There were warnings while packing a Probe Request (0x%08x).\n" ); |
| 14843 | } |
| 14844 | |
| 14845 | *pusLen = nPayload + sizeof(tSirMacMgmtHdr); |
| 14846 | return eSIR_SUCCESS; |
| 14847 | } |
| 14848 | |
| 14849 | eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 command, tANI_U8 reason) |
| 14850 | { |
| 14851 | vos_msg_t msg; |
| 14852 | tSirRoamOffloadScanReq *pRequestBuf; |
| 14853 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 14854 | tCsrRoamSession *pSession; |
| 14855 | tANI_U8 i,num_channels = 0, ucDot11Mode; |
| 14856 | tANI_U8 *ChannelList = NULL; |
| 14857 | tANI_U32 sessionId; |
| 14858 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14859 | tpCsrChannelInfo currChannelListInfo; |
| 14860 | currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 14861 | |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 14862 | if (0 == csrRoamIsRoamOffloadScanEnabled(pMac)) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 14863 | { |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 14864 | smsLog( pMac, LOGE,"isRoamOffloadScanEnabled not set \n"); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 14865 | return eHAL_STATUS_FAILURE; |
| 14866 | } |
| 14867 | status = csrRoamGetSessionIdFromBSSID(pMac, |
| 14868 | (tCsrBssid *)pNeighborRoamInfo->currAPbssid, |
| 14869 | &sessionId); |
| 14870 | /*The Dynamic Config Items Update may happen even if the state is in INIT. |
| 14871 | * It is important to ensure that the command is passed down to the FW only |
| 14872 | * if the Infra Station is in a connected state.A connected station could also be |
| 14873 | * in a PREAUTH or REASSOC states.So, consider not sending the command down in INIT state. |
| 14874 | * We also have to ensure that if there is a STOP command we always have to inform Riva, |
| 14875 | * irrespective of whichever state we are in.*/ |
| 14876 | if ((pMac->roam.neighborRoamInfo.neighborRoamState == eCSR_NEIGHBOR_ROAM_STATE_INIT) && |
| 14877 | (command != ROAM_SCAN_OFFLOAD_STOP)) |
| 14878 | { |
| 14879 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Scan Command not sent to FW with state = %d and cmd = %d\n", |
| 14880 | pMac->roam.neighborRoamInfo.neighborRoamState, command); |
| 14881 | return eHAL_STATUS_FAILURE; |
| 14882 | } |
| 14883 | |
| 14884 | if ( !HAL_STATUS_SUCCESS( status ) ) |
| 14885 | { |
| 14886 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to find the sessionId for Roam Offload scan request", __func__); |
| 14887 | return eHAL_STATUS_FAILURE; |
| 14888 | } |
| 14889 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14890 | pRequestBuf = vos_mem_malloc(sizeof(tSirRoamOffloadScanReq)); |
| 14891 | if (NULL == pRequestBuf) |
| 14892 | { |
| 14893 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for Roam Offload scan request", __func__); |
| 14894 | return eHAL_STATUS_FAILED_ALLOC; |
| 14895 | } |
| 14896 | |
| 14897 | vos_mem_zero(pRequestBuf,sizeof(tSirRoamOffloadScanReq)); |
| 14898 | /* If command is STOP, then pass down ScanOffloadEnabled as Zero.This will handle the case of |
| 14899 | * host driver reloads, but Riva still up and running*/ |
| 14900 | if(command == ROAM_SCAN_OFFLOAD_STOP) |
| 14901 | pRequestBuf->RoamScanOffloadEnabled = 0; |
| 14902 | else |
| 14903 | pRequestBuf->RoamScanOffloadEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled; |
| 14904 | vos_mem_copy(pRequestBuf->ConnectedNetwork.currAPbssid, pNeighborRoamInfo->currAPbssid, |
| 14905 | sizeof(tCsrBssid)); |
| 14906 | pRequestBuf->ConnectedNetwork.ssId.length = |
| 14907 | pMac->roam.roamSession[sessionId].connectedProfile.SSID.length; |
| 14908 | vos_mem_copy(pRequestBuf->ConnectedNetwork.ssId.ssId, |
| 14909 | pMac->roam.roamSession[sessionId].connectedProfile.SSID.ssId, |
| 14910 | pRequestBuf->ConnectedNetwork.ssId.length); |
| 14911 | pRequestBuf->ConnectedNetwork.authentication = |
| 14912 | pMac->roam.roamSession[sessionId].connectedProfile.AuthType; |
| 14913 | pRequestBuf->ConnectedNetwork.encryption = |
| 14914 | pMac->roam.roamSession[sessionId].connectedProfile.EncryptionType; |
| 14915 | pRequestBuf->ConnectedNetwork.mcencryption = |
| 14916 | pMac->roam.roamSession[sessionId].connectedProfile.mcEncryptionType; |
| 14917 | pRequestBuf->LookupThreshold = |
| 14918 | (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1); |
| 14919 | pRequestBuf->RoamRssiDiff = |
| 14920 | pMac->roam.configParam.RoamRssiDiff; |
| 14921 | pRequestBuf->Command = command; |
| 14922 | pRequestBuf->StartScanReason = reason; |
| 14923 | pRequestBuf->NeighborScanTimerPeriod = |
| 14924 | pNeighborRoamInfo->cfgParams.neighborScanPeriod; |
| 14925 | pRequestBuf->NeighborRoamScanRefreshPeriod = |
| 14926 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod; |
| 14927 | pRequestBuf->NeighborScanChannelMinTime = |
| 14928 | pNeighborRoamInfo->cfgParams.minChannelScanTime; |
| 14929 | pRequestBuf->NeighborScanChannelMaxTime = |
| 14930 | pNeighborRoamInfo->cfgParams.maxChannelScanTime; |
| 14931 | pRequestBuf->EmptyRefreshScanPeriod = |
| 14932 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod; |
| 14933 | #ifdef FEATURE_WLAN_CCX |
| 14934 | pRequestBuf->IsCCXEnabled = pMac->roam.configParam.isCcxIniFeatureEnabled; |
| 14935 | #endif |
| 14936 | if ( |
| 14937 | #ifdef FEATURE_WLAN_CCX |
| 14938 | ((pNeighborRoamInfo->isCCXAssoc) && |
| 14939 | (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == |
| 14940 | eANI_BOOLEAN_FALSE)) || |
| 14941 | (pNeighborRoamInfo->isCCXAssoc == eANI_BOOLEAN_FALSE) || |
| 14942 | #endif // CCX |
| 14943 | currChannelListInfo->numOfChannels == 0) |
| 14944 | { |
| 14945 | |
| 14946 | /*Retreive the Channel Cache either from ini or from the Occupied Channels list. |
| 14947 | * Give Preference to INI Channels.*/ |
| 14948 | if (pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels) |
| 14949 | { |
| 14950 | ChannelList = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 14951 | for (i=0; i<pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels ;i++) |
| 14952 | { |
| 14953 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 14954 | { |
| 14955 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 14956 | } |
| 14957 | ChannelList++; |
| 14958 | } |
| 14959 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 14960 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_STATIC; |
| 14961 | } |
| 14962 | else{ |
| 14963 | ChannelList = pMac->scan.occupiedChannels.channelList; |
| 14964 | for(i=0; i<pMac->scan.occupiedChannels.numChannels; i++) |
| 14965 | { |
| 14966 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 14967 | { |
| 14968 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 14969 | } |
| 14970 | ChannelList++; |
| 14971 | } |
| 14972 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 14973 | /* If the profile changes as to what it was earlier, inform the FW through |
| 14974 | * FLUSH as ChannelCacheType in which case, the FW will flush the occupied channels |
| 14975 | * for the earlier profile and try to learn them afresh.*/ |
| 14976 | if (reason == REASON_FLUSH_CHANNEL_LIST) |
| 14977 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_FLUSH; |
| 14978 | else { |
| 14979 | if (csrNeighborRoamIsNewConnectedProfile(pMac)) |
| 14980 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_INIT; |
| 14981 | else |
| 14982 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE; |
| 14983 | } |
| 14984 | } |
| 14985 | } |
| 14986 | #ifdef FEATURE_WLAN_CCX |
| 14987 | else |
| 14988 | { |
| 14989 | /* If CCX is enabled, and a neighbor Report is received,then |
| 14990 | * Ignore the INI Channels or the Occupied Channel List. Consider |
| 14991 | * the channels in the neighbor list sent by the CCX AP.*/ |
| 14992 | if (currChannelListInfo->numOfChannels != 0) |
| 14993 | { |
| 14994 | ChannelList = currChannelListInfo->ChannelList; |
| 14995 | for (i=0;i<currChannelListInfo->numOfChannels;i++) |
| 14996 | { |
| 14997 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 14998 | { |
| 14999 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 15000 | } |
| 15001 | ChannelList++; |
| 15002 | } |
| 15003 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 15004 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_STATIC; |
| 15005 | } |
| 15006 | } |
| 15007 | #endif |
| 15008 | num_channels = 0; |
| 15009 | ChannelList = NULL; |
| 15010 | |
| 15011 | /* Maintain the Valid Channels List*/ |
| 15012 | if (0 == strncmp(pMac->scan.countryCodeCurrent, "KR", 2)) |
| 15013 | { |
| 15014 | ChannelList = pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.ChannelList; |
| 15015 | for(i=0; i<pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels; i++) |
| 15016 | { |
| 15017 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 15018 | { |
| 15019 | pRequestBuf->ValidChannelList[num_channels++] = *ChannelList; |
| 15020 | } |
| 15021 | ChannelList++; |
| 15022 | } |
| 15023 | pRequestBuf->ValidChannelCount = num_channels; |
| 15024 | } else { |
| 15025 | ChannelList = pMac->roam.validChannelList; |
| 15026 | for(i=0; i<pMac->roam.numValidChannels; i++) |
| 15027 | { |
| 15028 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 15029 | { |
| 15030 | pRequestBuf->ValidChannelList[num_channels++] = *ChannelList; |
| 15031 | } |
| 15032 | ChannelList++; |
| 15033 | } |
| 15034 | pRequestBuf->ValidChannelCount = num_channels; |
| 15035 | } |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 15036 | pRequestBuf->MDID.mdiePresent = |
| 15037 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent; |
| 15038 | pRequestBuf->MDID.mobilityDomain = |
| 15039 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mobilityDomain; |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 15040 | pRequestBuf->nProbes = pMac->roam.configParam.nProbes; |
| 15041 | |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 15042 | pRequestBuf->HomeAwayTime = pMac->roam.configParam.nRoamScanHomeAwayTime; |
Srinivas Girigowda | 6cf0b82 | 2013-06-27 14:00:20 -0700 | [diff] [blame] | 15043 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15044 | /*Prepare a probe request for 2.4GHz band and one for 5GHz band*/ |
| 15045 | ucDot11Mode = (tANI_U8) csrTranslateToWNICfgDot11Mode(pMac, |
| 15046 | csrFindBestPhyMode( pMac, pMac->roam.configParam.phyMode )); |
| 15047 | csrRoamScanOffloadPrepareProbeReqTemplate(pMac,SIR_ROAM_SCAN_24G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, |
| 15048 | pRequestBuf->p24GProbeTemplate, &pRequestBuf->us24GProbeTemplateLen); |
| 15049 | |
| 15050 | csrRoamScanOffloadPrepareProbeReqTemplate(pMac,SIR_ROAM_SCAN_5G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, |
| 15051 | pRequestBuf->p5GProbeTemplate, &pRequestBuf->us5GProbeTemplateLen); |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 15052 | msg.type = WDA_ROAM_SCAN_OFFLOAD_REQ; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15053 | msg.reserved = 0; |
| 15054 | msg.bodyptr = pRequestBuf; |
| 15055 | if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))) |
| 15056 | { |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 15057 | 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] | 15058 | vos_mem_free(pRequestBuf); |
| 15059 | return eHAL_STATUS_FAILURE; |
| 15060 | } |
| 15061 | |
| 15062 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Roam Scan Offload Command %d, Reason %d", command, reason); |
| 15063 | return status; |
| 15064 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 15065 | |
| 15066 | eHalStatus csrRoamOffloadScanRspHdlr(tpAniSirGlobal pMac, tANI_U8 reason) |
| 15067 | { |
| 15068 | switch(reason) |
| 15069 | { |
| 15070 | case 0: |
| 15071 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Rsp for Roam Scan Offload with failure status"); |
| 15072 | break; |
| 15073 | case REASON_OS_REQUESTED_ROAMING_NOW: |
| 15074 | csrNeighborRoamProceedWithHandoffReq(pMac); |
| 15075 | break; |
| 15076 | default: |
Tushnim Bhattacharyya | 5128d75 | 2013-06-26 23:23:18 -0700 | [diff] [blame] | 15077 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Rsp for Roam Scan Offload with reason %d", reason); |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 15078 | } |
| 15079 | return eHAL_STATUS_SUCCESS; |
| 15080 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15081 | #endif |
| 15082 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15083 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 15084 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId) |
| 15085 | { |
| 15086 | tANI_BOOLEAN found = FALSE; |
| 15087 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15088 | tCsrPeStatsReqInfo staEntry; |
| 15089 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
| 15090 | tListElem *pStaEntry = NULL; |
| 15091 | VOS_STATUS vosStatus; |
| 15092 | tPmcPowerState powerState; |
| 15093 | *pFound = FALSE; |
| 15094 | |
| 15095 | pStaEntry = csrRoamFindInPeStatsReqList(pMac, statsMask); |
| 15096 | if(pStaEntry) |
| 15097 | { |
| 15098 | pTempStaEntry = GET_BASE_ADDR( pStaEntry, tCsrPeStatsReqInfo, link ); |
| 15099 | if(pTempStaEntry->periodicity) |
| 15100 | { |
| 15101 | pTempStaEntry->periodicity = |
| 15102 | CSR_ROAM_MIN(periodicity, pTempStaEntry->periodicity); |
| 15103 | } |
| 15104 | else |
| 15105 | { |
| 15106 | pTempStaEntry->periodicity = periodicity; |
| 15107 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15108 | pTempStaEntry->numClient++; |
| 15109 | found = TRUE; |
| 15110 | } |
| 15111 | else |
| 15112 | { |
| 15113 | palZeroMemory(pMac->hHdd, &staEntry, sizeof(tCsrPeStatsReqInfo)); |
| 15114 | staEntry.numClient = 1; |
| 15115 | staEntry.periodicity = periodicity; |
| 15116 | staEntry.pMac = pMac; |
| 15117 | staEntry.rspPending = FALSE; |
| 15118 | staEntry.staId = staId; |
| 15119 | staEntry.statsMask = statsMask; |
| 15120 | staEntry.timerRunning = FALSE; |
| 15121 | pTempStaEntry = csrRoamInsertEntryIntoPeStatsReqList(pMac, &pMac->roam.peStatsReqList, &staEntry); |
| 15122 | if(!pTempStaEntry) |
| 15123 | { |
| 15124 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15125 | smsLog(pMac, LOGW, "csrRoamCheckPeStatsReqList: Failed to insert req in peStatsReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15126 | return NULL; |
| 15127 | } |
| 15128 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15129 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 15130 | if(ePMC_FULL_POWER == powerState) |
| 15131 | { |
| 15132 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 15133 | { |
| 15134 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 15135 | } |
| 15136 | } |
| 15137 | else |
| 15138 | { |
| 15139 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 15140 | { |
| 15141 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 15142 | } |
| 15143 | } |
| 15144 | if(!pTempStaEntry->timerRunning) |
| 15145 | { |
| 15146 | //send down a req in case of one time req, for periodic ones wait for timer to expire |
| 15147 | if(!pTempStaEntry->rspPending && |
| 15148 | !pTempStaEntry->periodicity) |
| 15149 | { |
| 15150 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 15151 | if(!HAL_STATUS_SUCCESS(status)) |
| 15152 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15153 | 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] | 15154 | } |
| 15155 | else |
| 15156 | { |
| 15157 | pTempStaEntry->rspPending = TRUE; |
| 15158 | } |
| 15159 | } |
| 15160 | if(pTempStaEntry->periodicity) |
| 15161 | { |
| 15162 | if(!found) |
| 15163 | { |
| 15164 | |
| 15165 | vosStatus = vos_timer_init( &pTempStaEntry->hPeStatsTimer, VOS_TIMER_TYPE_SW, |
| 15166 | csrRoamPeStatsTimerHandler, pTempStaEntry ); |
| 15167 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15168 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15169 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot init hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15170 | return NULL; |
| 15171 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15172 | } |
| 15173 | //start timer |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15174 | smsLog(pMac, LOG1, "csrRoamCheckPeStatsReqList:peStatsTimer period %d", pTempStaEntry->periodicity); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15175 | vosStatus = vos_timer_start( &pTempStaEntry->hPeStatsTimer, pTempStaEntry->periodicity ); |
| 15176 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15177 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15178 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15179 | return NULL; |
| 15180 | } |
| 15181 | pTempStaEntry->timerRunning = TRUE; |
| 15182 | } |
| 15183 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15184 | *pFound = found; |
| 15185 | return pTempStaEntry; |
| 15186 | } |
| 15187 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15188 | /* |
| 15189 | pStaEntry is no longer invalid upon the return of this function. |
| 15190 | */ |
| 15191 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry) |
| 15192 | { |
| 15193 | if(pEntry) |
| 15194 | { |
| 15195 | if(csrLLRemoveEntry(&pMac->roam.statsClientReqList, pEntry, LL_ACCESS_LOCK)) |
| 15196 | { |
| 15197 | palFreeMemory(pMac->hHdd, GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15198 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15199 | } |
| 15200 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15201 | |
| 15202 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry) |
| 15203 | { |
| 15204 | tListElem *pEntry; |
| 15205 | tCsrPeStatsReqInfo *pTempStaEntry; |
| 15206 | VOS_STATUS vosStatus; |
| 15207 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15208 | if(!pEntry) |
| 15209 | { |
| 15210 | //list empty |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15211 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: List empty, no stats req for PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15212 | return; |
| 15213 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15214 | while( pEntry ) |
| 15215 | { |
| 15216 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15217 | if( pTempStaEntry && pTempStaEntry->statsMask == pPeStaEntry->statsMask) |
| 15218 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15219 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15220 | if(pTempStaEntry->timerRunning) |
| 15221 | { |
| 15222 | vosStatus = vos_timer_stop( &pTempStaEntry->hPeStatsTimer ); |
| 15223 | /* If we are not able to stop the timer here, just remove |
| 15224 | * the entry from the linked list. Destroy the timer object |
| 15225 | * and free the memory in the timer CB |
| 15226 | */ |
| 15227 | if( vosStatus == VOS_STATUS_SUCCESS ) |
| 15228 | { |
| 15229 | /* the timer is successfully stopped */ |
| 15230 | pTempStaEntry->timerRunning = FALSE; |
| 15231 | |
| 15232 | /* Destroy the timer */ |
| 15233 | vosStatus = vos_timer_destroy( &pTempStaEntry->hPeStatsTimer ); |
| 15234 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15235 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15236 | smsLog(pMac, LOGE, FL("csrRoamRemoveEntryFromPeStatsReqList:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15237 | } |
| 15238 | } |
| 15239 | else |
| 15240 | { |
| 15241 | // the timer could not be stopped. Hence destroy and free the |
| 15242 | // memory for the PE stat entry in the timer CB. |
| 15243 | pTempStaEntry->timerStopFailed = TRUE; |
| 15244 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15245 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15246 | |
| 15247 | if(csrLLRemoveEntry(&pMac->roam.peStatsReqList, pEntry, LL_ACCESS_LOCK)) |
| 15248 | { |
| 15249 | // Only free the memory if we could stop the timer successfully |
| 15250 | if(!pTempStaEntry->timerStopFailed) |
| 15251 | { |
| 15252 | palFreeMemory(pMac->hHdd, pTempStaEntry); |
| 15253 | pTempStaEntry = NULL; |
| 15254 | } |
| 15255 | break; |
| 15256 | } |
| 15257 | |
| 15258 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 15259 | } |
| 15260 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15261 | return; |
| 15262 | } |
| 15263 | |
| 15264 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15265 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15266 | { |
| 15267 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15268 | pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = pTlStats->rxBcntCRCok; |
| 15269 | pMac->roam.classDStatsInfo.rx_bc_byte_cnt = pTlStats->rxBCBcnt; |
| 15270 | pMac->roam.classDStatsInfo.rx_bc_frm_cnt = pTlStats->rxBCFcnt; |
| 15271 | pMac->roam.classDStatsInfo.rx_byte_cnt = pTlStats->rxBcnt; |
| 15272 | pMac->roam.classDStatsInfo.rx_mc_byte_cnt = pTlStats->rxMCBcnt; |
| 15273 | pMac->roam.classDStatsInfo.rx_mc_frm_cnt = pTlStats->rxMCFcnt; |
| 15274 | pMac->roam.classDStatsInfo.rx_rate = pTlStats->rxRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15275 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15276 | pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = pTlStats->rxUCBcnt; |
| 15277 | pMac->roam.classDStatsInfo.rx_uc_frm_cnt = pTlStats->rxUCFcnt; |
| 15278 | pMac->roam.classDStatsInfo.tx_bc_byte_cnt = pTlStats->txBCBcnt; |
| 15279 | pMac->roam.classDStatsInfo.tx_bc_frm_cnt = pTlStats->txBCFcnt; |
| 15280 | pMac->roam.classDStatsInfo.tx_mc_byte_cnt = pTlStats->txMCBcnt; |
| 15281 | pMac->roam.classDStatsInfo.tx_mc_frm_cnt = pTlStats->txMCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15282 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15283 | pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = pTlStats->txUCBcnt; |
| 15284 | pMac->roam.classDStatsInfo.tx_uc_frm_cnt = pTlStats->txUCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15285 | |
| 15286 | } |
| 15287 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15288 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 15289 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext) |
| 15290 | { |
| 15291 | tANI_U8 stats[500]; |
| 15292 | tANI_U8 *pStats = NULL; |
| 15293 | tANI_U32 tempMask = 0; |
| 15294 | tANI_U8 counter = 0; |
| 15295 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15296 | if(!callback) |
| 15297 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15298 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report callback NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15299 | return; |
| 15300 | } |
| 15301 | if(!statsMask) |
| 15302 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15303 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report statsMask is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15304 | return; |
| 15305 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15306 | pStats = stats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15307 | tempMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15308 | while(tempMask) |
| 15309 | { |
| 15310 | if(tempMask & 1) |
| 15311 | { |
| 15312 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 15313 | switch(counter) |
| 15314 | { |
| 15315 | case eCsrSummaryStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15316 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15317 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 15318 | sizeof(tCsrSummaryStatsInfo)); |
| 15319 | if(!HAL_STATUS_SUCCESS(status)) |
| 15320 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15321 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15322 | } |
| 15323 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 15324 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15325 | case eCsrGlobalClassAStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15326 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15327 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 15328 | sizeof(tCsrGlobalClassAStatsInfo)); |
| 15329 | if(!HAL_STATUS_SUCCESS(status)) |
| 15330 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15331 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15332 | } |
| 15333 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15334 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15335 | case eCsrGlobalClassBStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15336 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15337 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 15338 | sizeof(tCsrGlobalClassBStatsInfo)); |
| 15339 | if(!HAL_STATUS_SUCCESS(status)) |
| 15340 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15341 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15342 | } |
| 15343 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15344 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15345 | case eCsrGlobalClassCStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15346 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15347 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 15348 | sizeof(tCsrGlobalClassCStatsInfo)); |
| 15349 | if(!HAL_STATUS_SUCCESS(status)) |
| 15350 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15351 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15352 | } |
| 15353 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15354 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15355 | case eCsrGlobalClassDStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15356 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassD stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15357 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classDStatsInfo, |
| 15358 | sizeof(tCsrGlobalClassDStatsInfo)); |
| 15359 | if(!HAL_STATUS_SUCCESS(status)) |
| 15360 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15361 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassD stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15362 | } |
| 15363 | pStats += sizeof(tCsrGlobalClassDStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15364 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15365 | case eCsrPerStaStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15366 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15367 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.perStaStatsInfo[staId], |
| 15368 | sizeof(tCsrPerStaStatsInfo)); |
| 15369 | if(!HAL_STATUS_SUCCESS(status)) |
| 15370 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15371 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15372 | } |
| 15373 | pStats += sizeof(tCsrPerStaStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15374 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15375 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15376 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:unknown stats type")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15377 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15378 | } |
| 15379 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15380 | tempMask >>=1; |
| 15381 | counter++; |
| 15382 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15383 | callback(stats, pContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15384 | } |
| 15385 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15386 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac) |
| 15387 | { |
| 15388 | tListElem *pEntry = NULL; |
| 15389 | tListElem *pPrevEntry = NULL; |
| 15390 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 15391 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15392 | VOS_STATUS vosStatus; |
| 15393 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15394 | if(!pEntry) |
| 15395 | { |
| 15396 | //list empty |
| 15397 | smsLog(pMac, LOGW, "csrRoamDeregStatisticsReq: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15398 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15399 | return status; |
| 15400 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15401 | while( pEntry ) |
| 15402 | { |
| 15403 | if(pPrevEntry) |
| 15404 | { |
| 15405 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 15406 | //send up the stats report |
| 15407 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 15408 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 15409 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 15410 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15411 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15412 | if (pTempStaEntry->pPeStaEntry) //pPeStaEntry can be NULL |
| 15413 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15414 | pTempStaEntry->pPeStaEntry->numClient--; |
| 15415 | //check if we need to delete the entry from peStatsReqList too |
| 15416 | if(!pTempStaEntry->pPeStaEntry->numClient) |
| 15417 | { |
| 15418 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry); |
| 15419 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15420 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15421 | //check if we need to stop the tl stats timer too |
| 15422 | pMac->roam.tlStatsReqInfo.numClient--; |
| 15423 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 15424 | { |
| 15425 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 15426 | { |
| 15427 | status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 15428 | if(!HAL_STATUS_SUCCESS(status)) |
| 15429 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15430 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15431 | //we will continue |
| 15432 | } |
| 15433 | } |
| 15434 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 15435 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 15436 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15437 | if (pTempStaEntry->periodicity) |
| 15438 | { |
| 15439 | //While creating StaEntry in csrGetStatistics, |
| 15440 | //Initializing and starting timer only when periodicity is set. |
| 15441 | //So Stop and Destroy timer only when periodicity is set. |
| 15442 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15443 | vos_timer_stop( &pTempStaEntry->timer ); |
| 15444 | // Destroy the vos timer... |
| 15445 | vosStatus = vos_timer_destroy( &pTempStaEntry->timer ); |
| 15446 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15447 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15448 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15449 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15450 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15452 | |
| 15453 | pPrevEntry = pEntry; |
| 15454 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 15455 | } |
| 15456 | //the last one |
| 15457 | if(pPrevEntry) |
| 15458 | { |
| 15459 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 15460 | //send up the stats report |
| 15461 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 15462 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 15463 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 15464 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15465 | return status; |
| 15466 | |
| 15467 | } |
| 15468 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15469 | eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 15470 | tRequestFullPowerReason *pReason, |
| 15471 | tANI_BOOLEAN *pfNeedPower ) |
| 15472 | { |
| 15473 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 15474 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
| 15475 | tPmcState pmcState; |
| 15476 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15477 | // TODO : Session info unavailable |
| 15478 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15479 | if( pfNeedPower ) |
| 15480 | { |
| 15481 | *pfNeedPower = eANI_BOOLEAN_FALSE; |
| 15482 | } |
| 15483 | //We only handle CSR commands |
| 15484 | if( !(eSmeCsrCommandMask & pCommand->command) ) |
| 15485 | { |
| 15486 | return eHAL_STATUS_SUCCESS; |
| 15487 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15488 | //Check PMC state first |
| 15489 | pmcState = pmcGetPmcState( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15490 | switch( pmcState ) |
| 15491 | { |
| 15492 | case REQUEST_IMPS: |
| 15493 | case IMPS: |
| 15494 | if( eSmeCommandScan == pCommand->command ) |
| 15495 | { |
| 15496 | switch( pCommand->u.scanCmd.reason ) |
| 15497 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15498 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 15499 | case eCsrScanGetLfrResult: |
| 15500 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15501 | case eCsrScanGetResult: |
| 15502 | case eCsrScanBGScanAbort: |
| 15503 | case eCsrScanBGScanEnable: |
| 15504 | case eCsrScanGetScanChnInfo: |
| 15505 | //Internal process, no need for full power |
| 15506 | fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 15507 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15508 | default: |
| 15509 | //Other scans are real scan, ask for power |
| 15510 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15511 | break; |
| 15512 | } //switch |
| 15513 | } |
| 15514 | else |
| 15515 | { |
| 15516 | //ask for power for roam and status change |
| 15517 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15518 | } |
| 15519 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15520 | case REQUEST_BMPS: |
| 15521 | case BMPS: |
| 15522 | case REQUEST_START_UAPSD: |
| 15523 | case UAPSD: |
| 15524 | //We treat WOWL same as BMPS |
| 15525 | case REQUEST_ENTER_WOWL: |
| 15526 | case WOWL: |
| 15527 | if( eSmeCommandRoam == pCommand->command ) |
| 15528 | { |
| 15529 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 15530 | tCsrScanResult *pScanResult; |
| 15531 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15532 | switch ( pCommand->u.roamCmd.roamReason ) |
| 15533 | { |
| 15534 | case eCsrForcedDisassoc: |
| 15535 | case eCsrForcedDisassocMICFailure: |
| 15536 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 15537 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15538 | break; |
| 15539 | case eCsrSmeIssuedDisassocForHandoff: |
| 15540 | case eCsrForcedDeauth: |
| 15541 | case eCsrHddIssuedReassocToSameAP: |
| 15542 | case eCsrSmeIssuedReassocToSameAP: |
| 15543 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15544 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15545 | case eCsrCapsChange: |
| 15546 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15547 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15548 | default: |
| 15549 | //Check whether the profile is already connected. If so, no need for full power |
| 15550 | //Note: IBSS is ignored for now because we don't support powersave in IBSS |
| 15551 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && pBSSList ) |
| 15552 | { |
| 15553 | //Only need to check the first one |
| 15554 | pEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 15555 | if( pEntry ) |
| 15556 | { |
| 15557 | pScanResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link); |
| 15558 | #if 0 |
| 15559 | // TODO : Session Specific info pConnectBssDesc |
| 15560 | if( csrIsBssIdEqual( pMac, &pScanResult->Result.BssDescriptor, pMac->roam.pConnectBssDesc ) && |
| 15561 | csrIsSsidEqual( pMac, pMac->roam.pConnectBssDesc, |
| 15562 | &pScanResult->Result.BssDescriptor, (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ) ) ) |
| 15563 | { |
| 15564 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 15565 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 15566 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 15567 | // a new Association. |
| 15568 | if(csrIsSameProfile(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 15569 | { |
| 15570 | if(csrRoamIsSameProfileKeys(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 15571 | { |
| 15572 | //Done, eventually, the command reaches eCsrReassocToSelfNoCapChange; |
| 15573 | //No need for full power |
| 15574 | //Set the flag so the code later can avoid to do the above |
| 15575 | //check again. |
| 15576 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_TRUE; |
| 15577 | break; |
| 15578 | } |
| 15579 | } |
| 15580 | } |
| 15581 | #endif |
| 15582 | } |
| 15583 | } |
| 15584 | //If we are here, full power is needed |
| 15585 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15586 | break; |
| 15587 | } |
| 15588 | } |
| 15589 | else if( eSmeCommandWmStatusChange == pCommand->command ) |
| 15590 | { |
| 15591 | //need full power for all |
| 15592 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15593 | reason = eSME_LINK_DISCONNECTED_BY_OTHER; |
| 15594 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15595 | #ifdef FEATURE_WLAN_TDLS |
| 15596 | else if( eSmeCommandTdlsAddPeer == pCommand->command ) |
| 15597 | { |
| 15598 | //TDLS link is getting established. need full power |
| 15599 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15600 | reason = eSME_FULL_PWR_NEEDED_BY_TDLS_PEER_SETUP; |
| 15601 | } |
| 15602 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15603 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15604 | case REQUEST_STOP_UAPSD: |
| 15605 | case REQUEST_EXIT_WOWL: |
| 15606 | if( eSmeCommandRoam == pCommand->command ) |
| 15607 | { |
| 15608 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 15609 | switch ( pCommand->u.roamCmd.roamReason ) |
| 15610 | { |
| 15611 | case eCsrForcedDisassoc: |
| 15612 | case eCsrForcedDisassocMICFailure: |
| 15613 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 15614 | break; |
| 15615 | default: |
| 15616 | break; |
| 15617 | } |
| 15618 | } |
| 15619 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15620 | case STOPPED: |
| 15621 | case REQUEST_STANDBY: |
| 15622 | case STANDBY: |
| 15623 | case LOW_POWER: |
| 15624 | //We are not supposed to do anything |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15625 | 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] | 15626 | status = eHAL_STATUS_FAILURE; |
| 15627 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15628 | case FULL_POWER: |
| 15629 | case REQUEST_FULL_POWER: |
| 15630 | default: |
| 15631 | //No need to ask for full power. This has to be FULL_POWER state |
| 15632 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15633 | } //switch |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15634 | if( pReason ) |
| 15635 | { |
| 15636 | *pReason = reason; |
| 15637 | } |
| 15638 | if( pfNeedPower ) |
| 15639 | { |
| 15640 | *pfNeedPower = fNeedFullPower; |
| 15641 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15642 | return ( status ); |
| 15643 | } |
| 15644 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15645 | static eHalStatus csrRequestFullPower( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 15646 | { |
| 15647 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15648 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 15649 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15650 | status = csrIsFullPowerNeeded( pMac, pCommand, &reason, &fNeedFullPower ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15651 | if( fNeedFullPower && HAL_STATUS_SUCCESS( status ) ) |
| 15652 | { |
| 15653 | status = pmcRequestFullPower(pMac, csrFullPowerCallback, pMac, reason); |
| 15654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15655 | return ( status ); |
| 15656 | } |
| 15657 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15658 | tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac ) |
| 15659 | { |
| 15660 | tSmeCmd *pCmd = smeGetCommandBuffer( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15661 | if( pCmd ) |
| 15662 | { |
| 15663 | pMac->roam.sPendingCommands++; |
| 15664 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15665 | return ( pCmd ); |
| 15666 | } |
| 15667 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15668 | void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 15669 | { |
| 15670 | if (pMac->roam.sPendingCommands > 0) |
| 15671 | { |
| 15672 | //All command allocated through csrGetCommandBuffer need to |
| 15673 | //decrement the pending count when releasing. |
| 15674 | pMac->roam.sPendingCommands--; |
| 15675 | smeReleaseCommand( pMac, pCommand ); |
| 15676 | } |
| 15677 | else |
| 15678 | { |
| 15679 | smsLog(pMac, LOGE, FL( "no pending commands")); |
| 15680 | VOS_ASSERT(0); |
| 15681 | } |
| 15682 | } |
| 15683 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15684 | //Return SUCCESS is the command is queued, failed |
| 15685 | eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority ) |
| 15686 | { |
| 15687 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15688 | if( (eSmeCommandScan == pCommand->command) && pMac->scan.fDropScanCmd ) |
| 15689 | { |
| 15690 | smsLog(pMac, LOGW, FL(" drop scan (scan reason %d) command"), |
| 15691 | pCommand->u.scanCmd.reason); |
| 15692 | return eHAL_STATUS_CSR_WRONG_STATE; |
| 15693 | } |
| 15694 | |
| 15695 | //We can call request full power first before putting the command into pending Q |
| 15696 | //because we are holding SME lock at this point. |
| 15697 | status = csrRequestFullPower( pMac, pCommand ); |
| 15698 | if( HAL_STATUS_SUCCESS( status ) ) |
| 15699 | { |
| 15700 | tANI_BOOLEAN fNoCmdPending; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15701 | //make sure roamCmdPendingList is not empty first |
| 15702 | fNoCmdPending = csrLLIsListEmpty( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_FALSE ); |
| 15703 | if( fNoCmdPending ) |
| 15704 | { |
| 15705 | smePushCommand( pMac, pCommand, fHighPriority ); |
| 15706 | } |
| 15707 | else |
| 15708 | { |
| 15709 | //Other commands are waiting for PMC callback, queue the new command to the pending Q |
| 15710 | //no list lock is needed since SME lock is held |
| 15711 | if( !fHighPriority ) |
| 15712 | { |
| 15713 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 15714 | } |
| 15715 | else { |
| 15716 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 15717 | } |
| 15718 | } |
| 15719 | } |
| 15720 | else if( eHAL_STATUS_PMC_PENDING == status ) |
| 15721 | { |
| 15722 | //no list lock is needed since SME lock is held |
| 15723 | if( !fHighPriority ) |
| 15724 | { |
| 15725 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 15726 | } |
| 15727 | else { |
| 15728 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 15729 | } |
| 15730 | //Let caller know the command is queue |
| 15731 | status = eHAL_STATUS_SUCCESS; |
| 15732 | } |
| 15733 | else |
| 15734 | { |
| 15735 | //Not to decrease pMac->roam.sPendingCommands here. Caller will decrease it when it |
| 15736 | //release the command. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15737 | smsLog( pMac, LOGE, FL( " cannot queue command %d" ), pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15738 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15739 | return ( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15740 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15741 | eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs* pAPWPSIES ) |
| 15742 | { |
| 15743 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15744 | tSirUpdateAPWPSIEsReq *pMsg; |
| 15745 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 15746 | |
| 15747 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15748 | if (NULL == pSession) |
| 15749 | { |
| 15750 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 15751 | return eHAL_STATUS_FAILURE; |
| 15752 | } |
| 15753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15754 | do |
| 15755 | { |
| 15756 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPSIEsReq) ); |
| 15757 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 15758 | palZeroMemory( pMac->hHdd, pMsg, sizeof(tSirUpdateAPWPSIEsReq) ); |
| 15759 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPDATE_APWPSIE_REQ); |
| 15760 | |
| 15761 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 15762 | VOS_ASSERT(pBuf); |
| 15763 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15764 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15765 | // transactionId |
| 15766 | *pBuf = 0; |
| 15767 | *( pBuf + 1 ) = 0; |
| 15768 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15769 | // bssId |
| 15770 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 15771 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15772 | //sessionId |
| 15773 | *pBuf++ = (tANI_U8)sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15774 | // APWPSIEs |
| 15775 | palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *)pBuf, pAPWPSIES, sizeof(tSirAPWPSIEs)); |
| 15776 | pBuf += sizeof(tSirAPWPSIEs); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15777 | 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] | 15778 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15779 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15780 | return ( status ); |
| 15781 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15782 | eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie) |
| 15783 | { |
| 15784 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15785 | tSirUpdateAPWPARSNIEsReq *pMsg; |
| 15786 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15787 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15788 | if (NULL == pSession) |
| 15789 | { |
| 15790 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 15791 | return eHAL_STATUS_FAILURE; |
| 15792 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15793 | do |
| 15794 | { |
| 15795 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPARSNIEsReq) ); |
| 15796 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 15797 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirUpdateAPWPARSNIEsReq ) ); |
| 15798 | 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] | 15799 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 15800 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15801 | // transactionId |
| 15802 | *pBuf = 0; |
| 15803 | *( pBuf + 1 ) = 0; |
| 15804 | pBuf += sizeof(tANI_U16); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 15805 | VOS_ASSERT(pBuf); |
| 15806 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15807 | // bssId |
| 15808 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 15809 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15810 | // sessionId |
| 15811 | *pBuf++ = (tANI_U8)sessionId; |
| 15812 | |
| 15813 | // APWPARSNIEs |
| 15814 | palCopyMemory( pMac->hHdd, (tSirRSNie *)pBuf, pAPSirRSNie, sizeof(tSirRSNie)); |
| 15815 | pBuf += sizeof(tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15816 | 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] | 15817 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15818 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15819 | return ( status ); |
| 15820 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15821 | |
| 15822 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 15823 | //eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tCsrBssid preAuthBssid, tANI_U8 channelId) |
| 15824 | eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription) |
| 15825 | { |
| 15826 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 15827 | tpSirFTPreAuthReq pftPreAuthReq; |
| 15828 | tANI_U16 auth_req_len = 0; |
| 15829 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15830 | auth_req_len = sizeof(tSirFTPreAuthReq); |
| 15831 | pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len); |
| 15832 | if (pftPreAuthReq == NULL) |
| 15833 | { |
| 15834 | smsLog(pMac, LOGE, FL("Memory allocation for FT Preauth request failed")); |
| 15835 | return eHAL_STATUS_RESOURCES; |
| 15836 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15837 | // Save the SME Session ID here. We need it while processing the preauth response |
| 15838 | pMac->ft.ftSmeContext.smeSessionId = sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15839 | vos_mem_zero(pftPreAuthReq, auth_req_len); |
| 15840 | |
| 15841 | pftPreAuthReq->pbssDescription = (tpSirBssDescription)vos_mem_malloc( |
| 15842 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 15843 | |
| 15844 | pftPreAuthReq->messageType = pal_cpu_to_be16(eWNI_SME_FT_PRE_AUTH_REQ); |
| 15845 | |
| 15846 | pftPreAuthReq->preAuthchannelNum = pBssDescription->channelId; |
| 15847 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15848 | palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->currbssId, (void *)pSession->connectedProfile.bssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15849 | palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->preAuthbssId, (void *)pBssDescription->bssId, sizeof(tSirMacAddr)); |
| 15850 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15851 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 15852 | if (csrRoamIs11rAssoc(pMac) && |
| 15853 | (pMac->roam.roamSession[sessionId].connectedProfile.AuthType != eCSR_AUTH_TYPE_OPEN_SYSTEM)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15854 | { |
| 15855 | pftPreAuthReq->ft_ies_length = (tANI_U16)pMac->ft.ftSmeContext.auth_ft_ies_length; |
| 15856 | palCopyMemory(pMac->hHdd, pftPreAuthReq->ft_ies, pMac->ft.ftSmeContext.auth_ft_ies, |
| 15857 | pMac->ft.ftSmeContext.auth_ft_ies_length); |
| 15858 | } |
| 15859 | else |
| 15860 | #endif |
| 15861 | { |
| 15862 | pftPreAuthReq->ft_ies_length = 0; |
| 15863 | } |
Madan Mohan Koyyalamudi | 613b0a4 | 2012-10-31 15:55:53 -0700 | [diff] [blame] | 15864 | vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription, |
| 15865 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 15866 | pftPreAuthReq->length = pal_cpu_to_be16(auth_req_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15867 | return palSendMBMessage(pMac->hHdd, pftPreAuthReq); |
| 15868 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15869 | /*-------------------------------------------------------------------------- |
| 15870 | * This will receive and process the FT Pre Auth Rsp from the current |
| 15871 | * associated ap. |
| 15872 | * |
| 15873 | * This will invoke the hdd call back. This is so that hdd can now |
| 15874 | * send the FTIEs from the Auth Rsp (Auth Seq 2) to the supplicant. |
| 15875 | ------------------------------------------------------------------------*/ |
| 15876 | void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp ) |
| 15877 | { |
| 15878 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 15879 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15880 | #ifdef FEATURE_WLAN_LFR |
| 15881 | tCsrRoamInfo roamInfo; |
| 15882 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15883 | |
| 15884 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 15885 | smsLog( pMac, LOGE, FL("Preauth response status code 0x%x"), pFTPreAuthRsp->status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15886 | #endif |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 15887 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 15888 | status = csrNeighborRoamPreauthRspHandler(pMac, pFTPreAuthRsp->status); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 15889 | if (status != eHAL_STATUS_SUCCESS) { |
| 15890 | /* |
| 15891 | * Bail out if pre-auth was not even processed. |
| 15892 | */ |
| 15893 | smsLog(pMac, LOGW, FL("Preauth was not processed: %d"), status); |
| 15894 | return; |
| 15895 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15896 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15897 | /* The below function calls/timers should be invoked only if the pre-auth is successful */ |
| 15898 | if (VOS_STATUS_SUCCESS != (VOS_STATUS)pFTPreAuthRsp->status) |
| 15899 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15900 | // Implies a success |
| 15901 | pMac->ft.ftSmeContext.FTState = eFT_AUTH_COMPLETE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15902 | // Indicate SME QoS module the completion of Preauth success. This will trigger the creation of RIC IEs |
| 15903 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = pFTPreAuthRsp; |
Tushnim Bhattacharyya | 8436d77 | 2013-06-26 23:03:29 -0700 | [diff] [blame] | 15904 | /* No need to notify qos module if this is a non 11r roam*/ |
| 15905 | if (csrRoamIs11rAssoc(pMac)) |
| 15906 | { |
| 15907 | sme_QosCsrEventInd(pMac, pMac->ft.ftSmeContext.smeSessionId, SME_QOS_CSR_PREAUTH_SUCCESS_IND, NULL); |
| 15908 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15909 | /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, |
| 15910 | * actual transition from the current to handoff AP is triggered */ |
| 15911 | status = palTimerStart(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer, |
| 15912 | 60 * PAL_TIMER_TO_MS_UNIT, |
| 15913 | eANI_BOOLEAN_FALSE); |
| 15914 | if (eHAL_STATUS_SUCCESS != status) |
| 15915 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15916 | 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] | 15917 | return; |
| 15918 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15919 | // Save the received response |
| 15920 | palCopyMemory(pMac->hHdd, (void *)&pMac->ft.ftSmeContext.preAuthbssId, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 15921 | if (csrRoamIs11rAssoc(pMac)) |
| 15922 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, NULL, 0, |
| 15923 | eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE); |
| 15924 | |
| 15925 | // Currently we dont do anything special for CCX connection. |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15926 | #ifdef FEATURE_WLAN_LFR |
| 15927 | // If Legacy Fast Roaming is enabled, signal the supplicant |
| 15928 | // 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] | 15929 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15930 | { |
| 15931 | // Save the bssid from the received response |
| 15932 | palCopyMemory(pMac->hHdd, (void *)&roamInfo.bssid, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 15933 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_PMK_NOTIFY, 0); |
| 15934 | } |
| 15935 | |
| 15936 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15937 | |
| 15938 | // Done with it, init it. |
| 15939 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL; |
| 15940 | } |
| 15941 | #endif |
| 15942 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 15943 | void csrRoamJoinRetryTimerHandler(void *pv) |
| 15944 | { |
| 15945 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 15946 | tpAniSirGlobal pMac = pInfo->pMac; |
| 15947 | tANI_U32 sessionId = pInfo->sessionId; |
| 15948 | tCsrRoamSession *pSession; |
| 15949 | |
| 15950 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 15951 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15952 | 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] | 15953 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15954 | if(pSession->pCurRoamProfile && csrIsConnStateDisconnected(pMac, sessionId)) |
| 15955 | { |
| 15956 | if( !HAL_STATUS_SUCCESS(csrRoamJoinLastProfile(pMac, sessionId)) ) |
| 15957 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15958 | smsLog( pMac, LOGE, FL( " fail to retry the last roam profile" ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15959 | } |
| 15960 | } |
| 15961 | } |
| 15962 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15963 | eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 15964 | { |
| 15965 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15966 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15967 | |
| 15968 | if(pSession->pCurRoamProfile && pSession->maxRetryCount) |
| 15969 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15970 | 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] | 15971 | pSession->maxRetryCount--; |
| 15972 | pSession->joinRetryTimerInfo.pMac = pMac; |
| 15973 | pSession->joinRetryTimerInfo.sessionId = (tANI_U8)sessionId; |
| 15974 | status = palTimerStart(pMac->hHdd, pSession->hTimerJoinRetry, interval, eANI_BOOLEAN_FALSE); |
| 15975 | if(!HAL_STATUS_SUCCESS(status)) |
| 15976 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15977 | smsLog(pMac, LOGE, FL(" fail to start timer status %s"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15978 | } |
| 15979 | } |
| 15980 | else |
| 15981 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15982 | 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] | 15983 | pSession->maxRetryCount); |
| 15984 | } |
| 15985 | |
| 15986 | return (status); |
| 15987 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15988 | eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 15989 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15990 | smsLog(pMac, LOGE, " csrRoamStopJoinRetryTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15991 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 15992 | { |
| 15993 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerJoinRetry)); |
| 15994 | } |
| 15995 | |
| 15996 | return eHAL_STATUS_SUCCESS; |
| 15997 | } |
| 15998 | #endif |
| 15999 | |
| 16000 | |
| 16001 | /* |
| 16002 | pBuf points to the beginning of the message |
| 16003 | LIM packs disassoc rsp as below, |
| 16004 | messageType - 2 bytes |
| 16005 | messageLength - 2 bytes |
| 16006 | sessionId - 1 byte |
| 16007 | transactionId - 2 bytes (tANI_U16) |
| 16008 | reasonCode - 4 bytes (sizeof(tSirResultCodes)) |
| 16009 | peerMacAddr - 6 bytes |
| 16010 | The rest is conditionally defined of (WNI_POLARIS_FW_PRODUCT == AP) and not used |
| 16011 | */ |
| 16012 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp) |
| 16013 | { |
| 16014 | if(pBuf && pRsp) |
| 16015 | { |
| 16016 | pBuf += 4; //skip type and length |
| 16017 | pRsp->sessionId = *pBuf++; |
| 16018 | pal_get_U16( pBuf, (tANI_U16 *)&pRsp->transactionId ); |
| 16019 | pBuf += 2; |
| 16020 | pal_get_U32( pBuf, (tANI_U32 *)&pRsp->statusCode ); |
| 16021 | pBuf += 4; |
| 16022 | vos_mem_copy(pRsp->peerMacAddr, pBuf, 6); |
| 16023 | } |
| 16024 | } |
| 16025 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 16026 | eHalStatus csrGetDefaultCountryCodeFrmNv(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 16027 | { |
| 16028 | static uNvTables nvTables; |
| 16029 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16030 | VOS_STATUS vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 16031 | |
| 16032 | /* read the country code from NV and use it */ |
| 16033 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 16034 | { |
| 16035 | palCopyMemory( pMac->hHdd, pCountry, |
| 16036 | nvTables.defaultCountryTable.countryCode, |
| 16037 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 16038 | return status; |
| 16039 | } |
| 16040 | else |
| 16041 | { |
| 16042 | palCopyMemory( pMac->hHdd, pCountry, |
| 16043 | "XXX", |
| 16044 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 16045 | status = eHAL_STATUS_FAILURE; |
| 16046 | return status; |
| 16047 | } |
| 16048 | } |
| 16049 | |
| 16050 | eHalStatus csrGetCurrentCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 16051 | { |
| 16052 | palCopyMemory( pMac->hHdd, pCountry, |
| 16053 | pMac->scan.countryCode11d, |
| 16054 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 16055 | return eHAL_STATUS_SUCCESS; |
| 16056 | } |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 16057 | |
| 16058 | eHalStatus csrSetTxPower(tpAniSirGlobal pMac, v_U8_t sessionId, v_U8_t mW) |
| 16059 | { |
| 16060 | tSirSetTxPowerReq *pMsg = NULL; |
| 16061 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16062 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 16063 | |
| 16064 | if (!pSession) |
| 16065 | { |
| 16066 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 16067 | return eHAL_STATUS_FAILURE; |
| 16068 | } |
| 16069 | |
| 16070 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tSirSetTxPowerReq)); |
| 16071 | if (HAL_STATUS_SUCCESS(status)) |
| 16072 | { |
| 16073 | palZeroMemory(pMac->hHdd, (void *)pMsg, sizeof(tSirSetTxPowerReq)); |
| 16074 | pMsg->messageType = eWNI_SME_SET_TX_POWER_REQ; |
| 16075 | pMsg->length = sizeof(tSirSetTxPowerReq); |
| 16076 | pMsg->mwPower = mW; |
| 16077 | palCopyMemory( pMac->hHdd, |
| 16078 | (tSirMacAddr *)pMsg->bssId, |
| 16079 | &pSession->selfMacAddr, |
| 16080 | sizeof(tSirMacAddr) ); |
| 16081 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 16082 | if (!HAL_STATUS_SUCCESS(status)) |
| 16083 | { |
| 16084 | 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] | 16085 | //pMsg is freed by palSendMBMessage |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 16086 | } |
| 16087 | } |
| 16088 | return status; |
| 16089 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16090 | |
| 16091 | /* Returns whether a session is in VOS_STA_MODE...or not */ |
| 16092 | tANI_BOOLEAN csrRoamIsStaMode(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 16093 | { |
| 16094 | tCsrRoamSession *pSession = NULL; |
| 16095 | pSession = CSR_GET_SESSION ( pMac, sessionId ); |
| 16096 | if(!pSession) |
| 16097 | { |
| 16098 | smsLog(pMac, LOGE, FL(" %s: session %d not found "), __func__, sessionId); |
| 16099 | return eANI_BOOLEAN_FALSE; |
| 16100 | } |
| 16101 | if ( !CSR_IS_SESSION_VALID ( pMac, sessionId ) ) |
| 16102 | { |
| 16103 | smsLog(pMac, LOGE, FL(" %s: Inactive session"), __func__); |
| 16104 | return eANI_BOOLEAN_FALSE; |
| 16105 | } |
| 16106 | if ( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 16107 | { |
| 16108 | return eANI_BOOLEAN_FALSE; |
| 16109 | } |
| 16110 | /* There is a possibility that the above check may fail,because |
| 16111 | * P2P CLI also uses the same BSSType (eCSR_BSS_TYPE_INFRASTRUCTURE) |
| 16112 | * when it is connected.So,we may sneak through the above check even |
| 16113 | * if we are not a STA mode INFRA station. So, if we sneak through |
| 16114 | * the above condition, we can use the following check if we are |
| 16115 | * really in STA Mode.*/ |
| 16116 | |
| 16117 | if ( NULL != pSession->pCurRoamProfile ) |
| 16118 | { |
| 16119 | if ( pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE ) |
| 16120 | { |
| 16121 | return eANI_BOOLEAN_TRUE; |
| 16122 | } else { |
| 16123 | smsLog(pMac, LOGE, FL(" %s: pCurRoamProfile is NULL\n"), __func__); |
| 16124 | return eANI_BOOLEAN_FALSE; |
| 16125 | } |
| 16126 | } |
| 16127 | |
| 16128 | return eANI_BOOLEAN_FALSE; |
| 16129 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 16130 | |
| 16131 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 16132 | eHalStatus csrHandoffRequest(tpAniSirGlobal pMac, |
| 16133 | tCsrHandoffRequest *pHandoffInfo) |
| 16134 | { |
| 16135 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16136 | vos_msg_t msg; |
| 16137 | |
| 16138 | tAniHandoffReq *pMsg; |
| 16139 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniHandoffReq)); |
| 16140 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 16141 | { |
| 16142 | smsLog(pMac, LOGE, " csrHandoffRequest: failed to allocate mem for req "); |
| 16143 | return status; |
| 16144 | } |
| 16145 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_HANDOFF_REQ); |
| 16146 | pMsg->msgLen = (tANI_U16)sizeof(tAniHandoffReq); |
| 16147 | pMsg->sessionId = pMac->roam.neighborRoamInfo.csrSessionId; |
| 16148 | pMsg->channel = pHandoffInfo->channel; |
| 16149 | palCopyMemory(pMac->hHdd, pMsg->bssid, |
| 16150 | pHandoffInfo->bssid, |
| 16151 | 6); |
| 16152 | msg.type = eWNI_SME_HANDOFF_REQ; |
| 16153 | msg.bodyptr = pMsg; |
| 16154 | msg.reserved = 0; |
| 16155 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 16156 | { |
| 16157 | smsLog(pMac, LOGE, " csrHandoffRequest failed to post msg to self "); |
| 16158 | palFreeMemory(pMac->hHdd, (void *)pMsg); |
| 16159 | status = eHAL_STATUS_FAILURE; |
| 16160 | } |
| 16161 | return status; |
| 16162 | } |
| 16163 | #endif /* WLAN_FEATURE_ROAM_SCAN_OFFLOAD */ |