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: |
| 153 | n = AUTH_WPA2_PSK; |
| 154 | break; |
| 155 | #ifdef FEATURE_WLAN_WAPI |
| 156 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 157 | n = AUTH_WAPI_CERT; |
| 158 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 159 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 160 | n = AUTH_WAPI_PSK; |
| 161 | break; |
| 162 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 163 | default: |
| 164 | break; |
| 165 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 166 | return (n); |
| 167 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 168 | int diagEncTypeFromCSRType(eCsrEncryptionType encType) |
| 169 | { |
| 170 | int n = ENC_MODE_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 171 | switch(encType) |
| 172 | { |
| 173 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 174 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 175 | n = ENC_MODE_WEP40; |
| 176 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 177 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 178 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 179 | n = ENC_MODE_WEP104; |
| 180 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 181 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 182 | n = ENC_MODE_TKIP; |
| 183 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 184 | case eCSR_ENCRYPT_TYPE_AES: |
| 185 | n = ENC_MODE_AES; |
| 186 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 187 | #ifdef FEATURE_WLAN_WAPI |
| 188 | case eCSR_ENCRYPT_TYPE_WPI: |
| 189 | n = ENC_MODE_SMS4; |
| 190 | break; |
| 191 | #endif /* FEATURE_WLAN_WAPI */ |
| 192 | default: |
| 193 | break; |
| 194 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 195 | return (n); |
| 196 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 197 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 198 | static const tANI_U8 csrStartIbssChannels50[ CSR_NUM_IBSS_START_CHANNELS_50 ] = { 36, 40, 44, 48}; |
| 199 | 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] | 200 | static void initConfigParam(tpAniSirGlobal pMac); |
| 201 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 202 | eCsrRoamCompleteResult Result, void *Context ); |
| 203 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 204 | tCsrRoamProfile *pProfile, |
| 205 | tANI_BOOLEAN *pfSameIbss ); |
| 206 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirSmeNewBssInfo *pNewBss ); |
| 207 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 208 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes); |
| 209 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 210 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac); |
| 211 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ); |
| 212 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac); |
| 213 | eHalStatus csrRoamClose(tpAniSirGlobal pMac); |
| 214 | void csrRoamMICErrorTimerHandler(void *pv); |
| 215 | void csrRoamTKIPCounterMeasureTimerHandler(void *pv); |
| 216 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2); |
| 217 | |
| 218 | static eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 219 | static eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 220 | static void csrRoamRoamingTimerHandler(void *pv); |
| 221 | eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 222 | eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 223 | static void csrRoamIbssJoinTimerHandler(void *pv); |
| 224 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval); |
| 225 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac); |
| 226 | static void csrRoamWaitForKeyTimeOutHandler(void *pv); |
| 227 | |
| 228 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 229 | static eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 230 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ); |
| 231 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 232 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 233 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 234 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 235 | tANI_U8 *pKeyRsc ); |
| 236 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 237 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, |
| 238 | tCsrRoamProfile *pProfile ); |
| 239 | void csrRoamStatisticsTimerHandler(void *pv); |
| 240 | void csrRoamStatsGlobalClassDTimerHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 241 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid); |
| 242 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 243 | v_U8_t rssiNotification, |
| 244 | void * context); |
| 245 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 246 | void csrRoamVccTrigger(tpAniSirGlobal pMac); |
| 247 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId); |
| 248 | /* |
| 249 | pStaEntry is no longer invalid upon the return of this function. |
| 250 | */ |
| 251 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 252 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile,tANI_U8 operationChn, eCsrBand *pBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 253 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 254 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 255 | tDblLinkList *pStaList, |
| 256 | tCsrStatsClientReqInfo *pStaEntry); |
| 257 | void csrRoamStatsClientTimerHandler(void *pv); |
| 258 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 259 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId); |
| 260 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 261 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 262 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 263 | void csrRoamTlStatsTimerHandler(void *pv); |
| 264 | void csrRoamPeStatsTimerHandler(void *pv); |
| 265 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 266 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry); |
| 267 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 268 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac); |
| 269 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ); |
| 270 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ); |
| 271 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ); |
| 272 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 273 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ); |
| 274 | //static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ); |
| 275 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
| 276 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac); |
| 277 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 278 | void csrRoamJoinRetryTimerHandler(void *pv); |
| 279 | #endif |
| 280 | extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 281 | extern void btampEstablishLogLinkHdlr(void* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 283 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 284 | |
| 285 | //Initialize global variables |
| 286 | static void csrRoamInitGlobals(tpAniSirGlobal pMac) |
| 287 | { |
| 288 | if(pMac) |
| 289 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 290 | vos_mem_zero(&csrRoamRoamSession, sizeof(csrRoamRoamSession)); |
| 291 | pMac->roam.roamSession = csrRoamRoamSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 292 | } |
| 293 | return; |
| 294 | } |
| 295 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 296 | static void csrRoamDeInitGlobals(tpAniSirGlobal pMac) |
| 297 | { |
| 298 | if(pMac) |
| 299 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 300 | pMac->roam.roamSession = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 301 | } |
| 302 | return; |
| 303 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 304 | eHalStatus csrOpen(tpAniSirGlobal pMac) |
| 305 | { |
| 306 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 307 | static uNvTables nvTables; |
| 308 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 309 | v_REGDOMAIN_t regId; |
| 310 | tANI_U32 i; |
| 311 | |
| 312 | do |
| 313 | { |
| 314 | /* Initialize CSR Roam Globals */ |
| 315 | csrRoamInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 316 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 317 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i); |
| 318 | |
| 319 | initConfigParam(pMac); |
| 320 | if(!HAL_STATUS_SUCCESS((status = csrScanOpen(pMac)))) |
| 321 | break; |
| 322 | if(!HAL_STATUS_SUCCESS((status = csrRoamOpen(pMac)))) |
| 323 | break; |
| 324 | pMac->roam.nextRoamId = 1; //Must not be 0 |
| 325 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.statsClientReqList))) |
| 326 | break; |
| 327 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.peStatsReqList))) |
| 328 | break; |
| 329 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.roamCmdPendingList))) |
| 330 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 331 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 332 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 333 | { |
| 334 | palCopyMemory( pMac->hHdd, pMac->scan.countryCodeDefault, |
| 335 | nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN ); |
| 336 | status = eHAL_STATUS_SUCCESS; |
| 337 | } |
| 338 | else |
| 339 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 340 | smsLog( pMac, LOGE, FL(" fail to get NV_FIELD_IMAGE") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 341 | //hardcoded for now |
| 342 | pMac->scan.countryCodeDefault[0] = 'U'; |
| 343 | pMac->scan.countryCodeDefault[1] = 'S'; |
| 344 | pMac->scan.countryCodeDefault[2] = 'I'; |
| 345 | //status = eHAL_STATUS_SUCCESS; |
| 346 | } |
Madan Mohan Koyyalamudi | 8b7f1e6 | 2012-10-05 14:56:51 -0700 | [diff] [blame] | 347 | smsLog( pMac, LOG1, FL(" country Code from nvRam %s"), pMac->scan.countryCodeDefault ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 348 | csrGetRegulatoryDomainForCountry(pMac, pMac->scan.countryCodeDefault, ®Id); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 349 | WDA_SetRegDomain(pMac, regId); |
| 350 | pMac->scan.domainIdDefault = regId; |
| 351 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 352 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 353 | pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN); |
| 354 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | }while(0); |
| 356 | |
| 357 | return (status); |
| 358 | } |
| 359 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 360 | eHalStatus csrSetRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode) |
| 361 | { |
| 362 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 363 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 364 | v_REGDOMAIN_t regId; |
| 365 | v_U8_t cntryCodeLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 366 | if(NULL == apCntryCode) |
| 367 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 368 | smsLog( pMac, LOGW, FL(" Invalid country Code Pointer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 369 | return eHAL_STATUS_FAILURE; |
| 370 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 371 | smsLog( pMac, LOGW, FL(" country Code %s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 372 | /* To get correct Regulatory domain from NV table |
| 373 | * 2 character Country code should be used |
| 374 | * 3rd charater is optional for indoor/outdoor setting */ |
| 375 | cntryCodeLength = strlen(apCntryCode); |
Madan Mohan Koyyalamudi | b666eb1 | 2012-09-18 17:29:47 -0700 | [diff] [blame] | 376 | |
| 377 | if (cntryCodeLength > WNI_CFG_COUNTRY_CODE_LEN) |
| 378 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 379 | smsLog( pMac, LOGW, FL(" Invalid Country Code Length") ); |
Madan Mohan Koyyalamudi | b666eb1 | 2012-09-18 17:29:47 -0700 | [diff] [blame] | 380 | return eHAL_STATUS_FAILURE; |
| 381 | } |
| 382 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 383 | status = csrGetRegulatoryDomainForCountry(pMac, apCntryCode, ®Id); |
| 384 | if (status != eHAL_STATUS_SUCCESS) |
| 385 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 386 | smsLog( pMac, LOGE, FL(" fail to get regId for country Code %s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 387 | return status; |
| 388 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 389 | status = WDA_SetRegDomain(hHal, regId); |
| 390 | if (status != eHAL_STATUS_SUCCESS) |
| 391 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 392 | smsLog( pMac, LOGE, FL(" fail to get regId for country Code %s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 393 | return status; |
| 394 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 395 | pMac->scan.domainIdDefault = regId; |
| 396 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 397 | /* Clear CC field */ |
| 398 | palFillMemory( pMac->hHdd, |
| 399 | pMac->scan.countryCodeDefault, |
| 400 | WNI_CFG_COUNTRY_CODE_LEN, |
| 401 | 0 ); |
| 402 | /* Copy 2 or 3 bytes country code */ |
| 403 | palCopyMemory( pMac->hHdd, pMac->scan.countryCodeDefault, |
| 404 | apCntryCode, cntryCodeLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 405 | /* If 2 bytes country code, 3rd byte must be filled with space */ |
| 406 | if((WNI_CFG_COUNTRY_CODE_LEN - 1) == cntryCodeLength) |
| 407 | { |
| 408 | palFillMemory( pMac->hHdd, |
| 409 | pMac->scan.countryCodeDefault + 2, |
| 410 | 1, |
| 411 | 0x20 ); |
| 412 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 413 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 414 | pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN); |
| 415 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 416 | return status; |
| 417 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 418 | eHalStatus csrSetChannels(tHalHandle hHal, tCsrConfigParam *pParam ) |
| 419 | { |
| 420 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 421 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 422 | tANI_U8 index = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 423 | palCopyMemory( pMac->hHdd, pParam->Csr11dinfo.countryCode, |
| 424 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 425 | for ( index = 0; index < pMac->scan.base20MHzChannels.numChannels ; index++) |
| 426 | { |
| 427 | pParam->Csr11dinfo.Channels.channelList[index] = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 428 | pParam->Csr11dinfo.ChnPower[index].firstChannel = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 429 | pParam->Csr11dinfo.ChnPower[index].numChannels = 1; |
| 430 | pParam->Csr11dinfo.ChnPower[index].maxtxPower = pMac->scan.defaultPowerTable[index].pwr; |
| 431 | } |
| 432 | pParam->Csr11dinfo.Channels.numChannels = pMac->scan.base20MHzChannels.numChannels; |
| 433 | |
| 434 | return status; |
| 435 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 436 | eHalStatus csrClose(tpAniSirGlobal pMac) |
| 437 | { |
| 438 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 440 | csrStop(pMac); |
| 441 | csrRoamClose(pMac); |
| 442 | csrScanClose(pMac); |
| 443 | csrLLClose(&pMac->roam.statsClientReqList); |
| 444 | csrLLClose(&pMac->roam.peStatsReqList); |
| 445 | csrLLClose(&pMac->roam.roamCmdPendingList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 446 | /* DeInit Globals */ |
| 447 | csrRoamDeInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 448 | return (status); |
| 449 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 450 | eHalStatus csrStart(tpAniSirGlobal pMac) |
| 451 | { |
| 452 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 453 | tANI_U32 i; |
| 454 | |
| 455 | do |
| 456 | { |
| 457 | //save the global vos context |
| 458 | pMac->roam.gVosContext = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 459 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 460 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, i ); |
| 461 | |
| 462 | status = csrRoamStart(pMac); |
| 463 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 464 | pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE; |
| 465 | status = pmcRegisterPowerSaveCheck(pMac, csrCheckPSReady, pMac); |
| 466 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 467 | pMac->roam.sPendingCommands = 0; |
| 468 | csrScanEnable(pMac); |
| 469 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 470 | status = csrNeighborRoamInit(pMac); |
| 471 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
| 472 | pMac->roam.tlStatsReqInfo.numClient = 0; |
| 473 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 474 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 475 | //init the link quality indication also |
| 476 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND; |
| 477 | if(!HAL_STATUS_SUCCESS(status)) |
| 478 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 479 | smsLog(pMac, LOGW, " csrStart: Couldn't Init HO control blk "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 480 | break; |
| 481 | } |
| 482 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 483 | #if defined(ANI_LOGDUMP) |
| 484 | csrDumpInit(pMac); |
| 485 | #endif //#if defined(ANI_LOGDUMP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 486 | return (status); |
| 487 | } |
| 488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 489 | eHalStatus csrStop(tpAniSirGlobal pMac) |
| 490 | { |
| 491 | tANI_U32 sessionId; |
| 492 | tANI_U32 i; |
| 493 | |
| 494 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 495 | { |
| 496 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 497 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 498 | csrScanDisable(pMac); |
| 499 | pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE; |
| 500 | pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 501 | csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE ); |
| 502 | |
| 503 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 504 | csrNeighborRoamClose(pMac); |
| 505 | #endif |
| 506 | csrScanFlushResult(pMac); //Do we want to do this? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 507 | // deregister from PMC since we register during csrStart() |
| 508 | // (ignore status since there is nothing we can do if it fails) |
| 509 | (void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 510 | //Reset the domain back to the deault |
| 511 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 512 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 513 | |
| 514 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 515 | { |
| 516 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP ,i ); |
| 517 | pMac->roam.curSubState[i] = eCSR_ROAM_SUBSTATE_NONE; |
| 518 | } |
| 519 | |
| 520 | return (eHAL_STATUS_SUCCESS); |
| 521 | } |
| 522 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 523 | eHalStatus csrReady(tpAniSirGlobal pMac) |
| 524 | { |
| 525 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 526 | csrScanGetSupportedChannels( pMac ); |
| 527 | //WNI_CFG_VALID_CHANNEL_LIST should be set by this time |
| 528 | //use it to init the background scan list |
| 529 | csrInitBGScanChannelList(pMac); |
| 530 | /* HDD issues the init scan */ |
| 531 | csrScanStartResultAgingTimer(pMac); |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 532 | /* If the gScanAgingTime is set to '0' then scan results aging timeout |
| 533 | based on timer feature is not enabled*/ |
| 534 | if(0 != pMac->scan.scanResultCfgAgingTime ) |
| 535 | { |
| 536 | csrScanStartResultCfgAgingTimer(pMac); |
| 537 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 538 | //Store the AC weights in TL for later use |
| 539 | WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 540 | status = csrInitChannelList( pMac ); |
| 541 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 542 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 543 | smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 544 | status ); |
| 545 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 546 | return (status); |
| 547 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 548 | void csrSetDefaultDot11Mode( tpAniSirGlobal pMac ) |
| 549 | { |
| 550 | v_U32_t wniDot11mode = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 551 | wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode); |
| 552 | ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE); |
| 553 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 554 | void csrSetGlobalCfgs( tpAniSirGlobal pMac ) |
| 555 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 557 | ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 558 | ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 559 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 560 | ((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled), |
| 561 | NULL, eANI_BOOLEAN_FALSE); |
| 562 | 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] | 563 | /* 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 |
| 564 | * Once session is established we will use the session related params stored in PE session for CB mode |
| 565 | */ |
| 566 | 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] | 567 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE); |
| 568 | |
| 569 | //Update the operating mode to configured value during initialization, |
| 570 | //So that client can advertise full capabilities in Probe request frame. |
| 571 | csrSetDefaultDot11Mode( pMac ); |
| 572 | } |
| 573 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 574 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac) |
| 575 | { |
| 576 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 577 | tANI_U32 i; |
| 578 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 579 | do |
| 580 | { |
| 581 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 582 | { |
| 583 | pSession = CSR_GET_SESSION( pMac, i ); |
| 584 | pSession->roamingTimerInfo.pMac = pMac; |
| 585 | pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 586 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 587 | pMac->roam.WaitForKeyTimerInfo.pMac = pMac; |
| 588 | pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 589 | status = palTimerAlloc(pMac->hHdd, &pMac->roam.hTimerWaitForKey, csrRoamWaitForKeyTimeOutHandler, |
| 590 | &pMac->roam.WaitForKeyTimerInfo); |
| 591 | if(!HAL_STATUS_SUCCESS(status)) |
| 592 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 593 | smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 594 | break; |
| 595 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 596 | status = palTimerAlloc(pMac->hHdd, &pMac->roam.tlStatsReqInfo.hTlStatsTimer, csrRoamTlStatsTimerHandler, pMac); |
| 597 | if(!HAL_STATUS_SUCCESS(status)) |
| 598 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 599 | smsLog(pMac, LOGE, FL("cannot allocate memory for summary Statistics timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 600 | return eHAL_STATUS_FAILURE; |
| 601 | } |
| 602 | }while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 603 | return (status); |
| 604 | } |
| 605 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 606 | eHalStatus csrRoamClose(tpAniSirGlobal pMac) |
| 607 | { |
| 608 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 609 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 610 | { |
| 611 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 612 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 613 | palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey); |
| 614 | palTimerFree(pMac->hHdd, pMac->roam.hTimerWaitForKey); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 615 | palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 616 | palTimerFree(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 617 | return (eHAL_STATUS_SUCCESS); |
| 618 | } |
| 619 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 620 | eHalStatus csrRoamStart(tpAniSirGlobal pMac) |
| 621 | { |
| 622 | (void)pMac; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 623 | return (eHAL_STATUS_SUCCESS); |
| 624 | } |
| 625 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 626 | void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 627 | { |
| 628 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 629 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 630 | csrRoamDeregStatisticsReq(pMac); |
| 631 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 632 | eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState) |
| 633 | { |
| 634 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Srinivas Girigowda | c84c57c | 2013-02-19 17:41:56 -0800 | [diff] [blame] | 635 | if ( CSR_IS_SESSION_VALID(pMac, sessionId) && (NULL != pState) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 636 | { |
| 637 | status = eHAL_STATUS_SUCCESS; |
| 638 | *pState = pMac->roam.roamSession[sessionId].connectState; |
| 639 | } |
| 640 | return (status); |
| 641 | } |
| 642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 643 | eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 644 | { |
| 645 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 646 | tANI_U32 size = 0; |
| 647 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 648 | |
| 649 | if(!pSession) |
| 650 | { |
| 651 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 652 | return eHAL_STATUS_FAILURE; |
| 653 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 654 | |
| 655 | if(pProfile) |
| 656 | { |
| 657 | if(pSession->pConnectBssDesc) |
| 658 | { |
| 659 | do |
| 660 | { |
| 661 | size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length); |
| 662 | if(size) |
| 663 | { |
| 664 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile->pBssDesc, size); |
| 665 | if(HAL_STATUS_SUCCESS(status)) |
| 666 | { |
| 667 | palCopyMemory(pMac->hHdd, pProfile->pBssDesc, pSession->pConnectBssDesc, size); |
| 668 | } |
| 669 | else |
| 670 | break; |
| 671 | } |
| 672 | else |
| 673 | { |
| 674 | pProfile->pBssDesc = NULL; |
| 675 | } |
| 676 | pProfile->AuthType = pSession->connectedProfile.AuthType; |
| 677 | pProfile->EncryptionType = pSession->connectedProfile.EncryptionType; |
| 678 | pProfile->mcEncryptionType = pSession->connectedProfile.mcEncryptionType; |
| 679 | pProfile->BSSType = pSession->connectedProfile.BSSType; |
| 680 | pProfile->operationChannel = pSession->connectedProfile.operationChannel; |
| 681 | pProfile->CBMode = pSession->connectedProfile.CBMode; |
| 682 | palCopyMemory(pMac->hHdd, &pProfile->bssid, &pSession->connectedProfile.bssid, sizeof(tCsrBssid)); |
| 683 | palCopyMemory(pMac->hHdd, &pProfile->SSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid)); |
| 684 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 685 | if (pSession->connectedProfile.MDID.mdiePresent) |
| 686 | { |
| 687 | pProfile->MDID.mdiePresent = 1; |
| 688 | pProfile->MDID.mobilityDomain = pSession->connectedProfile.MDID.mobilityDomain; |
| 689 | } |
| 690 | else |
| 691 | { |
| 692 | pProfile->MDID.mdiePresent = 0; |
| 693 | pProfile->MDID.mobilityDomain = 0; |
| 694 | } |
| 695 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 696 | #ifdef FEATURE_WLAN_CCX |
| 697 | pProfile->isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 698 | if (csrIsAuthTypeCCX(pSession->connectedProfile.AuthType)) |
| 699 | { |
| 700 | palCopyMemory( pMac->hHdd, pProfile->ccxCckmInfo.krk, |
| 701 | pSession->connectedProfile.ccxCckmInfo.krk, CSR_KRK_KEY_LEN ); |
| 702 | pProfile->ccxCckmInfo.reassoc_req_num= |
| 703 | pSession->connectedProfile.ccxCckmInfo.reassoc_req_num; |
| 704 | pProfile->ccxCckmInfo.krk_plumbed = |
| 705 | pSession->connectedProfile.ccxCckmInfo.krk_plumbed; |
| 706 | } |
| 707 | #endif |
| 708 | }while(0); |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | return (status); |
| 713 | } |
| 714 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 715 | eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 716 | { |
| 717 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 718 | |
| 719 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 720 | { |
| 721 | if(pProfile) |
| 722 | { |
| 723 | status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile); |
| 724 | } |
| 725 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 726 | return (status); |
| 727 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 728 | eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile) |
| 729 | { |
| 730 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 731 | |
| 732 | if(pProfile->pBssDesc) |
| 733 | { |
| 734 | palFreeMemory(pMac->hHdd, pProfile->pBssDesc); |
| 735 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 736 | if(pProfile->pAddIEAssoc) |
| 737 | { |
| 738 | palFreeMemory(pMac->hHdd, pProfile->pAddIEAssoc); |
| 739 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 740 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamConnectedProfile)); |
| 741 | pProfile->AuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 742 | return (status); |
| 743 | } |
| 744 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 745 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ) |
| 746 | { |
| 747 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 748 | if( pConnectedInfo->pbFrames ) |
| 749 | { |
| 750 | palFreeMemory( pMac->hHdd, pConnectedInfo->pbFrames ); |
| 751 | pConnectedInfo->pbFrames = NULL; |
| 752 | } |
| 753 | pConnectedInfo->nBeaconLength = 0; |
| 754 | pConnectedInfo->nAssocReqLength = 0; |
| 755 | pConnectedInfo->nAssocRspLength = 0; |
| 756 | pConnectedInfo->staId = 0; |
| 757 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 758 | pConnectedInfo->nRICRspLength = 0; |
| 759 | #endif |
| 760 | #ifdef FEATURE_WLAN_CCX |
| 761 | pConnectedInfo->nTspecIeLength = 0; |
| 762 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 763 | return ( status ); |
| 764 | } |
| 765 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 766 | |
| 767 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 768 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 769 | void csrReleaseCommandPreauth(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 770 | { |
| 771 | csrReinitPreauthCmd(pMac, pCommand); |
| 772 | csrReleaseCommand( pMac, pCommand ); |
| 773 | } |
| 774 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 775 | void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 776 | { |
| 777 | csrReinitRoamCmd(pMac, pCommand); |
| 778 | csrReleaseCommand( pMac, pCommand ); |
| 779 | } |
| 780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 781 | void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 782 | { |
| 783 | csrReinitScanCmd(pMac, pCommand); |
| 784 | csrReleaseCommand( pMac, pCommand ); |
| 785 | } |
| 786 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 787 | void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 788 | { |
| 789 | csrReinitWmStatusChangeCmd(pMac, pCommand); |
| 790 | csrReleaseCommand( pMac, pCommand ); |
| 791 | } |
| 792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 793 | void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 794 | { |
| 795 | palZeroMemory(pMac->hHdd, &pCommand->u.setKeyCmd, sizeof(tSetKeyCmd)); |
| 796 | } |
| 797 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 798 | void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 799 | { |
| 800 | palZeroMemory(pMac->hHdd, &pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd)); |
| 801 | } |
| 802 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 803 | void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 804 | { |
| 805 | csrReinitSetKeyCmd(pMac, pCommand); |
| 806 | csrReleaseCommand( pMac, pCommand ); |
| 807 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 808 | void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 809 | { |
| 810 | csrReinitRemoveKeyCmd(pMac, pCommand); |
| 811 | csrReleaseCommand( pMac, pCommand ); |
| 812 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping ) |
| 814 | { |
| 815 | |
| 816 | if( eSmeCsrCommandMask & pCommand->command ) |
| 817 | { |
| 818 | switch (pCommand->command) |
| 819 | { |
| 820 | case eSmeCommandScan: |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 821 | // We need to inform the requester before dropping the scan command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 822 | smsLog( pMac, LOGW, "%s: Drop scan reason %d callback 0x%X", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 823 | __func__, pCommand->u.scanCmd.reason, (unsigned int)pCommand->u.scanCmd.callback); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 824 | if (NULL != pCommand->u.scanCmd.callback) |
| 825 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 826 | smsLog( pMac, LOGW, "%s callback scan requester", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 827 | csrScanCallCallback(pMac, pCommand, eCSR_SCAN_ABORT); |
| 828 | } |
| 829 | csrReleaseCommandScan( pMac, pCommand ); |
| 830 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 831 | case eSmeCommandRoam: |
| 832 | csrReleaseCommandRoam( pMac, pCommand ); |
| 833 | break; |
| 834 | |
| 835 | case eSmeCommandWmStatusChange: |
| 836 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 837 | break; |
| 838 | |
| 839 | case eSmeCommandSetKey: |
| 840 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 841 | break; |
| 842 | |
| 843 | case eSmeCommandRemoveKey: |
| 844 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 845 | break; |
| 846 | |
| 847 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 848 | smsLog( pMac, LOGW, " CSR abort standard command %d", pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 849 | csrReleaseCommand( pMac, pCommand ); |
| 850 | break; |
| 851 | } |
| 852 | } |
| 853 | } |
| 854 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 855 | void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId) |
| 856 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 857 | smsLog( pMac, LOG1, " CSR RoamSubstate: [ %d <== %d ]", NewSubstate, pMac->roam.curSubState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 859 | if(pMac->roam.curSubState[sessionId] == NewSubstate) |
| 860 | { |
| 861 | return; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 862 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 863 | pMac->roam.curSubState[sessionId] = NewSubstate; |
| 864 | } |
| 865 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId) |
| 867 | { |
| 868 | eCsrRoamState PreviousState; |
| 869 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 870 | smsLog( pMac, LOG1, "CSR RoamState: [ %d <== %d ]", NewRoamState, pMac->roam.curState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 871 | |
| 872 | PreviousState = pMac->roam.curState[sessionId]; |
| 873 | |
| 874 | if ( NewRoamState != pMac->roam.curState[sessionId] ) |
| 875 | { |
| 876 | // Whenever we transition OUT of the Roaming state, clear the Roaming substate... |
| 877 | if ( CSR_IS_ROAM_JOINING(pMac, sessionId) ) |
| 878 | { |
| 879 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 880 | } |
| 881 | |
| 882 | pMac->roam.curState[sessionId] = NewRoamState; |
| 883 | } |
| 884 | return( PreviousState ); |
| 885 | } |
| 886 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 887 | void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset) |
| 888 | { |
| 889 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 890 | if(catOffset) |
| 891 | { |
| 892 | pMac->roam.configParam.bCatRssiOffset = catOffset; |
| 893 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 894 | { |
| 895 | pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)CSR_BEST_RSSI_VALUE - (int)(i * catOffset); |
| 896 | } |
| 897 | } |
| 898 | } |
| 899 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 900 | static void initConfigParam(tpAniSirGlobal pMac) |
| 901 | { |
| 902 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 903 | pMac->roam.configParam.agingCount = CSR_AGING_COUNT; |
| 904 | pMac->roam.configParam.channelBondingMode24GHz = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 905 | pMac->roam.configParam.channelBondingMode5GHz = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 906 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 907 | pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 908 | pMac->roam.configParam.eBand = eCSR_BAND_ALL; |
| 909 | pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 910 | pMac->roam.configParam.FragmentationThreshold = eCSR_DOT11_FRAG_THRESH_DEFAULT; |
| 911 | pMac->roam.configParam.HeartbeatThresh24 = 40; |
| 912 | pMac->roam.configParam.HeartbeatThresh50 = 40; |
| 913 | pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE; |
| 914 | pMac->roam.configParam.Is11dSupportEnabledOriginal = eANI_BOOLEAN_FALSE; |
| 915 | pMac->roam.configParam.Is11eSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 916 | pMac->roam.configParam.Is11hSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 917 | pMac->roam.configParam.RTSThreshold = 2346; |
| 918 | pMac->roam.configParam.shortSlotTime = eANI_BOOLEAN_TRUE; |
| 919 | pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto; |
| 920 | pMac->roam.configParam.ProprietaryRatesEnabled = eANI_BOOLEAN_TRUE; |
| 921 | pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO; |
| 922 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 923 | pMac->roam.configParam.scanAgeTimeNCNPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS; |
| 924 | pMac->roam.configParam.scanAgeTimeNCPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS; |
| 925 | pMac->roam.configParam.scanAgeTimeCNPS = CSR_SCAN_AGING_TIME_CONNECT_NO_PS; |
| 926 | pMac->roam.configParam.scanAgeTimeCPS = CSR_SCAN_AGING_TIME_CONNECT_W_PS; |
| 927 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 928 | { |
| 929 | pMac->roam.configParam.BssPreferValue[i] = i; |
| 930 | } |
| 931 | csrAssignRssiForCategory(pMac, CSR_DEFAULT_RSSI_DB_GAP); |
| 932 | pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME; |
| 933 | pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE; |
| 934 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 935 | pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE; |
| 936 | pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE; |
| 937 | pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; |
| 938 | pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; |
| 939 | pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME; |
| 940 | pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME; |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 941 | pMac->roam.configParam.nActiveMaxChnTimeBtc = CSR_ACTIVE_MAX_CHANNEL_TIME_BTC; |
| 942 | pMac->roam.configParam.nActiveMinChnTimeBtc = CSR_ACTIVE_MIN_CHANNEL_TIME_BTC; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 943 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 944 | pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC; |
| 945 | pMac->roam.configParam.nActiveMinChnTimeConc = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC; |
| 946 | pMac->roam.configParam.nPassiveMaxChnTimeConc = CSR_PASSIVE_MAX_CHANNEL_TIME_CONC; |
| 947 | pMac->roam.configParam.nPassiveMinChnTimeConc = CSR_PASSIVE_MIN_CHANNEL_TIME_CONC; |
| 948 | pMac->roam.configParam.nRestTimeConc = CSR_REST_TIME_CONC; |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 949 | pMac->roam.configParam.nNumChanCombinedConc = CSR_NUM_CHAN_COMBINED_CONC; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 950 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 951 | pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default |
| 952 | pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; |
| 953 | pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; |
| 954 | pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 955 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 956 | pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0; |
| 957 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 958 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 959 | pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3; |
| 960 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120; |
| 961 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = 125; |
| 962 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20; |
| 963 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40; |
| 964 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = 200; |
| 965 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels = 3; |
| 966 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[0] = 1; |
| 967 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[1] = 6; |
| 968 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11; |
| 969 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 970 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 971 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 972 | #ifdef WLAN_FEATURE_11AC |
| 973 | pMac->roam.configParam.nVhtChannelWidth = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1; |
| 974 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 975 | |
| 976 | pMac->roam.configParam.addTSWhenACMIsOff = 0; |
| 977 | pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE; |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 978 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 979 | //Remove this code once SLM_Sessionization is supported |
| 980 | //BMPS_WORKAROUND_NOT_NEEDED |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 981 | pMac->roam.configParam.doBMPSWorkaround = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 982 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 983 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 984 | eCsrBand csrGetCurrentBand(tHalHandle hHal) |
| 985 | { |
| 986 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 987 | return pMac->roam.configParam.bandCapability; |
| 988 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 989 | |
| 990 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 991 | tANI_BOOLEAN csrIsChannelInCountryValidList(tpAniSirGlobal pMac, tANI_U8 channel) |
| 992 | { |
| 993 | /* Get country code from CFG */ |
| 994 | tANI_U8 *pCountryCode = pMac->scan.countryCodeCurrent; |
| 995 | tANI_U8 i = 0; |
| 996 | v_BOOL_t retVal = FALSE; |
| 997 | tANI_U8 *pCountryValidChannelList = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList; |
| 998 | tANI_U8 *pNumChannels = &pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels; |
| 999 | |
| 1000 | /* Compare against KR valid list */ |
| 1001 | if ((0 == strncmp(pCountryCode, "KR", 2)) && |
| 1002 | (NULL != pCountryValidChannelList)) |
| 1003 | { |
| 1004 | for (i = 0; i <(*pNumChannels); i++) |
| 1005 | { |
| 1006 | if (channel == pCountryValidChannelList[i]) |
| 1007 | { |
| 1008 | retVal = TRUE; |
| 1009 | break; |
| 1010 | } |
| 1011 | } |
| 1012 | } |
| 1013 | else |
| 1014 | { |
| 1015 | retVal = csrRoamIsChannelValid(pMac, channel); |
| 1016 | } |
| 1017 | |
| 1018 | return retVal; |
| 1019 | } |
| 1020 | |
| 1021 | void csr_SetRevision(tpAniSirGlobal pMac, tANI_U8 revision) |
| 1022 | { |
| 1023 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1024 | pNeighborRoamInfo->cfgParams.countryChannelInfo.revision = revision; |
| 1025 | } |
| 1026 | |
| 1027 | /* |
| 1028 | This function flushes the roam scan cache and creates fresh cache |
| 1029 | based on the input channel list |
| 1030 | */ |
| 1031 | eHalStatus csrFlushAndCreateBgScanRoamChannelList(tpAniSirGlobal pMac, |
| 1032 | const tANI_U8 *pChannelList, |
| 1033 | const tANI_U8 numChannels) |
| 1034 | { |
| 1035 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1036 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1037 | |
| 1038 | /* Free up the memory first (if required) */ |
| 1039 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1040 | { |
| 1041 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 1042 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 1043 | } |
| 1044 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = numChannels; |
| 1045 | |
| 1046 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = |
| 1047 | vos_mem_malloc(pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
| 1048 | |
| 1049 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1050 | { |
| 1051 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 1052 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
| 1053 | return eHAL_STATUS_RESOURCES; |
| 1054 | } |
| 1055 | |
| 1056 | /* Update the roam global structure */ |
| 1057 | palCopyMemory(pMac->hHdd, pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
| 1058 | pChannelList, |
| 1059 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
| 1060 | return status; |
| 1061 | } |
| 1062 | |
| 1063 | /* This function modifies the bgscan channel list set via config ini or |
| 1064 | runtime, whenever the band changes. |
| 1065 | if the band is auto, then no operation is performed on the channel list |
| 1066 | if the band is 2.4G, then make sure channel list contains only 2.4G valid channels |
| 1067 | if the band is 5G, then make sure channel list contains only 5G valid channels |
| 1068 | */ |
| 1069 | eHalStatus csrUpdateBgScanConfigIniChannelList(tpAniSirGlobal pMac, |
| 1070 | eCsrBand eBand) |
| 1071 | { |
| 1072 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1073 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1074 | tANI_U8 outNumChannels = 0; |
| 1075 | tANI_U8 inNumChannels = 0; |
| 1076 | tANI_U8 *inPtr = NULL; |
| 1077 | tANI_U8 i = 0; |
| 1078 | tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1079 | |
| 1080 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1081 | |
| 1082 | { |
| 1083 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1084 | "No update required for channel list " |
| 1085 | "either cfg.ini channel list is not set up or " |
| 1086 | "auto band (Band %d)", eBand); |
| 1087 | return status; |
| 1088 | } |
| 1089 | |
| 1090 | inNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
| 1091 | inPtr = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 1092 | if (eCSR_BAND_24 == eBand) |
| 1093 | { |
| 1094 | for (i = 0; i < inNumChannels; i++) |
| 1095 | { |
| 1096 | if (CSR_IS_CHANNEL_24GHZ(inPtr[i]) && csrIsChannelInCountryValidList(pMac, inPtr[i])) |
| 1097 | { |
| 1098 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1099 | } |
| 1100 | } |
| 1101 | csrFlushAndCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
| 1102 | } |
| 1103 | else if (eCSR_BAND_5G == eBand) |
| 1104 | { |
| 1105 | for (i = 0; i < inNumChannels; i++) |
| 1106 | { |
| 1107 | /* Add 5G Non-DFS channel */ |
| 1108 | if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) && |
| 1109 | csrIsChannelInCountryValidList(pMac, inPtr[i]) && |
| 1110 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1111 | { |
| 1112 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1113 | } |
| 1114 | } |
| 1115 | csrFlushAndCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
| 1116 | } |
| 1117 | else if (eCSR_BAND_ALL == eBand) |
| 1118 | { |
| 1119 | for (i = 0; i < inNumChannels; i++) |
| 1120 | { |
| 1121 | if (csrIsChannelInCountryValidList(pMac, inPtr[i]) && |
| 1122 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1123 | { |
| 1124 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1125 | } |
| 1126 | } |
| 1127 | csrFlushAndCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
| 1128 | } |
| 1129 | else |
| 1130 | { |
| 1131 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 1132 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 1133 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 1134 | } |
| 1135 | |
| 1136 | return status; |
| 1137 | } |
| 1138 | |
| 1139 | /* |
| 1140 | This function initializes the valid channel list based on country code |
| 1141 | */ |
| 1142 | eHalStatus csrInitCountryValidChannelList(tpAniSirGlobal pMac, |
| 1143 | tANI_U8 Revision) |
| 1144 | { |
| 1145 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1146 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1147 | tANI_U8 *pOutChannelList = pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.ChannelList; |
| 1148 | tANI_U8 *pNumChannels = &pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels; |
| 1149 | const tANI_U8 *pChannelList = NULL; |
| 1150 | |
| 1151 | if (SME_KR_3 == Revision) |
| 1152 | { |
| 1153 | pChannelList = KR_3; |
| 1154 | *pNumChannels = sizeof(KR_3)/sizeof(KR_3[0]); |
| 1155 | } |
| 1156 | else if (SME_KR_24 == Revision) |
| 1157 | { |
| 1158 | pChannelList = KR_24; |
| 1159 | *pNumChannels = sizeof(KR_24)/sizeof(KR_24[0]); |
| 1160 | } |
| 1161 | else if (SME_KR_25 == Revision) |
| 1162 | { |
| 1163 | pChannelList = KR_25; |
| 1164 | *pNumChannels = sizeof(KR_25)/sizeof(KR_25[0]); |
| 1165 | } |
| 1166 | else |
| 1167 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1168 | |
| 1169 | /* Free up the memory first */ |
| 1170 | if (NULL != pOutChannelList) |
| 1171 | { |
| 1172 | vos_mem_free(pOutChannelList); |
| 1173 | pOutChannelList = NULL; |
| 1174 | } |
| 1175 | |
| 1176 | pOutChannelList = vos_mem_malloc(*pNumChannels); |
| 1177 | |
| 1178 | if (NULL == pOutChannelList) |
| 1179 | { |
| 1180 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 1181 | *pNumChannels = 0; |
| 1182 | return eHAL_STATUS_RESOURCES; |
| 1183 | } |
| 1184 | |
| 1185 | /* Update the roam global structure */ |
| 1186 | palCopyMemory(pMac->hHdd, pOutChannelList, pChannelList, *pNumChannels); |
| 1187 | return status; |
| 1188 | } |
| 1189 | |
| 1190 | #endif |
| 1191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1192 | eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand) |
| 1193 | { |
| 1194 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1195 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1196 | if (CSR_IS_PHY_MODE_A_ONLY(pMac) && |
| 1197 | (eBand == eCSR_BAND_24)) |
| 1198 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1199 | /* DOT11 mode configured to 11a only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1200 | request to change the band to 2.4 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1201 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1202 | "failed to set band cfg80211 = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1203 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1204 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1205 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1206 | if ((CSR_IS_PHY_MODE_B_ONLY(pMac) || |
| 1207 | CSR_IS_PHY_MODE_G_ONLY(pMac)) && |
| 1208 | (eBand == eCSR_BAND_5G)) |
| 1209 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1210 | /* DOT11 mode configured to 11b/11g only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1211 | request to change the band to 5 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1212 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1213 | "failed to set band dot11mode = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1214 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1215 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1216 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1217 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1218 | "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] | 1219 | pMac->roam.configParam.eBand = eBand; |
| 1220 | pMac->roam.configParam.bandCapability = eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1221 | csrScanGetSupportedChannels( pMac ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1222 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1223 | csrUpdateBgScanConfigIniChannelList( pMac, eBand ); |
| 1224 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1225 | status = csrInitGetChannels( pMac ); |
| 1226 | if (eHAL_STATUS_SUCCESS == status) |
| 1227 | csrInitChannelList( hHal ); |
| 1228 | return status; |
| 1229 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1230 | |
| 1231 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1232 | /* The funcns csrConvertCBIniValueToPhyCBState and csrConvertPhyCBStateToIniValue have been |
| 1233 | * introduced to convert the ini value to the ENUM used in csr and MAC for CB state |
| 1234 | * Ideally we should have kept the ini value and enum value same and representing the same |
| 1235 | * cb values as in 11n standard i.e. |
| 1236 | * Set to 1 (SCA) if the secondary channel is above the primary channel |
| 1237 | * Set to 3 (SCB) if the secondary channel is below the primary channel |
| 1238 | * Set to 0 (SCN) if no secondary channel is present |
| 1239 | * However, since our driver is already distributed we will keep the ini definition as it is which is: |
| 1240 | * 0 - secondary none |
| 1241 | * 1 - secondary LOW |
| 1242 | * 2 - secondary HIGH |
| 1243 | * and convert to enum value used within the driver in csrChangeDefaultConfigParam using this funcn |
| 1244 | * The enum values are as follows: |
| 1245 | * PHY_SINGLE_CHANNEL_CENTERED = 0 |
| 1246 | * PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1 |
| 1247 | * PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 1248 | */ |
| 1249 | ePhyChanBondState csrConvertCBIniValueToPhyCBState(v_U32_t cbIniValue) |
| 1250 | { |
| 1251 | |
| 1252 | ePhyChanBondState phyCbState; |
| 1253 | switch (cbIniValue) { |
| 1254 | // secondary none |
| 1255 | case 0: |
| 1256 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1257 | break; |
| 1258 | // secondary LOW |
| 1259 | case 1: |
| 1260 | phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 1261 | break; |
| 1262 | // secondary HIGH |
| 1263 | case 2: |
| 1264 | phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 1265 | break; |
| 1266 | #ifdef WLAN_FEATURE_11AC |
| 1267 | case 3: |
| 1268 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
| 1269 | break; |
| 1270 | case 4: |
| 1271 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1272 | break; |
| 1273 | case 5: |
| 1274 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1275 | break; |
| 1276 | case 6: |
| 1277 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
| 1278 | break; |
| 1279 | case 7: |
| 1280 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
| 1281 | break; |
| 1282 | case 8: |
| 1283 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 1284 | break; |
| 1285 | case 9: |
| 1286 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
| 1287 | break; |
| 1288 | #endif |
| 1289 | default: |
| 1290 | // If an invalid value is passed, disable CHANNEL BONDING |
| 1291 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1292 | break; |
| 1293 | } |
| 1294 | return phyCbState; |
| 1295 | } |
| 1296 | |
| 1297 | v_U32_t csrConvertPhyCBStateToIniValue(ePhyChanBondState phyCbState) |
| 1298 | { |
| 1299 | |
| 1300 | v_U32_t cbIniValue; |
| 1301 | switch (phyCbState) { |
| 1302 | // secondary none |
| 1303 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 1304 | cbIniValue = 0; |
| 1305 | break; |
| 1306 | // secondary LOW |
| 1307 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 1308 | cbIniValue = 1; |
| 1309 | break; |
| 1310 | // secondary HIGH |
| 1311 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 1312 | cbIniValue = 2; |
| 1313 | break; |
| 1314 | #ifdef WLAN_FEATURE_11AC |
| 1315 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 1316 | cbIniValue = 3; |
| 1317 | break; |
| 1318 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 1319 | cbIniValue = 4; |
| 1320 | break; |
| 1321 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 1322 | cbIniValue = 5; |
| 1323 | break; |
| 1324 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 1325 | cbIniValue = 6; |
| 1326 | break; |
| 1327 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 1328 | cbIniValue = 7; |
| 1329 | break; |
| 1330 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 1331 | cbIniValue = 8; |
| 1332 | break; |
| 1333 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 1334 | cbIniValue = 9; |
| 1335 | break; |
| 1336 | #endif |
| 1337 | default: |
| 1338 | // return some invalid value |
| 1339 | cbIniValue = 10; |
| 1340 | break; |
| 1341 | } |
| 1342 | return cbIniValue; |
| 1343 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1344 | |
| 1345 | eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1346 | { |
| 1347 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1348 | |
| 1349 | if(pParam) |
| 1350 | { |
| 1351 | pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode; |
| 1352 | pMac->roam.configParam.Is11eSupportEnabled = pParam->Is11eSupportEnabled; |
| 1353 | pMac->roam.configParam.FragmentationThreshold = pParam->FragmentationThreshold; |
| 1354 | pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled; |
| 1355 | pMac->roam.configParam.Is11dSupportEnabledOriginal = pParam->Is11dSupportEnabled; |
| 1356 | pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled; |
| 1357 | |
| 1358 | pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode; |
Mohit Khanna | 7ed53f0 | 2012-09-11 17:52:10 -0700 | [diff] [blame] | 1359 | pMac->roam.configParam.fAllowMCCGODiffBI = pParam->fAllowMCCGODiffBI; |
| 1360 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1361 | /* channelBondingMode5GHz plays a dual role right now |
| 1362 | * 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 |
| 1363 | * This is how channelBondingMode5GHz works now and this is kept intact to avoid any cfg.ini change |
| 1364 | */ |
| 1365 | if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI) |
| 1366 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1367 | 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] | 1368 | } |
| 1369 | pMac->roam.configParam.channelBondingMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode24GHz); |
| 1370 | if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI) |
| 1371 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1372 | 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] | 1373 | } |
| 1374 | pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1375 | pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold; |
| 1376 | pMac->roam.configParam.phyMode = pParam->phyMode; |
| 1377 | pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime; |
| 1378 | pMac->roam.configParam.HeartbeatThresh24 = pParam->HeartbeatThresh24; |
| 1379 | pMac->roam.configParam.HeartbeatThresh50 = pParam->HeartbeatThresh50; |
| 1380 | pMac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled; |
| 1381 | pMac->roam.configParam.TxRate = pParam->TxRate; |
| 1382 | pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; |
| 1383 | pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; |
| 1384 | pMac->roam.configParam.bandCapability = pParam->bandCapability; |
| 1385 | pMac->roam.configParam.cbChoice = pParam->cbChoice; |
| 1386 | pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1387 | //if HDD passed down non zero values then only update, |
| 1388 | //otherwise keep using the defaults |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1389 | if (pParam->nActiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1390 | { |
| 1391 | pMac->roam.configParam.nActiveMaxChnTime = pParam->nActiveMaxChnTime; |
| 1392 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1393 | if (pParam->nActiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1394 | { |
| 1395 | pMac->roam.configParam.nActiveMinChnTime = pParam->nActiveMinChnTime; |
| 1396 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1397 | if (pParam->nPassiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1398 | { |
| 1399 | pMac->roam.configParam.nPassiveMaxChnTime = pParam->nPassiveMaxChnTime; |
| 1400 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1401 | if (pParam->nPassiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1402 | { |
| 1403 | pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime; |
| 1404 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1405 | if (pParam->nActiveMaxChnTimeBtc) |
| 1406 | { |
| 1407 | pMac->roam.configParam.nActiveMaxChnTimeBtc = pParam->nActiveMaxChnTimeBtc; |
| 1408 | } |
| 1409 | if (pParam->nActiveMinChnTimeBtc) |
| 1410 | { |
| 1411 | pMac->roam.configParam.nActiveMinChnTimeBtc = pParam->nActiveMinChnTimeBtc; |
| 1412 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1413 | #ifdef WLAN_AP_STA_CONCURRENCY |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1414 | if (pParam->nActiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1415 | { |
| 1416 | pMac->roam.configParam.nActiveMaxChnTimeConc = pParam->nActiveMaxChnTimeConc; |
| 1417 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1418 | if (pParam->nActiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1419 | { |
| 1420 | pMac->roam.configParam.nActiveMinChnTimeConc = pParam->nActiveMinChnTimeConc; |
| 1421 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1422 | if (pParam->nPassiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1423 | { |
| 1424 | pMac->roam.configParam.nPassiveMaxChnTimeConc = pParam->nPassiveMaxChnTimeConc; |
| 1425 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1426 | if (pParam->nPassiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1427 | { |
| 1428 | pMac->roam.configParam.nPassiveMinChnTimeConc = pParam->nPassiveMinChnTimeConc; |
| 1429 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1430 | if (pParam->nRestTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1431 | { |
| 1432 | pMac->roam.configParam.nRestTimeConc = pParam->nRestTimeConc; |
| 1433 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1434 | if (pParam->nNumChanCombinedConc) |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1435 | { |
| 1436 | pMac->roam.configParam.nNumChanCombinedConc = pParam->nNumChanCombinedConc; |
| 1437 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1438 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1439 | //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] | 1440 | if (pParam->impsSleepTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1441 | { |
| 1442 | //Change the unit from second to microsecond |
| 1443 | tANI_U32 impsSleepTime = pParam->impsSleepTime * PAL_TIMER_TO_SEC_UNIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1444 | if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime) |
| 1445 | { |
| 1446 | pMac->roam.configParam.impsSleepTime = impsSleepTime; |
| 1447 | } |
| 1448 | else |
| 1449 | { |
| 1450 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 1451 | } |
| 1452 | } |
| 1453 | else |
| 1454 | { |
| 1455 | pMac->roam.configParam.impsSleepTime = 0; |
| 1456 | } |
| 1457 | pMac->roam.configParam.eBand = pParam->eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1458 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, pMac->roam.configParam.phyMode, |
| 1459 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1460 | //if HDD passed down non zero values for age params, then only update, |
| 1461 | //otherwise keep using the defaults |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1462 | if (pParam->nScanResultAgeCount) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1463 | { |
| 1464 | pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount; |
| 1465 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1466 | if(pParam->scanAgeTimeNCNPS) |
| 1467 | { |
| 1468 | pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS; |
| 1469 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1470 | if(pParam->scanAgeTimeNCPS) |
| 1471 | { |
| 1472 | pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS; |
| 1473 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1474 | if(pParam->scanAgeTimeCNPS) |
| 1475 | { |
| 1476 | pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS; |
| 1477 | } |
| 1478 | if(pParam->scanAgeTimeCPS) |
| 1479 | { |
| 1480 | pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS; |
| 1481 | } |
| 1482 | |
| 1483 | csrAssignRssiForCategory(pMac, pParam->bCatRssiOffset); |
| 1484 | pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime; |
| 1485 | pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels; |
| 1486 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority; |
| 1487 | pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch; |
| 1488 | pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1489 | pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold; |
| 1490 | pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1491 | pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled; |
| 1492 | pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity; |
| 1493 | pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS; |
| 1494 | //Assign this before calling CsrInit11dInfo |
| 1495 | pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1496 | if( csrIs11dSupported( pMac ) ) |
| 1497 | { |
| 1498 | status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo); |
| 1499 | } |
| 1500 | else |
| 1501 | { |
| 1502 | pMac->scan.curScanType = eSIR_ACTIVE_SCAN; |
| 1503 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1504 | |
| 1505 | /* Initialize the power + channel information if 11h is enabled. |
| 1506 | If 11d is enabled this information has already been initialized */ |
| 1507 | if( csrIs11hSupported( pMac ) && !csrIs11dSupported( pMac ) ) |
| 1508 | { |
| 1509 | csrInitChannelPowerList(pMac, &pParam->Csr11dinfo); |
| 1510 | } |
| 1511 | |
| 1512 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1513 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1514 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.csr11rConfig, &pParam->csr11rConfig, sizeof(tCsr11rConfigParams) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1515 | smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1516 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1517 | #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] | 1518 | pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1519 | pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1520 | pMac->roam.configParam.nImmediateRoamRssiDiff = pParam->nImmediateRoamRssiDiff; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1521 | smsLog( pMac, LOG1, "nImmediateRoamRssiDiff = %d", |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1522 | pMac->roam.configParam.nImmediateRoamRssiDiff ); |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 1523 | pMac->roam.configParam.nRoamPrefer5GHz = pParam->nRoamPrefer5GHz; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1524 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1525 | #ifdef FEATURE_WLAN_LFR |
| 1526 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled; |
| 1527 | #endif |
| 1528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1529 | #ifdef FEATURE_WLAN_CCX |
| 1530 | pMac->roam.configParam.isCcxIniFeatureEnabled = pParam->isCcxIniFeatureEnabled; |
| 1531 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1532 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1533 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.neighborRoamConfig, &pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1534 | smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod); |
| 1535 | smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold); |
| 1536 | smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold); |
| 1537 | smsLog( pMac, LOG1, "nNeighborScanMinChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime); |
| 1538 | smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime); |
| 1539 | smsLog( pMac, LOG1, "nMaxNeighborRetries = %d", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries); |
| 1540 | smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod); |
| 1541 | smsLog( pMac, LOG1, "nEmptyScanRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1542 | { |
| 1543 | int i; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1544 | 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] | 1545 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1546 | { |
| 1547 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1548 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1549 | smsLog( pMac, LOG1, ""); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1550 | } |
| 1551 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1552 | pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff; |
| 1553 | pMac->scan.fValidateList = pParam->fValidateList; |
| 1554 | pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d; |
| 1555 | pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan; |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 1556 | pMac->scan.scanResultCfgAgingTime = pParam->scanCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1557 | pMac->roam.configParam.fScanTwice = pParam->fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1558 | pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl; |
| 1559 | /* This parameter is not available in cfg and not passed from upper layers. Instead it is initialized here |
| 1560 | * This paramtere is used in concurrency to determine if there are concurrent active sessions. |
| 1561 | * Is used as a temporary fix to disconnect all active sessions when BMPS enabled so the active session if Infra STA |
| 1562 | * will automatically connect back and resume BMPS since resume BMPS is not working when moving from concurrent to |
| 1563 | * single session |
| 1564 | */ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1565 | //Remove this code once SLM_Sessionization is supported |
| 1566 | //BMPS_WORKAROUND_NOT_NEEDED |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1567 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 1568 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1569 | #ifdef WLAN_FEATURE_11AC |
| 1570 | pMac->roam.configParam.nVhtChannelWidth = pParam->nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1571 | pMac->roam.configParam.txBFEnable= pParam->enableTxBF; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1572 | pMac->roam.configParam.txBFCsnValue = pParam->txBFCsnValue; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1573 | #endif |
Madan Mohan Koyyalamudi | 3f65e31 | 2012-11-06 15:31:12 -0800 | [diff] [blame] | 1574 | pMac->scan.fIgnore_chan165 = pParam->fIgnore_chan165; |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1575 | pMac->roam.configParam.txLdpcEnable = pParam->enableTxLdpc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1576 | } |
| 1577 | |
| 1578 | return status; |
| 1579 | } |
| 1580 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1581 | eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1582 | { |
| 1583 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1584 | if(pParam) |
| 1585 | { |
| 1586 | pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode; |
| 1587 | pParam->Is11eSupportEnabled = pMac->roam.configParam.Is11eSupportEnabled; |
| 1588 | pParam->FragmentationThreshold = pMac->roam.configParam.FragmentationThreshold; |
| 1589 | pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled; |
| 1590 | pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 1591 | pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1592 | pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz); |
| 1593 | pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1594 | pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold; |
| 1595 | pParam->phyMode = pMac->roam.configParam.phyMode; |
| 1596 | pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 1597 | pParam->HeartbeatThresh24 = pMac->roam.configParam.HeartbeatThresh24; |
| 1598 | pParam->HeartbeatThresh50 = pMac->roam.configParam.HeartbeatThresh50; |
| 1599 | pParam->ProprietaryRatesEnabled = pMac->roam.configParam.ProprietaryRatesEnabled; |
| 1600 | pParam->TxRate = pMac->roam.configParam.TxRate; |
| 1601 | pParam->AdHocChannel24 = pMac->roam.configParam.AdHocChannel24; |
| 1602 | pParam->AdHocChannel5G = pMac->roam.configParam.AdHocChannel5G; |
| 1603 | pParam->bandCapability = pMac->roam.configParam.bandCapability; |
| 1604 | pParam->cbChoice = pMac->roam.configParam.cbChoice; |
| 1605 | pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1606 | pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime; |
| 1607 | pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime; |
| 1608 | pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; |
| 1609 | pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1610 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1611 | pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc; |
| 1612 | pParam->nActiveMinChnTimeConc = pMac->roam.configParam.nActiveMinChnTimeConc; |
| 1613 | pParam->nPassiveMaxChnTimeConc = pMac->roam.configParam.nPassiveMaxChnTimeConc; |
| 1614 | pParam->nPassiveMinChnTimeConc = pMac->roam.configParam.nPassiveMinChnTimeConc; |
| 1615 | pParam->nRestTimeConc = pMac->roam.configParam.nRestTimeConc; |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1616 | pParam->nNumChanCombinedConc = pMac->roam.configParam.nNumChanCombinedConc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1617 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1618 | //Change the unit from microsecond to second |
| 1619 | pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT; |
| 1620 | pParam->eBand = pMac->roam.configParam.eBand; |
| 1621 | pParam->nScanResultAgeCount = pMac->roam.configParam.agingCount; |
| 1622 | pParam->scanAgeTimeNCNPS = pMac->roam.configParam.scanAgeTimeNCNPS; |
| 1623 | pParam->scanAgeTimeNCPS = pMac->roam.configParam.scanAgeTimeNCPS; |
| 1624 | pParam->scanAgeTimeCNPS = pMac->roam.configParam.scanAgeTimeCNPS; |
| 1625 | pParam->scanAgeTimeCPS = pMac->roam.configParam.scanAgeTimeCPS; |
| 1626 | pParam->bCatRssiOffset = pMac->roam.configParam.bCatRssiOffset; |
| 1627 | pParam->nRoamingTime = pMac->roam.configParam.nRoamingTime; |
| 1628 | pParam->fEnforce11dChannels = pMac->roam.configParam.fEnforce11dChannels; |
| 1629 | pParam->fSupplicantCountryCodeHasPriority = pMac->roam.configParam.fSupplicantCountryCodeHasPriority; |
| 1630 | pParam->fEnforceCountryCodeMatch = pMac->roam.configParam.fEnforceCountryCodeMatch; |
| 1631 | pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain; |
| 1632 | pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold; |
| 1633 | pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1634 | pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled; |
| 1635 | pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap; |
| 1636 | pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 1637 | pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1638 | pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff; |
| 1639 | pParam->fValidateList = pMac->roam.configParam.fValidateList; |
| 1640 | pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d; |
| 1641 | pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan; |
Madan Mohan Koyyalamudi | 3f65e31 | 2012-11-06 15:31:12 -0800 | [diff] [blame] | 1642 | pParam->fIgnore_chan165= pMac->scan.fIgnore_chan165; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1643 | pParam->fScanTwice = pMac->roam.configParam.fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1644 | pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl; |
Madan Mohan Koyyalamudi | ed41951 | 2012-11-29 15:53:46 -0800 | [diff] [blame] | 1645 | pParam->fEnableMCCMode = pMac->roam.configParam.fenableMCCMode; |
Madan Mohan Koyyalamudi | 057bd80 | 2012-11-29 16:02:39 -0800 | [diff] [blame] | 1646 | pParam->fAllowMCCGODiffBI = pMac->roam.configParam.fAllowMCCGODiffBI; |
Sunil Ravi | 39b2e53 | 2013-01-20 23:45:53 -0800 | [diff] [blame] | 1647 | pParam->scanCfgAgingTime = pMac->scan.scanResultCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1648 | |
| 1649 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1650 | palCopyMemory( pMac->hHdd, &pParam->neighborRoamConfig, &pMac->roam.configParam.neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
| 1651 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1652 | #ifdef WLAN_FEATURE_11AC |
| 1653 | pParam->nVhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1654 | pParam->enableTxBF = pMac->roam.configParam.txBFEnable; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1655 | pParam->txBFCsnValue = pMac->roam.configParam.txBFCsnValue; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1656 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1657 | |
| 1658 | csrSetChannels(pMac, pParam); |
| 1659 | |
| 1660 | status = eHAL_STATUS_SUCCESS; |
| 1661 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1662 | return (status); |
| 1663 | } |
| 1664 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1665 | eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded) |
| 1666 | { |
| 1667 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 1668 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1669 | tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE; |
| 1670 | eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1671 | do |
| 1672 | { |
| 1673 | if(eCSR_BAND_24 == eBand) |
| 1674 | { |
| 1675 | if(CSR_IS_RADIO_A_ONLY(pMac)) break; |
| 1676 | if((eCSR_DOT11_MODE_11a & phyMode) || (eCSR_DOT11_MODE_11a_ONLY & phyMode)) break; |
| 1677 | } |
| 1678 | if(eCSR_BAND_5G == eBand) |
| 1679 | { |
| 1680 | if(CSR_IS_RADIO_BG_ONLY(pMac)) break; |
| 1681 | if((eCSR_DOT11_MODE_11b & phyMode) || (eCSR_DOT11_MODE_11b_ONLY & phyMode) || |
| 1682 | (eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1683 | ) |
| 1684 | { |
| 1685 | break; |
| 1686 | } |
| 1687 | } |
| 1688 | if((0 == phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode)) |
| 1689 | { |
| 1690 | newPhyMode = eCSR_DOT11_MODE_TAURUS; |
| 1691 | } |
| 1692 | else if(eCSR_DOT11_MODE_AUTO & phyMode) |
| 1693 | { |
| 1694 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1695 | } |
| 1696 | else |
| 1697 | { |
| 1698 | //Check for dual band and higher capability first |
| 1699 | if(eCSR_DOT11_MODE_11n_ONLY & phyMode) |
| 1700 | { |
| 1701 | if(eCSR_DOT11_MODE_11n_ONLY != phyMode) break; |
| 1702 | newPhyMode = eCSR_DOT11_MODE_11n_ONLY; |
| 1703 | } |
| 1704 | else if(eCSR_DOT11_MODE_11a_ONLY & phyMode) |
| 1705 | { |
| 1706 | if(eCSR_DOT11_MODE_11a_ONLY != phyMode) break; |
| 1707 | if(eCSR_BAND_24 == eBand) break; |
| 1708 | newPhyMode = eCSR_DOT11_MODE_11a_ONLY; |
| 1709 | eBand = eCSR_BAND_5G; |
| 1710 | } |
| 1711 | else if(eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1712 | { |
| 1713 | if(eCSR_DOT11_MODE_11g_ONLY != phyMode) break; |
| 1714 | if(eCSR_BAND_5G == eBand) break; |
| 1715 | newPhyMode = eCSR_DOT11_MODE_11g_ONLY; |
| 1716 | eBand = eCSR_BAND_24; |
| 1717 | } |
| 1718 | else if(eCSR_DOT11_MODE_11b_ONLY & phyMode) |
| 1719 | { |
| 1720 | if(eCSR_DOT11_MODE_11b_ONLY != phyMode) break; |
| 1721 | if(eCSR_BAND_5G == eBand) break; |
| 1722 | newPhyMode = eCSR_DOT11_MODE_11b_ONLY; |
| 1723 | eBand = eCSR_BAND_24; |
| 1724 | } |
| 1725 | else if(eCSR_DOT11_MODE_11n & phyMode) |
| 1726 | { |
| 1727 | newPhyMode = eCSR_DOT11_MODE_11n; |
| 1728 | } |
| 1729 | else if(eCSR_DOT11_MODE_abg & phyMode) |
| 1730 | { |
| 1731 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1732 | } |
| 1733 | else if(eCSR_DOT11_MODE_11a & phyMode) |
| 1734 | { |
| 1735 | if((eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11b & phyMode)) |
| 1736 | { |
| 1737 | if(eCSR_BAND_ALL == eBand) |
| 1738 | { |
| 1739 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1740 | } |
| 1741 | else |
| 1742 | { |
| 1743 | //bad setting |
| 1744 | break; |
| 1745 | } |
| 1746 | } |
| 1747 | else |
| 1748 | { |
| 1749 | newPhyMode = eCSR_DOT11_MODE_11a; |
| 1750 | eBand = eCSR_BAND_5G; |
| 1751 | } |
| 1752 | } |
| 1753 | else if(eCSR_DOT11_MODE_11g & phyMode) |
| 1754 | { |
| 1755 | newPhyMode = eCSR_DOT11_MODE_11g; |
| 1756 | eBand = eCSR_BAND_24; |
| 1757 | } |
| 1758 | else if(eCSR_DOT11_MODE_11b & phyMode) |
| 1759 | { |
| 1760 | newPhyMode = eCSR_DOT11_MODE_11b; |
| 1761 | eBand = eCSR_BAND_24; |
| 1762 | } |
| 1763 | else |
| 1764 | { |
| 1765 | //We will never be here |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1766 | smsLog( pMac, LOGE, FL(" cannot recognize the phy mode 0x%08X"), phyMode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1767 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1768 | } |
| 1769 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1770 | //Done validating |
| 1771 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1772 | //Now we need to check whether a restart is needed. |
| 1773 | if(eBand != pMac->roam.configParam.eBand) |
| 1774 | { |
| 1775 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1776 | break; |
| 1777 | } |
| 1778 | if(newPhyMode != pMac->roam.configParam.phyMode) |
| 1779 | { |
| 1780 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1781 | break; |
| 1782 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1783 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1784 | if(HAL_STATUS_SUCCESS(status)) |
| 1785 | { |
| 1786 | pMac->roam.configParam.eBand = eBand; |
| 1787 | pMac->roam.configParam.phyMode = newPhyMode; |
| 1788 | if(pfRestartNeeded) |
| 1789 | { |
| 1790 | *pfRestartNeeded = fRestartNeeded; |
| 1791 | } |
| 1792 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1793 | return (status); |
| 1794 | } |
| 1795 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1796 | void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList ) |
| 1797 | { |
| 1798 | tANI_U8 Index; |
| 1799 | tANI_U8 cChannels; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1800 | // for dual band NICs, don't need to trim the channel list.... |
| 1801 | if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) ) |
| 1802 | { |
| 1803 | // 2.4 GHz band operation requires the channel list to be trimmed to |
| 1804 | // the 2.4 GHz channels only... |
| 1805 | if ( CSR_IS_24_BAND_ONLY( pMac ) ) |
| 1806 | { |
| 1807 | for( Index = 0, cChannels = 0; Index < pChannelList->numChannels; |
| 1808 | Index++ ) |
| 1809 | { |
| 1810 | if ( CSR_IS_CHANNEL_24GHZ(pChannelList->channelList[ Index ]) ) |
| 1811 | { |
| 1812 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 1813 | cChannels++; |
| 1814 | } |
| 1815 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1816 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 1817 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 1818 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 1819 | // only if we need to. |
| 1820 | // |
| 1821 | // The amount of memory to clear is the number of channesl that we trimmed |
| 1822 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 1823 | |
| 1824 | if ( pChannelList->numChannels > cChannels ) |
| 1825 | { |
| 1826 | palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ], |
| 1827 | sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) ); |
| 1828 | |
| 1829 | } |
| 1830 | |
| 1831 | pChannelList->numChannels = cChannels; |
| 1832 | } |
| 1833 | else if ( CSR_IS_5G_BAND_ONLY( pMac ) ) |
| 1834 | { |
| 1835 | for ( Index = 0, cChannels = 0; Index < pChannelList->numChannels; Index++ ) |
| 1836 | { |
| 1837 | if ( CSR_IS_CHANNEL_5GHZ(pChannelList->channelList[ Index ]) ) |
| 1838 | { |
| 1839 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 1840 | cChannels++; |
| 1841 | } |
| 1842 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1843 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 1844 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 1845 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 1846 | // only if we need to. |
| 1847 | // |
| 1848 | // The amount of memory to clear is the number of channesl that we trimmed |
| 1849 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 1850 | if ( pChannelList->numChannels > cChannels ) |
| 1851 | { |
| 1852 | palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ], |
| 1853 | sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) ); |
| 1854 | } |
| 1855 | |
| 1856 | pChannelList->numChannels = cChannels; |
| 1857 | } |
| 1858 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1859 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1860 | #define INFRA_AP_DEFAULT_CHANNEL 6 |
| 1861 | eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum) |
| 1862 | { |
| 1863 | tANI_U8 index= 0; |
| 1864 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1865 | for (index=0; index < pMac->scan.base20MHzChannels.numChannels ;index++) |
| 1866 | { |
| 1867 | if(pMac->scan.base20MHzChannels.channelList[ index ] == chnNum){ |
| 1868 | status = eHAL_STATUS_SUCCESS; |
| 1869 | break; |
| 1870 | } |
| 1871 | } |
| 1872 | return status; |
| 1873 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1874 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac) |
| 1875 | { |
| 1876 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1877 | tANI_U8 num20MHzChannelsFound = 0; |
| 1878 | VOS_STATUS vosStatus; |
| 1879 | tANI_U8 Index = 0; |
| 1880 | tANI_U8 num40MHzChannelsFound = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1881 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1882 | |
| 1883 | //TODO: this interface changed to include the 40MHz channel list |
| 1884 | // this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation |
| 1885 | // Read the scan channel list (including the power limit) from EEPROM |
| 1886 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 1887 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 1888 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 1889 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1890 | smsLog( pMac, LOGE, FL("failed to get channels ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1891 | status = eHAL_STATUS_FAILURE; |
| 1892 | } |
| 1893 | else |
| 1894 | { |
| 1895 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 1896 | { |
| 1897 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1898 | } |
| 1899 | pMac->scan.numChannelsDefault = num20MHzChannelsFound; |
| 1900 | // Move the channel list to the global data |
| 1901 | // structure -- this will be used as the scan list |
| 1902 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 1903 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1904 | pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[ Index ].chanId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1905 | } |
| 1906 | pMac->scan.base20MHzChannels.numChannels = num20MHzChannelsFound; |
| 1907 | if(num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 1908 | { |
| 1909 | num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1910 | } |
| 1911 | for ( Index = 0; Index < num40MHzChannelsFound; Index++) |
| 1912 | { |
| 1913 | pMac->scan.base40MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable40MHz[ Index ].chanId; |
| 1914 | } |
| 1915 | pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound; |
| 1916 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1917 | return (status); |
| 1918 | } |
| 1919 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1920 | eHalStatus csrInitChannelList( tHalHandle hHal ) |
| 1921 | { |
| 1922 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1923 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1924 | csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels); |
| 1925 | csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels); |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 1926 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_FALSE); |
| 1927 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1928 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 1929 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1930 | |
| 1931 | return (status); |
| 1932 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1933 | eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, |
| 1934 | tCsrUpdateConfigParam *pUpdateConfigParam) |
| 1935 | { |
| 1936 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1937 | tCsr11dinfo *ps11dinfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1938 | ps11dinfo = &pUpdateConfigParam->Csr11dinfo; |
| 1939 | status = CsrInit11dInfo(pMac, ps11dinfo); |
| 1940 | return status; |
| 1941 | } |
| 1942 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1943 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 1944 | { |
| 1945 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1946 | tANI_U8 index; |
| 1947 | tANI_U32 count=0; |
| 1948 | tSirMacChanInfo *pChanInfo; |
| 1949 | tSirMacChanInfo *pChanInfoStart; |
| 1950 | tANI_BOOLEAN applyConfig = TRUE; |
| 1951 | |
| 1952 | if(!ps11dinfo) |
| 1953 | { |
| 1954 | return (status); |
| 1955 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1956 | if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) ) |
| 1957 | { |
| 1958 | pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels; |
| 1959 | status = palCopyMemory(pMac->hHdd, pMac->scan.base20MHzChannels.channelList, |
| 1960 | ps11dinfo->Channels.channelList, ps11dinfo->Channels.numChannels); |
| 1961 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
| 1962 | } |
| 1963 | else |
| 1964 | { |
| 1965 | //No change |
| 1966 | return (eHAL_STATUS_SUCCESS); |
| 1967 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1968 | //legacy maintenance |
| 1969 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, |
| 1970 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 1971 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1972 | //Tush: at csropen get this initialized with default, during csr reset if this |
| 1973 | // already set with some value no need initilaize with default again |
| 1974 | if(0 == pMac->scan.countryCodeCurrent[0]) |
| 1975 | { |
| 1976 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 1977 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 1978 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
| 1979 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1980 | // need to add the max power channel list |
| 1981 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN))) |
| 1982 | { |
| 1983 | palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 1984 | pChanInfoStart = pChanInfo; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1985 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 1986 | { |
| 1987 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 1988 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 1989 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 1990 | pChanInfo++; |
| 1991 | count++; |
| 1992 | } |
| 1993 | if(count) |
| 1994 | { |
| 1995 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 1996 | } |
| 1997 | palFreeMemory(pMac->hHdd, pChanInfoStart); |
| 1998 | } |
| 1999 | //Only apply them to CFG when not in STOP state. Otherwise they will be applied later |
| 2000 | if( HAL_STATUS_SUCCESS(status) ) |
| 2001 | { |
| 2002 | for( index = 0; index < CSR_ROAM_SESSION_MAX; index++ ) |
| 2003 | { |
| 2004 | if((CSR_IS_SESSION_VALID(pMac, index)) && CSR_IS_ROAM_STOP(pMac, index)) |
| 2005 | { |
| 2006 | applyConfig = FALSE; |
| 2007 | } |
| 2008 | } |
| 2009 | |
| 2010 | if(TRUE == applyConfig) |
| 2011 | { |
| 2012 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2013 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2014 | } |
| 2015 | |
| 2016 | } |
| 2017 | return (status); |
| 2018 | } |
| 2019 | /* Initialize the Channel + Power List in the local cache and in the CFG */ |
| 2020 | eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2021 | { |
| 2022 | tANI_U8 index; |
| 2023 | tANI_U32 count=0; |
| 2024 | tSirMacChanInfo *pChanInfo; |
| 2025 | tSirMacChanInfo *pChanInfoStart; |
| 2026 | |
| 2027 | if(!ps11dinfo || !pMac) |
| 2028 | { |
| 2029 | return eHAL_STATUS_FAILURE; |
| 2030 | } |
| 2031 | |
| 2032 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN))) |
| 2033 | { |
| 2034 | palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2035 | pChanInfoStart = pChanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2036 | |
| 2037 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2038 | { |
| 2039 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2040 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2041 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2042 | pChanInfo++; |
| 2043 | count++; |
| 2044 | } |
| 2045 | if(count) |
| 2046 | { |
| 2047 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2048 | } |
| 2049 | palFreeMemory(pMac->hHdd, pChanInfoStart); |
| 2050 | } |
| 2051 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2052 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2053 | } |
| 2054 | |
| 2055 | //pCommand may be NULL |
| 2056 | //Pass in sessionId in case pCommand is NULL. sessionId is not used in case pCommand is not NULL. |
| 2057 | void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason) |
| 2058 | { |
| 2059 | tListElem *pEntry, *pNextEntry; |
| 2060 | tSmeCmd *pDupCommand; |
| 2061 | tDblLinkList localList; |
| 2062 | |
| 2063 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 2064 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 2065 | { |
| 2066 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 2067 | return; |
| 2068 | } |
| 2069 | csrLLLock( &pMac->sme.smeCmdPendingList ); |
| 2070 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK ); |
| 2071 | while( pEntry ) |
| 2072 | { |
| 2073 | pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ); |
| 2074 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2075 | // Remove the previous command if.. |
| 2076 | // - the new roam command is for the same RoamReason... |
| 2077 | // - the new roam command is a NewProfileList. |
| 2078 | // - the new roam command is a Forced Dissoc |
| 2079 | // - the new roam command is from an 802.11 OID (OID_SSID or OID_BSSID). |
| 2080 | if ( |
| 2081 | (pCommand && ( pCommand->sessionId == pDupCommand->sessionId ) && |
| 2082 | ((pCommand->command == pDupCommand->command) && |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 2083 | /* This peermac check is requried for Softap/GO scenarios |
| 2084 | * For STA scenario below OR check will suffice as pCommand will |
| 2085 | * always be NULL for STA scenarios |
| 2086 | */ |
| 2087 | (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] | 2088 | (pCommand->u.roamCmd.roamReason == pDupCommand->u.roamCmd.roamReason || |
| 2089 | eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason || |
| 2090 | eCsrHddIssued == pCommand->u.roamCmd.roamReason))) |
| 2091 | || |
| 2092 | //below the pCommand is NULL |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2093 | ( (sessionId == pDupCommand->sessionId) && |
| 2094 | (eSmeCommandRoam == pDupCommand->command) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2095 | ((eCsrForcedDisassoc == eRoamReason) || |
| 2096 | (eCsrHddIssued == eRoamReason)) |
| 2097 | ) |
| 2098 | ) |
| 2099 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2100 | smsLog(pMac, LOGW, FL(" roamReason = %d"), pDupCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2101 | // Remove the 'stale' roam command from the pending list... |
| 2102 | if(csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK )) |
| 2103 | { |
| 2104 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 2105 | } |
| 2106 | } |
| 2107 | pEntry = pNextEntry; |
| 2108 | } |
| 2109 | csrLLUnlock( &pMac->sme.smeCmdPendingList ); |
| 2110 | |
| 2111 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 2112 | { |
| 2113 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 2114 | //Tell caller that the command is cancelled |
| 2115 | csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL, pDupCommand->u.roamCmd.roamId, |
| 2116 | eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE); |
| 2117 | csrReleaseCommandRoam(pMac, pDupCommand); |
| 2118 | } |
| 2119 | csrLLClose(&localList); |
| 2120 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2121 | eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, |
| 2122 | tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2) |
| 2123 | { |
| 2124 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2125 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2126 | WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type); |
| 2127 | #endif |
| 2128 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2129 | if( CSR_IS_SESSION_VALID( pMac, sessionId) ) |
| 2130 | { |
| 2131 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2132 | } |
| 2133 | else |
| 2134 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2135 | smsLog(pMac, LOGE, "Session ID:%d is not valid", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2136 | VOS_ASSERT(0); |
| 2137 | return eHAL_STATUS_FAILURE; |
| 2138 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2139 | if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo) |
| 2140 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2141 | 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] | 2142 | } |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 2143 | if ((u1 == eCSR_ROAM_FT_REASSOC_FAILED) && (pSession->bRefAssocStartCnt)) { |
| 2144 | /* |
| 2145 | * Decrement bRefAssocStartCnt for FT reassoc failure. |
| 2146 | * Reason: For FT reassoc failures, we first call |
| 2147 | * csrRoamCallCallback before notifying a failed roam |
| 2148 | * completion through csrRoamComplete. The latter in |
| 2149 | * turn calls csrRoamProcessResults which tries to |
| 2150 | * once again call csrRoamCallCallback if bRefAssocStartCnt |
| 2151 | * is non-zero. Since this is redundant for FT reassoc |
| 2152 | * failure, decrement bRefAssocStartCnt. |
| 2153 | */ |
| 2154 | pSession->bRefAssocStartCnt--; |
| 2155 | } |
| 2156 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2157 | if ( (pSession == NULL) || |
| 2158 | (eANI_BOOLEAN_FALSE == pSession->sessionActive) ) |
| 2159 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2160 | smsLog(pMac, LOG1, "Session ID is not valid"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2161 | return eHAL_STATUS_FAILURE; |
| 2162 | } |
| 2163 | |
| 2164 | if(NULL != pSession->callback) |
| 2165 | { |
| 2166 | if( pRoamInfo ) |
| 2167 | { |
| 2168 | pRoamInfo->sessionId = (tANI_U8)sessionId; |
| 2169 | } |
| 2170 | |
| 2171 | /* avoid holding the global lock when making the roaming callback , original change came |
| 2172 | from a raised CR (CR304874). Since this callback is in HDD a potential deadlock |
| 2173 | is possible on other OS ports where the callback may need to take locks to protect |
| 2174 | HDD state |
| 2175 | UPDATE : revert this change but keep the comments here. Need to revisit as there are callbacks |
| 2176 | that may actually depend on the lock being held */ |
| 2177 | // TODO: revisit: sme_ReleaseGlobalLock( &pMac->sme ); |
| 2178 | status = pSession->callback(pSession->pContext, pRoamInfo, roamId, u1, u2); |
| 2179 | // TODO: revisit: sme_AcquireGlobalLock( &pMac->sme ); |
| 2180 | } |
| 2181 | //EVENT_WLAN_STATUS: eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 2182 | // eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED, |
| 2183 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2184 | palZeroMemory(pMac->hHdd, &connectionStatus, sizeof(vos_event_wlan_status_payload_type)); |
| 2185 | if((eCSR_ROAM_ASSOCIATION_COMPLETION == u1) && (eCSR_ROAM_RESULT_ASSOCIATED == u2)) |
| 2186 | { |
| 2187 | connectionStatus.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 2188 | connectionStatus.bssType = pRoamInfo->u.pConnectedProfile->BSSType; |
| 2189 | if(NULL != pRoamInfo->pBssDesc) |
| 2190 | { |
| 2191 | connectionStatus.rssi = pRoamInfo->pBssDesc->rssi * (-1); |
| 2192 | connectionStatus.channel = pRoamInfo->pBssDesc->channelId; |
| 2193 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2194 | connectionStatus.qosCapability = pRoamInfo->u.pConnectedProfile->qosConnection; |
| 2195 | connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType); |
| 2196 | connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType); |
| 2197 | palCopyMemory(pMac->hHdd, connectionStatus.ssid, pRoamInfo->u.pConnectedProfile->SSID.ssId, 6); |
| 2198 | connectionStatus.reason = eCSR_REASON_UNSPECIFIED; |
| 2199 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2200 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2201 | if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2)) |
| 2202 | { |
| 2203 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2204 | connectionStatus.reason = eCSR_REASON_MIC_ERROR; |
| 2205 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2206 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2207 | if(eCSR_ROAM_RESULT_FORCED == u2) |
| 2208 | { |
| 2209 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2210 | connectionStatus.reason = eCSR_REASON_USER_REQUESTED; |
| 2211 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2212 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2213 | if(eCSR_ROAM_RESULT_DISASSOC_IND == u2) |
| 2214 | { |
| 2215 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2216 | connectionStatus.reason = eCSR_REASON_DISASSOC; |
| 2217 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2218 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2219 | if(eCSR_ROAM_RESULT_DEAUTH_IND == u2) |
| 2220 | { |
| 2221 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2222 | connectionStatus.reason = eCSR_REASON_DEAUTH; |
| 2223 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2224 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2225 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2226 | |
| 2227 | return (status); |
| 2228 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2229 | // Returns whether handoff is currently in progress or not |
| 2230 | tANI_BOOLEAN csrRoamIsHandoffInProgress(tpAniSirGlobal pMac) |
| 2231 | { |
| 2232 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 2233 | return csrNeighborRoamIsHandoffInProgress(pMac); |
| 2234 | #else |
| 2235 | return eANI_BOOLEAN_FALSE; |
| 2236 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2237 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2238 | eHalStatus csrRoamIssueDisassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2239 | eCsrRoamSubState NewSubstate, tANI_BOOLEAN fMICFailure ) |
| 2240 | { |
| 2241 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2242 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2243 | tANI_U16 reasonCode; |
| 2244 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2245 | |
| 2246 | if(!pSession) |
| 2247 | { |
| 2248 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2249 | return eHAL_STATUS_FAILURE; |
| 2250 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2251 | |
| 2252 | //Restore AC weight in case we change it |
| 2253 | if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 2254 | { |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 2255 | 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] | 2256 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 2257 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 2258 | } |
| 2259 | |
| 2260 | if ( fMICFailure ) |
| 2261 | { |
| 2262 | reasonCode = eSIR_MAC_MIC_FAILURE_REASON; |
| 2263 | } |
| 2264 | else if (NewSubstate == eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF) |
| 2265 | { |
| 2266 | reasonCode = eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2267 | } |
| 2268 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2269 | { |
| 2270 | reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 2271 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2272 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2273 | if ( (csrRoamIsHandoffInProgress(pMac)) && |
| 2274 | (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF)) |
| 2275 | { |
| 2276 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2277 | palCopyMemory(pMac->hHdd, &bssId, pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, sizeof(tSirMacAddr)); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2278 | } |
| 2279 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2280 | #endif |
| 2281 | if(pSession->pConnectBssDesc) |
| 2282 | { |
| 2283 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2284 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2286 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 2287 | smsLog( pMac, LOG2, "CSR Attempting to Disassociate Bssid=%02x-%02x-%02x-%02x-%02x-%02x" |
| 2288 | "subState = %d reason=%d", bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], bssId[ 3 ], |
| 2289 | bssId[ 4 ], bssId[ 5 ], NewSubstate, reasonCode); |
| 2290 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2291 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2292 | |
| 2293 | status = csrSendMBDisassocReqMsg( pMac, sessionId, bssId, reasonCode ); |
| 2294 | |
| 2295 | if(HAL_STATUS_SUCCESS(status)) |
| 2296 | { |
| 2297 | csrRoamLinkDown(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2298 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2299 | //no need to tell QoS that we are disassociating, it will be taken care off in assoc req for HO |
| 2300 | if(eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate) |
| 2301 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2302 | //notify QoS module that disassoc happening |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2303 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 2304 | } |
| 2305 | #endif |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2306 | } |
| 2307 | else |
| 2308 | { |
| 2309 | smsLog(pMac, LOGW, FL("csrSendMBDisassocReqMsg failed with status %d"), status); |
| 2310 | } |
| 2311 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2312 | return (status); |
| 2313 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2314 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2315 | /* --------------------------------------------------------------------------- |
| 2316 | \fn csrRoamIssueDisassociateStaCmd |
| 2317 | \brief csr function that HDD calls to disassociate a associated station |
| 2318 | \param sessionId - session Id for Soft AP |
| 2319 | \param pPeerMacAddr - MAC of associated station to delete |
| 2320 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2321 | \return eHalStatus |
| 2322 | ---------------------------------------------------------------------------*/ |
| 2323 | eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, |
| 2324 | tANI_U32 sessionId, |
| 2325 | tANI_U8 *pPeerMacAddr, |
| 2326 | tANI_U32 reason) |
| 2327 | { |
| 2328 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2329 | tSmeCmd *pCommand; |
| 2330 | |
| 2331 | do |
| 2332 | { |
| 2333 | pCommand = csrGetCommandBuffer( pMac ); |
| 2334 | if ( !pCommand ) |
| 2335 | { |
| 2336 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2337 | status = eHAL_STATUS_RESOURCES; |
| 2338 | break; |
| 2339 | } |
| 2340 | pCommand->command = eSmeCommandRoam; |
| 2341 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2342 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocSta; |
| 2343 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2344 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2345 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2346 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2347 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2348 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2349 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2350 | } |
| 2351 | }while(0); |
| 2352 | |
| 2353 | return status; |
| 2354 | } |
| 2355 | |
| 2356 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2357 | /* --------------------------------------------------------------------------- |
| 2358 | \fn csrRoamIssueDeauthSta |
| 2359 | \brief csr function that HDD calls to delete a associated station |
| 2360 | \param sessionId - session Id for Soft AP |
| 2361 | \param pPeerMacAddr - MAC of associated station to delete |
| 2362 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2363 | \return eHalStatus |
| 2364 | ---------------------------------------------------------------------------*/ |
| 2365 | eHalStatus csrRoamIssueDeauthStaCmd( tpAniSirGlobal pMac, |
| 2366 | tANI_U32 sessionId, |
| 2367 | tANI_U8 *pPeerMacAddr, |
| 2368 | tANI_U32 reason) |
| 2369 | { |
| 2370 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2371 | tSmeCmd *pCommand; |
| 2372 | |
| 2373 | do |
| 2374 | { |
| 2375 | pCommand = csrGetCommandBuffer( pMac ); |
| 2376 | if ( !pCommand ) |
| 2377 | { |
| 2378 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2379 | status = eHAL_STATUS_RESOURCES; |
| 2380 | break; |
| 2381 | } |
| 2382 | pCommand->command = eSmeCommandRoam; |
| 2383 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2384 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 2385 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2386 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2387 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2388 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2389 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2390 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2391 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2392 | } |
| 2393 | }while(0); |
| 2394 | |
| 2395 | return status; |
| 2396 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2397 | eHalStatus |
| 2398 | csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2399 | tANI_BOOLEAN bEnable ) |
| 2400 | { |
| 2401 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2402 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2403 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2404 | if (!pSession) |
| 2405 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2406 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2407 | return (status); |
| 2408 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2409 | if (pSession->pConnectBssDesc) |
| 2410 | { |
| 2411 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2412 | } |
| 2413 | else |
| 2414 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2415 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2416 | return (status); |
| 2417 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2418 | 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] | 2419 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2420 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] , bEnable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2421 | status = csrSendMBTkipCounterMeasuresReqMsg( pMac, sessionId, bEnable, bssId ); |
| 2422 | return (status); |
| 2423 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2424 | eHalStatus |
| 2425 | csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2426 | VOS_MODULE_ID modId, void *pUsrContext, |
| 2427 | void *pfnSapEventCallback, v_U8_t *pAssocStasBuf ) |
| 2428 | { |
| 2429 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2430 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2431 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2432 | if (!pSession) |
| 2433 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2434 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2435 | return (status); |
| 2436 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2437 | if(pSession->pConnectBssDesc) |
| 2438 | { |
| 2439 | palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) ); |
| 2440 | } |
| 2441 | else |
| 2442 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2443 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2444 | return (status); |
| 2445 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2446 | 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] | 2447 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2448 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2449 | status = csrSendMBGetAssociatedStasReqMsg( pMac, sessionId, modId, bssId, pUsrContext, pfnSapEventCallback, pAssocStasBuf ); |
| 2450 | return (status); |
| 2451 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2452 | eHalStatus |
| 2453 | csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2454 | void *pUsrContext, void *pfnSapEventCallback, v_MACADDR_t pRemoveMac ) |
| 2455 | { |
| 2456 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2457 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2458 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2459 | |
| 2460 | if (!pSession) |
| 2461 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2462 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2463 | return (status); |
| 2464 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2465 | if(pSession->pConnectBssDesc) |
| 2466 | { |
| 2467 | palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) ); |
| 2468 | } |
| 2469 | else |
| 2470 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2471 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2472 | return (status); |
| 2473 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2474 | 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] | 2475 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2476 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
| 2477 | |
| 2478 | status = csrSendMBGetWPSPBCSessions( pMac, sessionId, bssId, pUsrContext, pfnSapEventCallback, pRemoveMac); |
| 2479 | |
| 2480 | return (status); |
| 2481 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2482 | eHalStatus csrRoamIssueDeauth( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 2483 | { |
| 2484 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2485 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2486 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2487 | |
| 2488 | if (!pSession) |
| 2489 | { |
| 2490 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2491 | return eHAL_STATUS_FAILURE; |
| 2492 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2493 | |
| 2494 | if(pSession->pConnectBssDesc) |
| 2495 | { |
| 2496 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2497 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2498 | 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] | 2499 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2500 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2501 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2502 | |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2503 | status = csrSendMBDeauthReqMsg( pMac, sessionId, bssId, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2504 | if(!HAL_STATUS_SUCCESS(status)) |
| 2505 | { |
| 2506 | smsLog(pMac, LOGW, FL("csrSendMBDeauthReqMsg failed with status %d"), status); |
| 2507 | } |
| 2508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2509 | return (status); |
| 2510 | } |
| 2511 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2512 | eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc ) |
| 2513 | { |
| 2514 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2515 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2516 | tANI_U32 size; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2517 | |
| 2518 | if(!pSession) |
| 2519 | { |
| 2520 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2521 | return eHAL_STATUS_FAILURE; |
| 2522 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2523 | |
| 2524 | // If no BSS description was found in this connection (happens with start IBSS), then |
| 2525 | // nix the BSS description that we keep around for the connected BSS) and get out... |
| 2526 | if(NULL == pBssDesc) |
| 2527 | { |
| 2528 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2529 | } |
| 2530 | else |
| 2531 | { |
| 2532 | size = pBssDesc->length + sizeof( pBssDesc->length ); |
| 2533 | if(NULL != pSession->pConnectBssDesc) |
| 2534 | { |
| 2535 | if(((pSession->pConnectBssDesc->length) + sizeof(pSession->pConnectBssDesc->length)) < size) |
| 2536 | { |
| 2537 | //not enough room for the new BSS, pMac->roam.pConnectBssDesc is freed inside |
| 2538 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2539 | } |
| 2540 | } |
| 2541 | if(NULL == pSession->pConnectBssDesc) |
| 2542 | { |
| 2543 | status = palAllocateMemory( pMac->hHdd, (void **)&pSession->pConnectBssDesc, size); |
| 2544 | } |
| 2545 | if ( HAL_STATUS_SUCCESS(status) && pSession->pConnectBssDesc ) |
| 2546 | { |
| 2547 | palCopyMemory( pMac->hHdd, pSession->pConnectBssDesc, pBssDesc, size ); |
| 2548 | } |
| 2549 | } |
| 2550 | |
| 2551 | return (status); |
| 2552 | } |
| 2553 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2554 | eHalStatus csrRoamPrepareBssConfig(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2555 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 2556 | tDot11fBeaconIEs *pIes) |
| 2557 | { |
| 2558 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2559 | eCsrCfgDot11Mode cfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2560 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2561 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2562 | do |
| 2563 | { |
| 2564 | palCopyMemory(pMac->hHdd, &pBssConfig->BssCap, &pBssDesc->capabilityInfo, sizeof(tSirMacCapabilityInfo)); |
| 2565 | //get qos |
| 2566 | pBssConfig->qosType = csrGetQoSFromBssDesc(pMac, pBssDesc, pIes); |
| 2567 | //get SSID |
| 2568 | if(pIes->SSID.present) |
| 2569 | { |
| 2570 | palCopyMemory(pMac->hHdd, &pBssConfig->SSID.ssId, pIes->SSID.ssid, pIes->SSID.num_ssid); |
| 2571 | pBssConfig->SSID.length = pIes->SSID.num_ssid; |
| 2572 | } |
| 2573 | else |
| 2574 | pBssConfig->SSID.length = 0; |
| 2575 | if(csrIsNULLSSID(pBssConfig->SSID.ssId, pBssConfig->SSID.length)) |
| 2576 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2577 | smsLog(pMac, LOGW, " BSS desc SSID is a wildcard"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2578 | //Return failed if profile doesn't have an SSID either. |
| 2579 | if(pProfile->SSIDs.numOfSSIDs == 0) |
| 2580 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2581 | smsLog(pMac, LOGW, " Both BSS desc and profile doesn't have SSID"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2582 | status = eHAL_STATUS_FAILURE; |
| 2583 | break; |
| 2584 | } |
| 2585 | } |
| 2586 | if(CSR_IS_CHANNEL_5GHZ(pBssDesc->channelId)) |
| 2587 | { |
| 2588 | pBssConfig->eBand = eCSR_BAND_5G; |
| 2589 | } |
| 2590 | else |
| 2591 | { |
| 2592 | pBssConfig->eBand = eCSR_BAND_24; |
| 2593 | } |
| 2594 | //phymode |
| 2595 | if(csrIsPhyModeMatch( pMac, pProfile->phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes )) |
| 2596 | { |
| 2597 | pBssConfig->uCfgDot11Mode = cfgDot11Mode; |
| 2598 | } |
| 2599 | else |
| 2600 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2601 | smsLog(pMac, LOGW, " Can not find match phy mode"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2602 | //force it |
| 2603 | if(eCSR_BAND_24 == pBssConfig->eBand) |
| 2604 | { |
| 2605 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2606 | } |
| 2607 | else |
| 2608 | { |
| 2609 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2610 | } |
| 2611 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2612 | //Qos |
| 2613 | if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) && |
| 2614 | (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos)) |
| 2615 | { |
| 2616 | //Joining BSS is not 11n capable and WMM is disabled on client. |
| 2617 | //Disable QoS and WMM |
| 2618 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2619 | } |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2620 | |
| 2621 | if (((pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11N) || |
Pratik Bhalgat | 8d46164 | 2012-11-22 16:55:42 +0530 | [diff] [blame] | 2622 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC)) && |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2623 | ((pBssConfig->qosType != eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP) || |
| 2624 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_HCF) || |
| 2625 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_eDCF) )) |
| 2626 | { |
| 2627 | //Joining BSS is 11n capable and WMM is disabled on AP. |
| 2628 | //Assume all HT AP's are QOS AP's and enable WMM |
| 2629 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2630 | } |
| 2631 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2632 | //auth type |
| 2633 | switch( pProfile->negotiatedAuthType ) |
| 2634 | { |
| 2635 | default: |
| 2636 | case eCSR_AUTH_TYPE_WPA: |
| 2637 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2638 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2639 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2640 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2641 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2642 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2643 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2644 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2645 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2646 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2647 | break; |
| 2648 | } |
| 2649 | //short slot time |
| 2650 | if( eCSR_CFG_DOT11_MODE_11B != cfgDot11Mode ) |
| 2651 | { |
| 2652 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2653 | } |
| 2654 | else |
| 2655 | { |
| 2656 | pBssConfig->uShortSlotTime = 0; |
| 2657 | } |
| 2658 | if(pBssConfig->BssCap.ibss) |
| 2659 | { |
| 2660 | //We don't support 11h on IBSS |
| 2661 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2662 | } |
| 2663 | else |
| 2664 | { |
| 2665 | pBssConfig->f11hSupport = pMac->roam.configParam.Is11hSupportEnabled; |
| 2666 | } |
| 2667 | //power constraint |
| 2668 | pBssConfig->uPowerLimit = csrGet11hPowerConstraint(pMac, &pIes->PowerConstraints); |
| 2669 | //heartbeat |
| 2670 | if ( CSR_IS_11A_BSS( pBssDesc ) ) |
| 2671 | { |
| 2672 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2673 | } |
| 2674 | else |
| 2675 | { |
| 2676 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 2677 | } |
| 2678 | //Join timeout |
| 2679 | // 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] | 2680 | // be 10 x the BeaconInterval. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2681 | if ( pBssDesc->beaconInterval ) |
| 2682 | { |
| 2683 | //Make sure it is bigger than the minimal |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2684 | 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] | 2685 | } |
| 2686 | else |
| 2687 | { |
| 2688 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
| 2689 | } |
| 2690 | //validate CB |
| 2691 | pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes); |
| 2692 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2693 | return (status); |
| 2694 | } |
| 2695 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2696 | static eHalStatus csrRoamPrepareBssConfigFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2697 | tBssConfigParam *pBssConfig, tSirBssDescription *pBssDesc) |
| 2698 | { |
| 2699 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2700 | tANI_U8 operationChannel = 0; |
| 2701 | tANI_U8 qAPisEnabled = FALSE; |
| 2702 | //SSID |
| 2703 | pBssConfig->SSID.length = 0; |
| 2704 | if(pProfile->SSIDs.numOfSSIDs) |
| 2705 | { |
| 2706 | //only use the first one |
| 2707 | palCopyMemory(pMac->hHdd, &pBssConfig->SSID, &pProfile->SSIDs.SSIDList[0].SSID, sizeof(tSirMacSSid)); |
| 2708 | } |
| 2709 | else |
| 2710 | { |
| 2711 | //SSID must present |
| 2712 | return eHAL_STATUS_FAILURE; |
| 2713 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2714 | //Settomg up the capabilities |
| 2715 | if( csrIsBssTypeIBSS(pProfile->BSSType) ) |
| 2716 | { |
| 2717 | pBssConfig->BssCap.ibss = 1; |
| 2718 | } |
| 2719 | else |
| 2720 | { |
| 2721 | pBssConfig->BssCap.ess = 1; |
| 2722 | } |
| 2723 | if( eCSR_ENCRYPT_TYPE_NONE != pProfile->EncryptionType.encryptionType[0] ) |
| 2724 | { |
| 2725 | pBssConfig->BssCap.privacy = 1; |
| 2726 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2727 | pBssConfig->eBand = pMac->roam.configParam.eBand; |
| 2728 | //phymode |
| 2729 | if(pProfile->ChannelInfo.ChannelList) |
| 2730 | { |
| 2731 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 2732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2733 | pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, operationChannel, |
| 2734 | &pBssConfig->eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2735 | //QOS |
| 2736 | //Is this correct to always set to this //*** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2737 | if ( pBssConfig->BssCap.ess == 1 ) |
| 2738 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2739 | /*For Softap case enable WMM*/ |
| 2740 | if(CSR_IS_INFRA_AP(pProfile) && (eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode )){ |
| 2741 | qAPisEnabled = TRUE; |
| 2742 | } |
| 2743 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2744 | if (csrRoamGetQosInfoFromBss(pMac, pBssDesc) == eHAL_STATUS_SUCCESS) { |
| 2745 | qAPisEnabled = TRUE; |
| 2746 | } else { |
| 2747 | qAPisEnabled = FALSE; |
| 2748 | } |
| 2749 | } else { |
| 2750 | qAPisEnabled = TRUE; |
| 2751 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2752 | if (( eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && qAPisEnabled) || |
| 2753 | (( eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && qAPisEnabled) || |
| 2754 | ( eCSR_CFG_DOT11_MODE_TAURUS == pBssConfig->uCfgDot11Mode ) ) //For 11n, need QoS |
| 2755 | ) |
| 2756 | { |
| 2757 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2758 | } else { |
| 2759 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2760 | } |
| 2761 | |
| 2762 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 2763 | switch( pProfile->AuthType.authType[0] ) //Take the preferred Auth type. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2764 | { |
| 2765 | default: |
| 2766 | case eCSR_AUTH_TYPE_WPA: |
| 2767 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2768 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2769 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2770 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2771 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2772 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2773 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2774 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2775 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2776 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2777 | break; |
| 2778 | } |
| 2779 | //short slot time |
| 2780 | if( WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode ) |
| 2781 | { |
| 2782 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2783 | } |
| 2784 | else |
| 2785 | { |
| 2786 | pBssConfig->uShortSlotTime = 0; |
| 2787 | } |
| 2788 | //power constraint. We don't support 11h on IBSS |
| 2789 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2790 | pBssConfig->uPowerLimit = 0; |
| 2791 | //heartbeat |
| 2792 | if ( eCSR_BAND_5G == pBssConfig->eBand ) |
| 2793 | { |
| 2794 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2795 | } |
| 2796 | else |
| 2797 | { |
| 2798 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 2799 | } |
| 2800 | //Join timeout |
| 2801 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
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 | return (status); |
| 2804 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2805 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc) |
| 2806 | { |
| 2807 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2808 | tDot11fBeaconIEs *pIes = NULL; |
| 2809 | |
| 2810 | do |
| 2811 | { |
| 2812 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 2813 | { |
| 2814 | //err msg |
| 2815 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2816 | "csrRoamGetQosInfoFromBss() failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2817 | break; |
| 2818 | } |
| 2819 | //check if the AP is QAP & it supports APSD |
| 2820 | if( CSR_IS_QOS_BSS(pIes) ) |
| 2821 | { |
| 2822 | return eHAL_STATUS_SUCCESS; |
| 2823 | } |
| 2824 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2825 | return status; |
| 2826 | } |
| 2827 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2828 | void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy ) |
| 2829 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2830 | // !! Note: the only difference between this function and the csrSetCfgPrivacyFromProfile() is the |
| 2831 | // setting of the privacy CFG based on the advertised privacy setting from the AP for WPA associations. |
| 2832 | // See !!Note: below in this function... |
| 2833 | tANI_U32 PrivacyEnabled = 0; |
| 2834 | tANI_U32 RsnEnabled = 0; |
| 2835 | tANI_U32 WepDefaultKeyId = 0; |
| 2836 | tANI_U32 WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; /* default 40 bits */ |
| 2837 | tANI_U32 Key0Length = 0; |
| 2838 | tANI_U32 Key1Length = 0; |
| 2839 | tANI_U32 Key2Length = 0; |
| 2840 | tANI_U32 Key3Length = 0; |
| 2841 | |
| 2842 | // Reserve for the biggest key |
| 2843 | tANI_U8 Key0[ WNI_CFG_WEP_DEFAULT_KEY_1_LEN ]; |
| 2844 | tANI_U8 Key1[ WNI_CFG_WEP_DEFAULT_KEY_2_LEN ]; |
| 2845 | tANI_U8 Key2[ WNI_CFG_WEP_DEFAULT_KEY_3_LEN ]; |
| 2846 | tANI_U8 Key3[ WNI_CFG_WEP_DEFAULT_KEY_4_LEN ]; |
| 2847 | |
| 2848 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 2849 | { |
| 2850 | case eCSR_ENCRYPT_TYPE_NONE: |
| 2851 | |
| 2852 | // for NO encryption, turn off Privacy and Rsn. |
| 2853 | PrivacyEnabled = 0; |
| 2854 | RsnEnabled = 0; |
| 2855 | |
| 2856 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 2857 | |
| 2858 | // clear out the WEP keys that may be hanging around. |
| 2859 | Key0Length = 0; |
| 2860 | Key1Length = 0; |
| 2861 | Key2Length = 0; |
| 2862 | Key3Length = 0; |
| 2863 | |
| 2864 | break; |
| 2865 | |
| 2866 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 2867 | |
| 2868 | // Privacy is ON. NO RSN for Wep40 static key. |
| 2869 | PrivacyEnabled = 1; |
| 2870 | RsnEnabled = 0; |
| 2871 | |
| 2872 | // Set the Wep default key ID. |
| 2873 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2874 | // Wep key size if 5 bytes (40 bits). |
| 2875 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2876 | |
| 2877 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 2878 | if ( pProfile->Keys.KeyLength[0] ) |
| 2879 | { |
| 2880 | palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[0], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2881 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2882 | } |
| 2883 | else |
| 2884 | { |
| 2885 | Key0Length = 0; |
| 2886 | } |
| 2887 | |
| 2888 | if ( pProfile->Keys.KeyLength[1] ) |
| 2889 | { |
| 2890 | palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[1], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2891 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2892 | } |
| 2893 | else |
| 2894 | { |
| 2895 | Key1Length = 0; |
| 2896 | } |
| 2897 | |
| 2898 | if ( pProfile->Keys.KeyLength[2] ) |
| 2899 | { |
| 2900 | palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[2], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2901 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2902 | } |
| 2903 | else |
| 2904 | { |
| 2905 | Key2Length = 0; |
| 2906 | } |
| 2907 | |
| 2908 | if ( pProfile->Keys.KeyLength[3] ) |
| 2909 | { |
| 2910 | palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[3], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2911 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2912 | } |
| 2913 | else |
| 2914 | { |
| 2915 | Key3Length = 0; |
| 2916 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2917 | break; |
| 2918 | |
| 2919 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 2920 | |
| 2921 | // Privacy is ON. NO RSN for Wep40 static key. |
| 2922 | PrivacyEnabled = 1; |
| 2923 | RsnEnabled = 0; |
| 2924 | |
| 2925 | // Set the Wep default key ID. |
| 2926 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
| 2927 | |
| 2928 | // Wep key size if 13 bytes (104 bits). |
| 2929 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2930 | |
| 2931 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 2932 | if ( pProfile->Keys.KeyLength[0] ) |
| 2933 | { |
| 2934 | palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[ 0 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2935 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2936 | } |
| 2937 | else |
| 2938 | { |
| 2939 | Key0Length = 0; |
| 2940 | } |
| 2941 | |
| 2942 | if ( pProfile->Keys.KeyLength[1] ) |
| 2943 | { |
| 2944 | palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[ 1 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2945 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2946 | } |
| 2947 | else |
| 2948 | { |
| 2949 | Key1Length = 0; |
| 2950 | } |
| 2951 | |
| 2952 | if ( pProfile->Keys.KeyLength[2] ) |
| 2953 | { |
| 2954 | palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[ 2 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2955 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2956 | } |
| 2957 | else |
| 2958 | { |
| 2959 | Key2Length = 0; |
| 2960 | } |
| 2961 | |
| 2962 | if ( pProfile->Keys.KeyLength[3] ) |
| 2963 | { |
| 2964 | palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[ 3 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2965 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2966 | } |
| 2967 | else |
| 2968 | { |
| 2969 | Key3Length = 0; |
| 2970 | } |
| 2971 | |
| 2972 | break; |
| 2973 | |
| 2974 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 2975 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 2976 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 2977 | case eCSR_ENCRYPT_TYPE_AES: |
| 2978 | #ifdef FEATURE_WLAN_WAPI |
| 2979 | case eCSR_ENCRYPT_TYPE_WPI: |
| 2980 | #endif /* FEATURE_WLAN_WAPI */ |
| 2981 | // !! Note: this is the only difference between this function and the csrSetCfgPrivacyFromProfile() |
| 2982 | // (setting of the privacy CFG based on the advertised privacy setting from the AP for WPA/WAPI associations ). |
| 2983 | PrivacyEnabled = (0 != fPrivacy); |
| 2984 | |
| 2985 | // turn on RSN enabled for WPA associations |
| 2986 | RsnEnabled = 1; |
| 2987 | |
| 2988 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 2989 | |
| 2990 | // clear out the static WEP keys that may be hanging around. |
| 2991 | Key0Length = 0; |
| 2992 | Key1Length = 0; |
| 2993 | Key2Length = 0; |
| 2994 | Key3Length = 0; |
| 2995 | |
| 2996 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2997 | default: |
| 2998 | PrivacyEnabled = 0; |
| 2999 | RsnEnabled = 0; |
| 3000 | break; |
| 3001 | } |
| 3002 | |
| 3003 | ccmCfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3004 | ccmCfgSetInt(pMac, WNI_CFG_RSN_ENABLED, RsnEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3005 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length, NULL, eANI_BOOLEAN_FALSE); |
| 3006 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length, NULL, eANI_BOOLEAN_FALSE); |
| 3007 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length, NULL, eANI_BOOLEAN_FALSE); |
| 3008 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length, NULL, eANI_BOOLEAN_FALSE); |
| 3009 | ccmCfgSetInt(pMac, WNI_CFG_WEP_KEY_LENGTH, WepKeyLength, NULL, eANI_BOOLEAN_FALSE); |
| 3010 | ccmCfgSetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId, NULL, eANI_BOOLEAN_FALSE); |
| 3011 | } |
| 3012 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3013 | static void csrSetCfgSsid( tpAniSirGlobal pMac, tSirMacSSid *pSSID ) |
| 3014 | { |
| 3015 | tANI_U32 len = 0; |
| 3016 | if(pSSID->length <= WNI_CFG_SSID_LEN) |
| 3017 | { |
| 3018 | len = pSSID->length; |
| 3019 | } |
| 3020 | ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pSSID->ssId, len, NULL, eANI_BOOLEAN_FALSE); |
| 3021 | } |
| 3022 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3023 | eHalStatus csrSetQosToCfg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrMediaAccessType qosType ) |
| 3024 | { |
| 3025 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3026 | tANI_U32 QoSEnabled; |
| 3027 | tANI_U32 WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3028 | // set the CFG enable/disable variables based on the qosType being configured... |
| 3029 | switch( qosType ) |
| 3030 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3031 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p: |
| 3032 | QoSEnabled = FALSE; |
| 3033 | WmeEnabled = TRUE; |
| 3034 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3035 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP: |
| 3036 | QoSEnabled = FALSE; |
| 3037 | WmeEnabled = TRUE; |
| 3038 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3039 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify: |
| 3040 | QoSEnabled = FALSE; |
| 3041 | WmeEnabled = TRUE; |
| 3042 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3043 | case eCSR_MEDIUM_ACCESS_11e_eDCF: |
| 3044 | QoSEnabled = TRUE; |
| 3045 | WmeEnabled = FALSE; |
| 3046 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3047 | case eCSR_MEDIUM_ACCESS_11e_HCF: |
| 3048 | QoSEnabled = TRUE; |
| 3049 | WmeEnabled = FALSE; |
| 3050 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3051 | default: |
| 3052 | case eCSR_MEDIUM_ACCESS_DCF: |
| 3053 | QoSEnabled = FALSE; |
| 3054 | WmeEnabled = FALSE; |
| 3055 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3056 | } |
| 3057 | //save the WMM setting for later use |
| 3058 | pMac->roam.roamSession[sessionId].fWMMConnection = (tANI_BOOLEAN)WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3059 | status = ccmCfgSetInt(pMac, WNI_CFG_QOS_ENABLED, QoSEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3060 | status = ccmCfgSetInt(pMac, WNI_CFG_WME_ENABLED, WmeEnabled, NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3061 | return (status); |
| 3062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3063 | static eHalStatus csrGetRateSet( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc, |
| 3064 | tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet) |
| 3065 | { |
| 3066 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3067 | int i; |
| 3068 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3069 | tANI_U8 *pDstRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3070 | palZeroMemory(pMac->hHdd, pOpRateSet, sizeof(tSirMacRateSet)); |
| 3071 | palZeroMemory(pMac->hHdd, pExRateSet, sizeof(tSirMacRateSet)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3072 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3073 | |
| 3074 | if( NULL != pIes ) |
| 3075 | { |
| 3076 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3077 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3078 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3079 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3080 | // would blindly put the rates we support into our Operational Rate set |
| 3081 | // (including the basic rates, which we have already verified are |
| 3082 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3083 | // However, it turns out that this is not always the case. Some AP's |
| 3084 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3085 | // too. Now, we're a little more careful: |
| 3086 | pDstRate = pOpRateSet->rate; |
| 3087 | if(pIes->SuppRates.present) |
| 3088 | { |
| 3089 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3090 | { |
| 3091 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) ) |
| 3092 | { |
| 3093 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 3094 | pOpRateSet->numRates++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3095 | } |
| 3096 | } |
| 3097 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3098 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3099 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3100 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3101 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3102 | { |
| 3103 | // If there are Extended Rates in the beacon, we will reflect those |
| 3104 | // extended rates that we support in out Extended Operational Rate |
| 3105 | // set: |
| 3106 | pDstRate = pExRateSet->rate; |
| 3107 | if(pIes->ExtSuppRates.present) |
| 3108 | { |
| 3109 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3110 | { |
| 3111 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) ) |
| 3112 | { |
| 3113 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3114 | pExRateSet->numRates++; |
| 3115 | } |
| 3116 | } |
| 3117 | } |
| 3118 | } |
| 3119 | }//Parsing BSSDesc |
| 3120 | else |
| 3121 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3122 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3123 | } |
| 3124 | if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0) status = eHAL_STATUS_SUCCESS; |
| 3125 | return status; |
| 3126 | } |
| 3127 | |
| 3128 | static void csrSetCfgRateSet( tpAniSirGlobal pMac, eCsrPhyMode phyMode, tCsrRoamProfile *pProfile, |
| 3129 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3130 | { |
| 3131 | int i; |
| 3132 | tANI_U8 *pDstRate; |
| 3133 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3134 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3135 | tANI_U32 OperationalRatesLength = 0; |
| 3136 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3137 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3138 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3139 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3140 | tANI_U32 PropRatesEnable = 0; |
| 3141 | tANI_U8 MCSRateIdxSet[ SIZE_OF_SUPPORTED_MCS_SET ]; |
| 3142 | tANI_U32 MCSRateLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3143 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3144 | if( NULL != pIes ) |
| 3145 | { |
| 3146 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3147 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3148 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3149 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3150 | // would blindly put the rates we support into our Operational Rate set |
| 3151 | // (including the basic rates, which we have already verified are |
| 3152 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3153 | // However, it turns out that this is not always the case. Some AP's |
| 3154 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3155 | // too. Now, we're a little more careful: |
| 3156 | pDstRate = OperationalRates; |
| 3157 | if(pIes->SuppRates.present) |
| 3158 | { |
| 3159 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3160 | { |
| 3161 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) && |
| 3162 | ( OperationalRatesLength < CSR_DOT11_SUPPORTED_RATES_MAX )) |
| 3163 | { |
| 3164 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
| 3165 | OperationalRatesLength++; |
| 3166 | } |
| 3167 | } |
| 3168 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3169 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3170 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3171 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3172 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3173 | { |
| 3174 | // If there are Extended Rates in the beacon, we will reflect those |
| 3175 | // extended rates that we support in out Extended Operational Rate |
| 3176 | // set: |
| 3177 | pDstRate = ExtendedOperationalRates; |
| 3178 | if(pIes->ExtSuppRates.present) |
| 3179 | { |
| 3180 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3181 | { |
| 3182 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) && |
| 3183 | ( ExtendedOperationalRatesLength < CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX )) |
| 3184 | { |
| 3185 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3186 | ExtendedOperationalRatesLength++; |
| 3187 | } |
| 3188 | } |
| 3189 | } |
| 3190 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3191 | // Enable proprietary MAC features if peer node is Airgo node and STA |
| 3192 | // user wants to use them |
| 3193 | if( pIes->Airgo.present && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3194 | { |
| 3195 | PropRatesEnable = 1; |
| 3196 | } |
| 3197 | else |
| 3198 | { |
| 3199 | PropRatesEnable = 0; |
| 3200 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3201 | // For ANI network companions, we need to populate the proprietary rate |
| 3202 | // set with any proprietary rates we found in the beacon, only if user |
| 3203 | // allows them... |
| 3204 | if ( PropRatesEnable && pIes->Airgo.PropSuppRates.present && |
| 3205 | ( pIes->Airgo.PropSuppRates.num_rates > 0 )) |
| 3206 | { |
| 3207 | ProprietaryOperationalRatesLength = pIes->Airgo.PropSuppRates.num_rates; |
| 3208 | if ( ProprietaryOperationalRatesLength > sizeof(ProprietaryOperationalRates) ) |
| 3209 | { |
| 3210 | ProprietaryOperationalRatesLength = sizeof (ProprietaryOperationalRates); |
| 3211 | } |
| 3212 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, pIes->Airgo.PropSuppRates.rates, ProprietaryOperationalRatesLength ); |
| 3213 | } |
| 3214 | else { |
| 3215 | // No proprietary modes... |
| 3216 | ProprietaryOperationalRatesLength = 0; |
| 3217 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3218 | /* Get MCS Rate */ |
| 3219 | pDstRate = MCSRateIdxSet; |
| 3220 | if ( pIes->HTCaps.present ) |
| 3221 | { |
| 3222 | for ( i = 0; i < VALID_MAX_MCS_INDEX; i++ ) |
| 3223 | { |
| 3224 | if ( (unsigned int)pIes->HTCaps.supportedMCSSet[0] & (1 << i) ) |
| 3225 | { |
| 3226 | MCSRateLength++; |
| 3227 | *pDstRate++ = i; |
| 3228 | } |
| 3229 | } |
| 3230 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3231 | // Set the operational rate set CFG variables... |
| 3232 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3233 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3234 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3235 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3236 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3237 | ProprietaryOperationalRates, |
| 3238 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3239 | ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE); |
| 3240 | ccmCfgSetStr(pMac, WNI_CFG_CURRENT_MCS_SET, MCSRateIdxSet, |
| 3241 | MCSRateLength, NULL, eANI_BOOLEAN_FALSE); |
| 3242 | }//Parsing BSSDesc |
| 3243 | else |
| 3244 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3245 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3246 | } |
| 3247 | } |
| 3248 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3249 | static void csrSetCfgRateSetFromProfile( tpAniSirGlobal pMac, |
| 3250 | tCsrRoamProfile *pProfile ) |
| 3251 | { |
| 3252 | tSirMacRateSetIE DefaultSupportedRates11a = { SIR_MAC_RATESET_EID, |
| 3253 | { 8, |
| 3254 | { SIR_MAC_RATE_6, |
| 3255 | SIR_MAC_RATE_9, |
| 3256 | SIR_MAC_RATE_12, |
| 3257 | SIR_MAC_RATE_18, |
| 3258 | SIR_MAC_RATE_24, |
| 3259 | SIR_MAC_RATE_36, |
| 3260 | SIR_MAC_RATE_48, |
| 3261 | SIR_MAC_RATE_54 } } }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3262 | tSirMacRateSetIE DefaultSupportedRates11b = { SIR_MAC_RATESET_EID, |
| 3263 | { 4, |
| 3264 | { SIR_MAC_RATE_1, |
| 3265 | SIR_MAC_RATE_2, |
| 3266 | SIR_MAC_RATE_5_5, |
| 3267 | SIR_MAC_RATE_11 } } }; |
| 3268 | |
| 3269 | |
| 3270 | tSirMacPropRateSet DefaultSupportedPropRates = { 3, |
| 3271 | { SIR_MAC_RATE_72, |
| 3272 | SIR_MAC_RATE_96, |
| 3273 | SIR_MAC_RATE_108 } }; |
| 3274 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3275 | eCsrBand eBand; |
| 3276 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3277 | tANI_U32 OperationalRatesLength = 0; |
| 3278 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3279 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3280 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3281 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3282 | tANI_U32 PropRatesEnable = 0; |
| 3283 | tANI_U8 operationChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3284 | if(pProfile->ChannelInfo.ChannelList) |
| 3285 | { |
| 3286 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 3287 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3288 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3289 | // For 11a networks, the 11a rates go into the Operational Rate set. For 11b and 11g |
| 3290 | // networks, the 11b rates appear in the Operational Rate set. In either case, |
| 3291 | // we can blindly put the rates we support into our Operational Rate set |
| 3292 | // (including the basic rates, which we have already verified are supported |
| 3293 | // earlier in the roaming decision). |
| 3294 | if ( eCSR_BAND_5G == eBand ) |
| 3295 | { |
| 3296 | // 11a rates into the Operational Rate Set. |
| 3297 | OperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3298 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
| 3299 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3300 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3301 | OperationalRatesLength ); |
| 3302 | |
| 3303 | // Nothing in the Extended rate set. |
| 3304 | ExtendedOperationalRatesLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3305 | // populate proprietary rates if user allows them |
| 3306 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3307 | { |
| 3308 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3309 | sizeof(*DefaultSupportedPropRates.propRate); |
| 3310 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, |
| 3311 | DefaultSupportedPropRates.propRate, |
| 3312 | ProprietaryOperationalRatesLength ); |
| 3313 | } |
| 3314 | else |
| 3315 | { |
| 3316 | // No proprietary modes |
| 3317 | ProprietaryOperationalRatesLength = 0; |
| 3318 | } |
| 3319 | } |
| 3320 | else if ( eCSR_CFG_DOT11_MODE_11B == cfgDot11Mode ) |
| 3321 | { |
| 3322 | // 11b rates into the Operational Rate Set. |
| 3323 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3324 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
| 3325 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3326 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3327 | OperationalRatesLength ); |
| 3328 | // Nothing in the Extended rate set. |
| 3329 | ExtendedOperationalRatesLength = 0; |
| 3330 | // No proprietary modes |
| 3331 | ProprietaryOperationalRatesLength = 0; |
| 3332 | } |
| 3333 | else |
| 3334 | { |
| 3335 | // 11G |
| 3336 | |
| 3337 | // 11b rates into the Operational Rate Set. |
| 3338 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3339 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
| 3340 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3341 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3342 | OperationalRatesLength ); |
| 3343 | |
| 3344 | // 11a rates go in the Extended rate set. |
| 3345 | ExtendedOperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3346 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
| 3347 | palCopyMemory( pMac->hHdd, ExtendedOperationalRates, |
| 3348 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3349 | ExtendedOperationalRatesLength ); |
| 3350 | |
| 3351 | // populate proprietary rates if user allows them |
| 3352 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3353 | { |
| 3354 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3355 | sizeof(*DefaultSupportedPropRates.propRate); |
| 3356 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, |
| 3357 | DefaultSupportedPropRates.propRate, |
| 3358 | ProprietaryOperationalRatesLength ); |
| 3359 | } |
| 3360 | else |
| 3361 | { |
| 3362 | // No proprietary modes |
| 3363 | ProprietaryOperationalRatesLength = 0; |
| 3364 | } |
| 3365 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3366 | // set this to 1 if prop. rates need to be advertised in to the IBSS beacon and user wants to use them |
| 3367 | if ( ProprietaryOperationalRatesLength && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3368 | { |
| 3369 | PropRatesEnable = 1; |
| 3370 | } |
| 3371 | else |
| 3372 | { |
| 3373 | PropRatesEnable = 0; |
| 3374 | } |
| 3375 | |
| 3376 | // Set the operational rate set CFG variables... |
| 3377 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3378 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3379 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3380 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3381 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3382 | ProprietaryOperationalRates, |
| 3383 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3384 | 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] | 3385 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3386 | void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result) |
| 3387 | { |
| 3388 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3389 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3390 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 3391 | tANI_U32 sessionId; |
| 3392 | tSmeCmd *pCommand = NULL; |
| 3393 | |
| 3394 | if(NULL == pEntry) |
| 3395 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3396 | smsLog(pMac, LOGW, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3397 | return; |
| 3398 | } |
| 3399 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 3400 | sessionId = pCommand->sessionId; |
| 3401 | |
| 3402 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 3403 | { |
| 3404 | csrRoamingStateConfigCnfProcessor(pMac, (tANI_U32)result); |
| 3405 | } |
| 3406 | } |
| 3407 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3408 | //This function is very dump. It is here because PE still need WNI_CFG_PHY_MODE |
| 3409 | tANI_U32 csrRoamGetPhyModeFromDot11Mode(eCsrCfgDot11Mode dot11Mode, eCsrBand band) |
| 3410 | { |
| 3411 | if(eCSR_CFG_DOT11_MODE_11B == dot11Mode) |
| 3412 | { |
| 3413 | return (WNI_CFG_PHY_MODE_11B); |
| 3414 | } |
| 3415 | else |
| 3416 | { |
| 3417 | if(eCSR_BAND_24 == band) |
| 3418 | return (WNI_CFG_PHY_MODE_11G); |
| 3419 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3420 | return (WNI_CFG_PHY_MODE_11A); |
| 3421 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3422 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3423 | |
| 3424 | #ifdef WLAN_FEATURE_11AC |
| 3425 | ePhyChanBondState csrGetHTCBStateFromVHTCBState(ePhyChanBondState aniCBMode) |
| 3426 | { |
| 3427 | switch ( aniCBMode ) |
| 3428 | { |
| 3429 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 3430 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 3431 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 3432 | return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 3433 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 3434 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 3435 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 3436 | return PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 3437 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3438 | default : |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3439 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 3440 | } |
| 3441 | } |
| 3442 | #endif |
| 3443 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3444 | //pIes may be NULL |
| 3445 | eHalStatus csrRoamSetBssConfigCfg(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3446 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 3447 | tDot11fBeaconIEs *pIes) |
| 3448 | { |
| 3449 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3450 | tANI_U32 cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3451 | tANI_U8 channel = 0; |
| 3452 | //Make sure we have the domain info for the BSS we try to connect to. |
| 3453 | //Do we need to worry about sequence for OSs that are not Windows?? |
| 3454 | if(pBssDesc) |
| 3455 | { |
| 3456 | if(csrLearnCountryInformation(pMac, pBssDesc, pIes, eANI_BOOLEAN_TRUE)) |
| 3457 | { |
| 3458 | //Make sure the 11d info from this BSSDesc can be applied |
| 3459 | pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE; |
| 3460 | csrApplyCountryInformation( pMac, TRUE ); |
| 3461 | } |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3462 | if ((csrIs11dSupported (pMac)) && pIes) |
| 3463 | { |
| 3464 | if (!pIes->Country.present) |
| 3465 | csrResetCountryInformation(pMac, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE ); |
| 3466 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3467 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3468 | //Qos |
| 3469 | csrSetQosToCfg( pMac, sessionId, pBssConfig->qosType ); |
| 3470 | //SSID |
| 3471 | csrSetCfgSsid(pMac, &pBssConfig->SSID ); |
| 3472 | //fragment threshold |
| 3473 | //ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3474 | //RTS threshold |
| 3475 | //ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3476 | |
| 3477 | //ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, csrTranslateToWNICfgDot11Mode(pMac, pBssConfig->uCfgDot11Mode), NULL, eANI_BOOLEAN_FALSE); |
| 3478 | |
| 3479 | //Auth type |
| 3480 | ccmCfgSetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType, NULL, eANI_BOOLEAN_FALSE); |
| 3481 | //encryption type |
| 3482 | csrSetCfgPrivacy(pMac, pProfile, (tANI_BOOLEAN)pBssConfig->BssCap.privacy ); |
| 3483 | //short slot time |
| 3484 | 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] | 3485 | //11d |
| 3486 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 3487 | ((pBssConfig->f11hSupport) ? pBssConfig->f11hSupport : pProfile->ieee80211d), |
| 3488 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3489 | /*//11h |
| 3490 | ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3491 | */ |
| 3492 | ccmCfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, pBssConfig->uPowerLimit, NULL, eANI_BOOLEAN_FALSE); |
| 3493 | //CB |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3494 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3495 | if(CSR_IS_INFRA_AP(pProfile) || CSR_IS_WDS_AP(pProfile)) |
| 3496 | { |
| 3497 | channel = pProfile->operationChannel; |
| 3498 | } |
| 3499 | else |
| 3500 | { |
| 3501 | if(pBssDesc) |
| 3502 | { |
| 3503 | channel = pBssDesc->channelId; |
| 3504 | } |
| 3505 | } |
| 3506 | if(0 != channel) |
| 3507 | { |
| 3508 | if(CSR_IS_CHANNEL_24GHZ(channel)) |
| 3509 | {//for now if we are on 2.4 Ghz, CB will be always disabled |
| 3510 | cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3511 | } |
| 3512 | else |
| 3513 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3514 | cfgCb = pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3515 | } |
| 3516 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3517 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | a0d8893 | 2012-11-13 10:51:26 -0800 | [diff] [blame] | 3518 | // cbMode = 1 in cfg.ini is mapped to PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 3519 | // in function csrConvertCBIniValueToPhyCBState() |
| 3520 | // So, max value for cbMode in 40MHz mode is 3 (MAC\src\include\sirParams.h) |
| 3521 | if(cfgCb > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3522 | { |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3523 | if(!WDA_getFwWlanFeatCaps(DOT11AC)) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3524 | cfgCb = csrGetHTCBStateFromVHTCBState(cfgCb); |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3525 | } |
| 3526 | else |
| 3527 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3528 | 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] | 3529 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3530 | } |
| 3531 | else |
| 3532 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3533 | ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, cfgCb, NULL, eANI_BOOLEAN_FALSE); |
| 3534 | //Rate |
| 3535 | //Fixed Rate |
| 3536 | if(pBssDesc) |
| 3537 | { |
| 3538 | csrSetCfgRateSet(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile, pBssDesc, pIes); |
| 3539 | } |
| 3540 | else |
| 3541 | { |
| 3542 | csrSetCfgRateSetFromProfile(pMac, pProfile); |
| 3543 | } |
| 3544 | //Make this the last CFG to set. The callback will trigger a join_req |
| 3545 | //Join time out |
| 3546 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId ); |
| 3547 | |
| 3548 | 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] | 3549 | return (status); |
| 3550 | } |
| 3551 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3552 | eHalStatus csrRoamStopNetwork( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3553 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3554 | { |
| 3555 | eHalStatus status; |
| 3556 | tBssConfigParam *pBssConfig; |
| 3557 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3558 | |
| 3559 | if(!pSession) |
| 3560 | { |
| 3561 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3562 | return eHAL_STATUS_FAILURE; |
| 3563 | } |
| 3564 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3565 | status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); |
| 3566 | if(HAL_STATUS_SUCCESS(status)) |
| 3567 | { |
| 3568 | palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam)); |
| 3569 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, pBssConfig, pIes); |
| 3570 | if(HAL_STATUS_SUCCESS(status)) |
| 3571 | { |
| 3572 | pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3573 | /* This will allow to pass cbMode during join req */ |
| 3574 | pSession->bssParams.cbMode= pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3575 | //For IBSS, we need to prepare some more information |
| 3576 | if( csrIsBssTypeIBSS(pProfile->BSSType) || CSR_IS_WDS( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3577 | || CSR_IS_INFRA_AP(pProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3578 | ) |
| 3579 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3580 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3581 | } |
| 3582 | // If we are in an IBSS, then stop the IBSS... |
| 3583 | ////Not worry about WDS connection for now |
| 3584 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 3585 | { |
| 3586 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 3587 | } |
| 3588 | else |
| 3589 | { |
| 3590 | // if we are in an Infrastructure association.... |
| 3591 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 3592 | { |
| 3593 | // and the new Bss is an Ibss OR we are roaming from Infra to Infra |
| 3594 | // across SSIDs (roaming to a new SSID)... // |
| 3595 | //Not worry about WDS connection for now |
| 3596 | if ( pBssDesc && ( ( csrIsIbssBssDesc( pBssDesc ) ) || |
| 3597 | !csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIes ) ) ) |
| 3598 | { |
| 3599 | // then we need to disassociate from the Infrastructure network... |
| 3600 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 3601 | } |
| 3602 | else |
| 3603 | { |
| 3604 | // In an Infrastucture and going to an Infrastructure network with the same SSID. This |
| 3605 | // calls for a Reassociation sequence. So issue the CFG sets for this new AP. |
| 3606 | if ( pBssDesc ) |
| 3607 | { |
| 3608 | // Set parameters for this Bss. |
| 3609 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
| 3610 | } |
| 3611 | } |
| 3612 | } |
| 3613 | else |
| 3614 | { |
| 3615 | // Neiher in IBSS nor in Infra. We can go ahead and set the CFG for tne new network... |
| 3616 | // Nothing to stop. |
| 3617 | if ( pBssDesc || CSR_IS_WDS_AP( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3618 | || CSR_IS_INFRA_AP(pProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3619 | ) |
| 3620 | { |
| 3621 | // Set parameters for this Bss. |
| 3622 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
| 3623 | } |
| 3624 | } |
| 3625 | } |
| 3626 | }//Success getting BSS config info |
| 3627 | palFreeMemory(pMac->hHdd, pBssConfig); |
| 3628 | }//Allocate memory |
| 3629 | |
| 3630 | return (status); |
| 3631 | } |
| 3632 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3633 | eCsrJoinState csrRoamJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3634 | tCsrScanResultInfo *pScanResult, tCsrRoamProfile *pProfile ) |
| 3635 | { |
| 3636 | eCsrJoinState eRoamState = eCsrContinueRoaming; |
| 3637 | eHalStatus status; |
| 3638 | tSirBssDescription *pBssDesc = &pScanResult->BssDescriptor; |
| 3639 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)( pScanResult->pvIes ); //This may be NULL |
| 3640 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3641 | |
| 3642 | if(!pSession) |
| 3643 | { |
| 3644 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3645 | return (eCsrStopRoaming); |
| 3646 | } |
| 3647 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3648 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 3649 | { |
| 3650 | status = csrRoamStartWds( pMac, sessionId, pProfile, pBssDesc ); |
| 3651 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 3652 | { |
| 3653 | eRoamState = eCsrStopRoaming; |
| 3654 | } |
| 3655 | } |
| 3656 | else |
| 3657 | { |
| 3658 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 3659 | { |
| 3660 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
| 3661 | return (eCsrStopRoaming); |
| 3662 | } |
| 3663 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 3664 | { |
| 3665 | // If we are connected in infrastructure mode and the Join Bss description is for the same BssID, then we are |
| 3666 | // attempting to join the AP we are already connected with. In that case, see if the Bss or Sta capabilities |
| 3667 | // have changed and handle the changes (without disturbing the current association). |
| 3668 | |
| 3669 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && |
| 3670 | csrIsBssIdEqual( pMac, pBssDesc, pSession->pConnectBssDesc ) && |
| 3671 | csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIesLocal ) |
| 3672 | ) |
| 3673 | { |
| 3674 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 3675 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 3676 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 3677 | // a new Association. |
| 3678 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 3679 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3680 | 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] | 3681 | if(csrRoamIsSameProfileKeys(pMac, &pSession->connectedProfile, pProfile)) |
| 3682 | { |
| 3683 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 3684 | } |
| 3685 | else |
| 3686 | { |
| 3687 | tBssConfigParam bssConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3688 | //The key changes |
| 3689 | palZeroMemory(pMac->hHdd, &bssConfig, sizeof(bssConfig)); |
| 3690 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 3691 | if(HAL_STATUS_SUCCESS(status)) |
| 3692 | { |
| 3693 | pSession->bssParams.uCfgDot11Mode = bssConfig.uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3694 | pSession->bssParams.cbMode = bssConfig.cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3695 | //Reapply the config including Keys so reassoc is happening. |
| 3696 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 3697 | if(!HAL_STATUS_SUCCESS(status)) |
| 3698 | { |
| 3699 | eRoamState = eCsrStopRoaming; |
| 3700 | } |
| 3701 | } |
| 3702 | else |
| 3703 | { |
| 3704 | eRoamState = eCsrStopRoaming; |
| 3705 | } |
| 3706 | }//same profile |
| 3707 | } |
| 3708 | else |
| 3709 | { |
| 3710 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, sessionId, |
| 3711 | eCSR_ROAM_SUBSTATE_DISASSOC_REQ, FALSE ))) |
| 3712 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3713 | smsLog(pMac, LOGW, FL(" fail to issue disassociate")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3714 | eRoamState = eCsrStopRoaming; |
| 3715 | } |
| 3716 | } |
| 3717 | } |
| 3718 | else |
| 3719 | { |
| 3720 | // note: we used to pre-auth here with open authentication networks but that was not working so well. |
| 3721 | // we had a lot of join timeouts when testing at Samsung. removing this step helped associations |
| 3722 | // work much better. |
| 3723 | // |
| 3724 | // |
| 3725 | // stop the existing network before attempting to join the new network... |
| 3726 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 3727 | { |
| 3728 | eRoamState = eCsrStopRoaming; |
| 3729 | } |
| 3730 | } |
| 3731 | }//Infra |
| 3732 | else |
| 3733 | { |
| 3734 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 3735 | { |
| 3736 | eRoamState = eCsrStopRoaming; |
| 3737 | } |
| 3738 | } |
| 3739 | if( pIesLocal && !pScanResult->pvIes ) |
| 3740 | { |
| 3741 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 3742 | } |
| 3743 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3744 | return( eRoamState ); |
| 3745 | } |
| 3746 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3747 | eHalStatus csrRoamShouldRoam(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3748 | tSirBssDescription *pBssDesc, tANI_U32 roamId) |
| 3749 | { |
| 3750 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3751 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3752 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 3753 | roamInfo.pBssDesc = pBssDesc; |
| 3754 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, roamId, eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE); |
| 3755 | return (status); |
| 3756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3757 | //In case no matching BSS is found, use whatever default we can find |
| 3758 | static void csrRoamAssignDefaultParam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 3759 | { |
| 3760 | //Need to get all negotiated types in place first |
| 3761 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 3762 | 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] | 3763 | { |
| 3764 | default: |
| 3765 | case eCSR_AUTH_TYPE_WPA: |
| 3766 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 3767 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 3768 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3769 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 3770 | break; |
| 3771 | |
| 3772 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 3773 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 3774 | break; |
| 3775 | |
| 3776 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 3777 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 3778 | break; |
| 3779 | } |
| 3780 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 3781 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 3782 | //In this case, the multicast encryption needs to follow the uncast ones. |
| 3783 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 3784 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 3785 | } |
| 3786 | |
| 3787 | static eCsrJoinState csrRoamJoinNextBss( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fUseSameBss ) |
| 3788 | { |
| 3789 | eHalStatus status; |
| 3790 | tCsrScanResult *pScanResult = NULL; |
| 3791 | eCsrJoinState eRoamState = eCsrStopRoaming; |
| 3792 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 3793 | tANI_BOOLEAN fDone = eANI_BOOLEAN_FALSE; |
| 3794 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 3795 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 3796 | v_U8_t acm_mask = 0; |
| 3797 | #endif |
| 3798 | tANI_U32 sessionId = pCommand->sessionId; |
| 3799 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 3800 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 3801 | tANI_U8 concurrentChannel = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3802 | |
| 3803 | if(!pSession) |
| 3804 | { |
| 3805 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3806 | return (eCsrStopRoaming); |
| 3807 | } |
| 3808 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3809 | do |
| 3810 | { |
| 3811 | // Check for Cardbus eject condition, before trying to Roam to any BSS |
| 3812 | //***if( !balIsCardPresent(pAdapter) ) break; |
| 3813 | |
| 3814 | if(NULL != pBSSList) |
| 3815 | { |
| 3816 | // When handling AP's capability change, continue to associate to |
| 3817 | // same BSS and make sure pRoamBssEntry is not Null. |
| 3818 | if((eANI_BOOLEAN_FALSE == fUseSameBss) || (pCommand->u.roamCmd.pRoamBssEntry == NULL)) |
| 3819 | { |
| 3820 | if(pCommand->u.roamCmd.pRoamBssEntry == NULL) |
| 3821 | { |
| 3822 | //Try the first BSS |
| 3823 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 3824 | pCommand->u.roamCmd.pRoamBssEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 3825 | } |
| 3826 | else |
| 3827 | { |
| 3828 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 3829 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 3830 | { |
| 3831 | //Done with all the BSSs |
| 3832 | //In this case, will tell HDD the completion |
| 3833 | break; |
| 3834 | } |
| 3835 | else |
| 3836 | { |
| 3837 | //We need to indicate to HDD that we are done with this one. |
| 3838 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 3839 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; //this shall not be NULL |
| 3840 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 3841 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 3842 | pRoamInfo = &roamInfo; |
| 3843 | } |
| 3844 | } |
| 3845 | while(pCommand->u.roamCmd.pRoamBssEntry) |
| 3846 | { |
| 3847 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3848 | /*If concurrency enabled take the concurrent connected channel first. */ |
| 3849 | /* Valid multichannel concurrent sessions exempted */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3850 | if (vos_concurrent_sessions_running() && |
| 3851 | !csrIsValidMcConcurrentSession(pMac, sessionId, &pScanResult->Result.BssDescriptor)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3852 | { |
| 3853 | concurrentChannel = |
| 3854 | csrGetConcurrentOperationChannel(pMac); |
| 3855 | 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] | 3856 | " csr Concurrent Channel = %d", __func__, concurrentChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3857 | if ((concurrentChannel) && |
| 3858 | (concurrentChannel == |
| 3859 | pScanResult->Result.BssDescriptor.channelId)) |
| 3860 | { |
| 3861 | //make this 0 because we do not want the |
| 3862 | //below check to pass as we don't want to |
| 3863 | //connect on other channel |
| 3864 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 3865 | FL("Concurrent channel match =%d"), |
| 3866 | concurrentChannel); |
| 3867 | concurrentChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3868 | } |
| 3869 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3870 | |
| 3871 | if (!concurrentChannel) |
| 3872 | { |
| 3873 | |
| 3874 | if(HAL_STATUS_SUCCESS(csrRoamShouldRoam(pMac, |
| 3875 | sessionId, &pScanResult->Result.BssDescriptor, |
| 3876 | pCommand->u.roamCmd.roamId))) |
| 3877 | { |
| 3878 | //Ok to roam this |
| 3879 | break; |
| 3880 | } |
| 3881 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3882 | else |
| 3883 | { |
| 3884 | eRoamState = eCsrStopRoamingDueToConcurrency; |
| 3885 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3886 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 3887 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 3888 | { |
| 3889 | //Done with all the BSSs |
| 3890 | fDone = eANI_BOOLEAN_TRUE; |
| 3891 | break; |
| 3892 | } |
| 3893 | } |
| 3894 | if(fDone) |
| 3895 | { |
| 3896 | break; |
| 3897 | } |
| 3898 | } |
| 3899 | } |
| 3900 | //We have something to roam, tell HDD when it is infra. |
| 3901 | //For IBSS, the indication goes back to HDD via eCSR_ROAM_IBSS_IND |
| 3902 | //For WDS, the indication is eCSR_ROAM_WDS_IND |
| 3903 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 3904 | { |
| 3905 | if(pRoamInfo) |
| 3906 | { |
| 3907 | pSession->bRefAssocStartCnt--; |
| 3908 | //Complete the last association attemp because a new one is about to be tried |
| 3909 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 3910 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 3911 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 3912 | } |
| 3913 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 3914 | if(pScanResult) |
| 3915 | { |
| 3916 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3917 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->Result.BssDescriptor, &pIesLocal))) ) |
| 3918 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3919 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3920 | fDone = eANI_BOOLEAN_TRUE; |
| 3921 | eRoamState = eCsrStopRoaming; |
| 3922 | break; |
| 3923 | } |
| 3924 | roamInfo.pBssDesc = &pScanResult->Result.BssDescriptor; |
| 3925 | pCommand->u.roamCmd.pLastRoamBss = roamInfo.pBssDesc; |
| 3926 | //No need to put uapsd_mask in if the BSS doesn't support uAPSD |
| 3927 | if( pCommand->u.roamCmd.roamProfile.uapsd_mask && |
| 3928 | CSR_IS_QOS_BSS(pIesLocal) && |
| 3929 | CSR_IS_UAPSD_BSS(pIesLocal) ) |
| 3930 | { |
| 3931 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3932 | acm_mask = sme_QosGetACMMask(pMac, &pScanResult->Result.BssDescriptor, |
| 3933 | pIesLocal); |
| 3934 | pCommand->u.roamCmd.roamProfile.uapsd_mask &= ~(acm_mask); |
| 3935 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3936 | } |
| 3937 | else |
| 3938 | { |
| 3939 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 3940 | } |
| 3941 | if( pIesLocal && !pScanResult->Result.pvIes) |
| 3942 | { |
| 3943 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 3944 | } |
| 3945 | } |
| 3946 | else |
| 3947 | { |
| 3948 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 3949 | } |
| 3950 | roamInfo.pProfile = pProfile; |
| 3951 | pSession->bRefAssocStartCnt++; |
| 3952 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 3953 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 3954 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3955 | if ( NULL == pCommand->u.roamCmd.pRoamBssEntry ) |
| 3956 | { |
| 3957 | // If this is a start IBSS profile, then we need to start the IBSS. |
| 3958 | if ( CSR_IS_START_IBSS(pProfile) ) |
| 3959 | { |
| 3960 | tANI_BOOLEAN fSameIbss = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3961 | // Attempt to start this IBSS... |
| 3962 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 3963 | status = csrRoamStartIbss( pMac, sessionId, pProfile, &fSameIbss ); |
| 3964 | if(HAL_STATUS_SUCCESS(status)) |
| 3965 | { |
| 3966 | if ( fSameIbss ) |
| 3967 | { |
| 3968 | eRoamState = eCsrStartIbssSameIbss; |
| 3969 | } |
| 3970 | else |
| 3971 | { |
| 3972 | eRoamState = eCsrContinueRoaming; |
| 3973 | } |
| 3974 | } |
| 3975 | else |
| 3976 | { |
| 3977 | //it somehow fail need to stop |
| 3978 | eRoamState = eCsrStopRoaming; |
| 3979 | } |
| 3980 | break; |
| 3981 | } |
| 3982 | else if ( (CSR_IS_WDS_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3983 | || (CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3984 | ) |
| 3985 | { |
| 3986 | // Attempt to start this WDS... |
| 3987 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 3988 | /* For AP WDS, we dont have any BSSDescription */ |
| 3989 | status = csrRoamStartWds( pMac, sessionId, pProfile, NULL ); |
| 3990 | if(HAL_STATUS_SUCCESS(status)) |
| 3991 | { |
| 3992 | eRoamState = eCsrContinueRoaming; |
| 3993 | } |
| 3994 | else |
| 3995 | { |
| 3996 | //it somehow fail need to stop |
| 3997 | eRoamState = eCsrStopRoaming; |
| 3998 | } |
| 3999 | } |
| 4000 | else |
| 4001 | { |
| 4002 | //Nothing we can do |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4003 | smsLog(pMac, LOGW, FL("cannot continue without BSS list")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4004 | eRoamState = eCsrStopRoaming; |
| 4005 | break; |
| 4006 | } |
| 4007 | } |
| 4008 | else //We have BSS |
| 4009 | { |
| 4010 | //Need to assign these value because they are used in csrIsSameProfile |
| 4011 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4012 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = pScanResult->ucEncryptionType; //Negotiated while building scan result. |
| 4013 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = pScanResult->mcEncryptionType; |
| 4014 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = pScanResult->authType; |
| 4015 | if ( CSR_IS_START_IBSS(&pCommand->u.roamCmd.roamProfile) ) |
| 4016 | { |
| 4017 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 4018 | { |
| 4019 | eRoamState = eCsrStartIbssSameIbss; |
| 4020 | break; |
| 4021 | } |
| 4022 | } |
| 4023 | if( pCommand->u.roamCmd.fReassocToSelfNoCapChange ) |
| 4024 | { |
| 4025 | //trying to connect to the one already connected |
| 4026 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_FALSE; |
| 4027 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 4028 | break; |
| 4029 | } |
| 4030 | // Attempt to Join this Bss... |
| 4031 | eRoamState = csrRoamJoin( pMac, sessionId, &pScanResult->Result, pProfile ); |
| 4032 | break; |
| 4033 | } |
| 4034 | |
| 4035 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4036 | if( (eCsrStopRoaming == eRoamState) && (CSR_IS_INFRASTRUCTURE( pProfile )) ) |
| 4037 | { |
| 4038 | //Need to indicate association_completion if association_start has been done |
| 4039 | if(pSession->bRefAssocStartCnt > 0) |
| 4040 | { |
| 4041 | pSession->bRefAssocStartCnt--; |
| 4042 | //Complete the last association attemp because a new one is about to be tried |
| 4043 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4044 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 4045 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 4046 | } |
| 4047 | } |
| 4048 | |
| 4049 | return( eRoamState ); |
| 4050 | } |
| 4051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4052 | static eHalStatus csrRoam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4053 | { |
| 4054 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4055 | eCsrJoinState RoamState; |
| 4056 | tANI_U32 sessionId = pCommand->sessionId; |
| 4057 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4058 | //***if( hddIsRadioStateOn( pAdapter ) ) |
| 4059 | { |
| 4060 | // Attept to join a Bss... |
| 4061 | RoamState = csrRoamJoinNextBss( pMac, pCommand, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4062 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4063 | // if nothing to join.. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4064 | if (( eCsrStopRoaming == RoamState ) || ( eCsrStopRoamingDueToConcurrency == RoamState)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4065 | { |
| 4066 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4067 | // and if connected in Infrastructure mode... |
| 4068 | if ( csrIsConnStateInfra(pMac, sessionId) ) |
| 4069 | { |
| 4070 | //... then we need to issue a disassociation |
| 4071 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, FALSE ); |
| 4072 | if(!HAL_STATUS_SUCCESS(status)) |
| 4073 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4074 | smsLog(pMac, LOGW, FL(" failed to issue disassociate, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4075 | //roam command is completed by caller in the failed case |
| 4076 | fComplete = eANI_BOOLEAN_TRUE; |
| 4077 | } |
| 4078 | } |
| 4079 | else if( csrIsConnStateIbss(pMac, sessionId) ) |
| 4080 | { |
| 4081 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4082 | if(!HAL_STATUS_SUCCESS(status)) |
| 4083 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4084 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4085 | //roam command is completed by caller in the failed case |
| 4086 | fComplete = eANI_BOOLEAN_TRUE; |
| 4087 | } |
| 4088 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4089 | else if (csrIsConnStateConnectedInfraAp(pMac, sessionId)) |
| 4090 | { |
| 4091 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4092 | if(!HAL_STATUS_SUCCESS(status)) |
| 4093 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4094 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4095 | //roam command is completed by caller in the failed case |
| 4096 | fComplete = eANI_BOOLEAN_TRUE; |
| 4097 | } |
| 4098 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4099 | else |
| 4100 | { |
| 4101 | fComplete = eANI_BOOLEAN_TRUE; |
| 4102 | } |
| 4103 | if(fComplete) |
| 4104 | { |
| 4105 | // ... otherwise, we can complete the Roam command here. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4106 | if(eCsrStopRoamingDueToConcurrency == RoamState) |
| 4107 | { |
| 4108 | csrRoamComplete( pMac, eCsrJoinFailureDueToConcurrency, NULL ); |
| 4109 | } |
| 4110 | else |
| 4111 | { |
| 4112 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 4113 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4114 | } |
| 4115 | } |
| 4116 | else if ( eCsrReassocToSelfNoCapChange == RoamState ) |
| 4117 | { |
| 4118 | csrRoamComplete( pMac, eCsrSilentlyStopRoamingSaveState, NULL ); |
| 4119 | } |
| 4120 | else if ( eCsrStartIbssSameIbss == RoamState ) |
| 4121 | { |
| 4122 | csrRoamComplete( pMac, eCsrSilentlyStopRoaming, NULL ); |
| 4123 | } |
| 4124 | }//hddIsRadioStateOn |
| 4125 | |
| 4126 | return status; |
| 4127 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4128 | eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4129 | { |
| 4130 | tANI_U32 sessionId; |
| 4131 | tCsrRoamSession *pSession; |
| 4132 | tCsrScanResult *pScanResult = NULL; |
| 4133 | tSirBssDescription *pBssDesc = NULL; |
| 4134 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4135 | sessionId = pCommand->sessionId; |
| 4136 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4137 | |
| 4138 | if(!pSession) |
| 4139 | { |
| 4140 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4141 | return eHAL_STATUS_FAILURE; |
| 4142 | } |
| 4143 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4144 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 4145 | { |
| 4146 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4147 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4148 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4149 | return eHAL_STATUS_FAILURE; |
| 4150 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4151 | if (pCommand->u.roamCmd.pRoamBssEntry) |
| 4152 | { |
| 4153 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4154 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4155 | } |
| 4156 | else |
| 4157 | { |
| 4158 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4159 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4160 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4161 | return eHAL_STATUS_FAILURE; |
| 4162 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4163 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 4164 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 4165 | return status; |
| 4166 | } |
| 4167 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4168 | eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4169 | { |
| 4170 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4171 | tCsrRoamInfo roamInfo; |
| 4172 | tANI_U32 sessionId = pCommand->sessionId; |
| 4173 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4174 | |
| 4175 | if(!pSession) |
| 4176 | { |
| 4177 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4178 | return eHAL_STATUS_FAILURE; |
| 4179 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4180 | |
| 4181 | switch ( pCommand->u.roamCmd.roamReason ) |
| 4182 | { |
| 4183 | case eCsrForcedDisassoc: |
| 4184 | csrFreeRoamProfile(pMac, sessionId); |
| 4185 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 4186 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4187 | case eCsrSmeIssuedDisassocForHandoff: |
| 4188 | //Not to free pMac->roam.pCurRoamProfile (via csrFreeRoamProfile) because it is needed after disconnect |
| 4189 | #if 0 // TODO : Confirm this change |
| 4190 | status = csrRoamProcessDisassociate( pMac, pCommand, FALSE ); |
| 4191 | #else |
| 4192 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 4193 | #endif |
| 4194 | |
| 4195 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4196 | case eCsrForcedDisassocMICFailure: |
| 4197 | csrFreeRoamProfile(pMac, sessionId); |
| 4198 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, TRUE ); |
| 4199 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4200 | case eCsrForcedDeauth: |
| 4201 | csrFreeRoamProfile(pMac, sessionId); |
| 4202 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, FALSE, FALSE ); |
| 4203 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4204 | case eCsrHddIssuedReassocToSameAP: |
| 4205 | case eCsrSmeIssuedReassocToSameAP: |
| 4206 | { |
| 4207 | tDot11fBeaconIEs *pIes = NULL; |
| 4208 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4209 | if( pSession->pConnectBssDesc ) |
| 4210 | { |
| 4211 | status = csrGetParsedBssDescriptionIEs(pMac, pSession->pConnectBssDesc, &pIes); |
| 4212 | if(!HAL_STATUS_SUCCESS(status) ) |
| 4213 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4214 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4215 | } |
| 4216 | else |
| 4217 | { |
| 4218 | roamInfo.reasonCode = eCsrRoamReasonStaCapabilityChanged; |
| 4219 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
| 4220 | pSession->roamingReason = eCsrReassocRoaming; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4221 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 4222 | roamInfo.pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4223 | pSession->bRefAssocStartCnt++; |
| 4224 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4225 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4226 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4227 | smsLog(pMac, LOG1, FL(" calling csrRoamIssueReassociate")); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4228 | status = csrRoamIssueReassociate( pMac, sessionId, pSession->pConnectBssDesc, pIes, |
| 4229 | &pCommand->u.roamCmd.roamProfile ); |
| 4230 | if(!HAL_STATUS_SUCCESS(status)) |
| 4231 | { |
| 4232 | smsLog(pMac, LOGE, FL("csrRoamIssueReassociate failed with status %d"), status); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 4233 | csrReleaseCommandRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4234 | } |
| 4235 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4236 | palFreeMemory(pMac->hHdd, pIes); |
| 4237 | pIes = NULL; |
| 4238 | } |
| 4239 | } |
| 4240 | break; |
| 4241 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4242 | case eCsrCapsChange: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4243 | smsLog(pMac, LOGE, FL("received eCsrCapsChange ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4244 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4245 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE); |
| 4246 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4247 | case eCsrSmeIssuedFTReassoc: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4248 | smsLog(pMac, LOGE, FL("received FT Reassoc Req ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4249 | status = csrProcessFTReassocRoamCommand(pMac, pCommand); |
| 4250 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4251 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4252 | case eCsrStopBss: |
| 4253 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4254 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4255 | break; |
| 4256 | |
| 4257 | case eCsrForcedDisassocSta: |
| 4258 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4259 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId); |
| 4260 | status = csrSendMBDisassocReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4261 | pCommand->u.roamCmd.reason); |
| 4262 | break; |
| 4263 | |
| 4264 | case eCsrForcedDeauthSta: |
| 4265 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4266 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId); |
| 4267 | status = csrSendMBDeauthReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4268 | pCommand->u.roamCmd.reason); |
| 4269 | break; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4270 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4271 | case eCsrPerformPreauth: |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 4272 | smsLog(pMac, LOG1, FL("Attempting FT PreAuth Req")); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4273 | status = csrRoamIssueFTPreauthReq(pMac, sessionId, |
| 4274 | pCommand->u.roamCmd.pLastRoamBss); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4275 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4276 | |
| 4277 | default: |
| 4278 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4279 | |
| 4280 | if( pCommand->u.roamCmd.fUpdateCurRoamProfile ) |
| 4281 | { |
| 4282 | //Remember the roaming profile |
| 4283 | csrFreeRoamProfile(pMac, sessionId); |
| 4284 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)))) |
| 4285 | { |
| 4286 | palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 4287 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, &pCommand->u.roamCmd.roamProfile); |
| 4288 | } |
| 4289 | } |
| 4290 | |
| 4291 | //At this point, original uapsd_mask is saved in pCurRoamProfile |
| 4292 | //uapsd_mask in the pCommand may change from this point on. |
| 4293 | |
| 4294 | // Attempt to roam with the new scan results (if we need to..) |
| 4295 | status = csrRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4296 | if(!HAL_STATUS_SUCCESS(status)) |
| 4297 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4298 | smsLog(pMac, LOGW, FL("csrRoam() failed with status = 0x%08X"), status); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4299 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4300 | break; |
| 4301 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4302 | return (status); |
| 4303 | } |
| 4304 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4305 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4306 | { |
| 4307 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4308 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4309 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
| 4310 | palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd)); |
| 4311 | } |
| 4312 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4313 | void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4314 | { |
| 4315 | if(pCommand->u.roamCmd.fReleaseBssList) |
| 4316 | { |
| 4317 | csrScanResultPurge(pMac, pCommand->u.roamCmd.hBSSList); |
| 4318 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 4319 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 4320 | } |
| 4321 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 4322 | { |
| 4323 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 4324 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 4325 | } |
| 4326 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4327 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
| 4328 | palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd)); |
| 4329 | } |
| 4330 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4331 | void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4332 | { |
| 4333 | palZeroMemory(pMac->hHdd, &pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd)); |
| 4334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4335 | void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context ) |
| 4336 | { |
| 4337 | tListElem *pEntry; |
| 4338 | tSmeCmd *pCommand; |
| 4339 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4340 | smsLog( pMac, LOG2, "Roam Completion ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4341 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 4342 | if ( pEntry ) |
| 4343 | { |
| 4344 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4345 | // If the head of the queue is Active and it is a ROAM command, remove |
| 4346 | // and put this on the Free queue. |
| 4347 | if ( eSmeCommandRoam == pCommand->command ) |
| 4348 | { |
| 4349 | //we need to process the result first before removing it from active list because state changes |
| 4350 | //still happening insides roamQProcessRoamResults so no other roam command should be issued |
| 4351 | fReleaseCommand = csrRoamProcessResults( pMac, pCommand, Result, Context ); |
| 4352 | if( fReleaseCommand ) |
| 4353 | { |
| 4354 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 4355 | { |
| 4356 | csrReleaseCommandRoam( pMac, pCommand ); |
| 4357 | } |
| 4358 | else |
| 4359 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4360 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4361 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4362 | } |
| 4363 | } |
| 4364 | else |
| 4365 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4366 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4367 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4368 | } |
| 4369 | } |
| 4370 | else |
| 4371 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4372 | 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] | 4373 | } |
| 4374 | } |
| 4375 | else |
| 4376 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4377 | smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4378 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4379 | if( fReleaseCommand ) |
| 4380 | { |
| 4381 | smeProcessPendingQueue( pMac ); |
| 4382 | } |
| 4383 | } |
| 4384 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4385 | void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4386 | { |
| 4387 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4388 | if(!pSession) |
| 4389 | { |
| 4390 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4391 | return; |
| 4392 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4393 | palZeroMemory( pMac->hHdd, &(pSession->PmkidCandidateInfo[0]), sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED ); |
| 4394 | pSession->NumPmkidCandidate = 0; |
| 4395 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4396 | #ifdef FEATURE_WLAN_WAPI |
| 4397 | void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4398 | { |
| 4399 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4400 | if(!pSession) |
| 4401 | { |
| 4402 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4403 | return; |
| 4404 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4405 | palZeroMemory( pMac->hHdd, &(pSession->BkidCandidateInfo[0]), sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED ); |
| 4406 | pSession->NumBkidCandidate = 0; |
| 4407 | } |
| 4408 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4409 | extern tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ]; |
| 4410 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4411 | static eHalStatus csrRoamSaveSecurityRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrAuthType authType, |
| 4412 | tSirBssDescription *pSirBssDesc, |
| 4413 | tDot11fBeaconIEs *pIes) |
| 4414 | { |
| 4415 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4416 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4417 | tDot11fBeaconIEs *pIesLocal = pIes; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4418 | |
| 4419 | if(!pSession) |
| 4420 | { |
| 4421 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4422 | return eHAL_STATUS_FAILURE; |
| 4423 | } |
| 4424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4425 | if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4426 | (eCSR_AUTH_TYPE_WPA_PSK == authType) || |
| 4427 | (eCSR_AUTH_TYPE_RSN == authType) || |
| 4428 | (eCSR_AUTH_TYPE_RSN_PSK == authType) |
| 4429 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4430 | || |
| 4431 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4432 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) |
| 4433 | #endif /* FEATURE_WLAN_WAPI */ |
| 4434 | #ifdef FEATURE_WLAN_WAPI |
| 4435 | || |
| 4436 | (eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4437 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType) |
| 4438 | #endif /* FEATURE_WLAN_WAPI */ |
| 4439 | ) |
| 4440 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4441 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 4442 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4443 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4444 | } |
| 4445 | if( pIesLocal ) |
| 4446 | { |
| 4447 | tANI_U32 nIeLen; |
| 4448 | tANI_U8 *pIeBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4449 | if((eCSR_AUTH_TYPE_RSN == authType) || |
| 4450 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4451 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4452 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) || |
| 4453 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4454 | (eCSR_AUTH_TYPE_RSN_PSK == authType)) |
| 4455 | { |
| 4456 | if(pIesLocal->RSN.present) |
| 4457 | { |
| 4458 | //Calculate the actual length |
| 4459 | nIeLen = 8 //version + gp_cipher_suite + pwise_cipher_suite_count |
| 4460 | + pIesLocal->RSN.pwise_cipher_suite_count * 4 //pwise_cipher_suites |
| 4461 | + 2 //akm_suite_count |
| 4462 | + pIesLocal->RSN.akm_suite_count * 4 //akm_suites |
| 4463 | + 2; //reserved |
| 4464 | if( pIesLocal->RSN.pmkid_count ) |
| 4465 | { |
| 4466 | nIeLen += 2 + pIesLocal->RSN.pmkid_count * 4; //pmkid |
| 4467 | } |
| 4468 | //nIeLen doesn't count EID and length fields |
| 4469 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2)))) |
| 4470 | { |
| 4471 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_RSN; |
| 4472 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4473 | //copy upto akm_suites |
| 4474 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 4475 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.version, 8); |
| 4476 | pIeBuf += 8; |
| 4477 | if( pIesLocal->RSN.pwise_cipher_suite_count ) |
| 4478 | { |
| 4479 | //copy pwise_cipher_suites |
| 4480 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.pwise_cipher_suites, |
| 4481 | pIesLocal->RSN.pwise_cipher_suite_count * 4); |
| 4482 | pIeBuf += pIesLocal->RSN.pwise_cipher_suite_count * 4; |
| 4483 | } |
| 4484 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.akm_suite_count, 2); |
| 4485 | pIeBuf += 2; |
| 4486 | if( pIesLocal->RSN.akm_suite_count ) |
| 4487 | { |
| 4488 | //copy akm_suites |
| 4489 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites, |
| 4490 | pIesLocal->RSN.akm_suite_count * 4); |
| 4491 | pIeBuf += pIesLocal->RSN.akm_suite_count * 4; |
| 4492 | } |
| 4493 | //copy the rest |
| 4494 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites + |
| 4495 | pIesLocal->RSN.akm_suite_count * 4, |
| 4496 | 2 + pIesLocal->RSN.pmkid_count * 4); |
| 4497 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4498 | } |
| 4499 | } |
| 4500 | } |
| 4501 | else if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4502 | (eCSR_AUTH_TYPE_WPA_PSK == authType)) |
| 4503 | { |
| 4504 | if(pIesLocal->WPA.present) |
| 4505 | { |
| 4506 | //Calculate the actual length |
| 4507 | nIeLen = 12 //OUI + version + multicast_cipher + unicast_cipher_count |
| 4508 | + pIesLocal->WPA.unicast_cipher_count * 4 //unicast_ciphers |
| 4509 | + 2 //auth_suite_count |
| 4510 | + pIesLocal->WPA.auth_suite_count * 4; //auth_suites |
| 4511 | // The WPA capabilities follows the Auth Suite (two octects)-- |
| 4512 | // this field is optional, and we always "send" zero, so just |
| 4513 | // remove it. This is consistent with our assumptions in the |
| 4514 | // frames compiler; c.f. bug 15234: |
| 4515 | //nIeLen doesn't count EID and length fields |
| 4516 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2)))) |
| 4517 | { |
| 4518 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_WPA; |
| 4519 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4520 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 4521 | //Copy WPA OUI |
| 4522 | palCopyMemory(pMac->hHdd, pIeBuf, &csrWpaOui[1], 4); |
| 4523 | pIeBuf += 4; |
| 4524 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.version, 8 + |
| 4525 | pIesLocal->WPA.unicast_cipher_count * 4); |
| 4526 | pIeBuf += 8 + pIesLocal->WPA.unicast_cipher_count * 4; |
| 4527 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.auth_suite_count, 2 + |
| 4528 | pIesLocal->WPA.auth_suite_count * 4); |
| 4529 | pIeBuf += pIesLocal->WPA.auth_suite_count * 4; |
| 4530 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4531 | } |
| 4532 | } |
| 4533 | } |
| 4534 | #ifdef FEATURE_WLAN_WAPI |
| 4535 | else if((eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4536 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType)) |
| 4537 | { |
| 4538 | if(pIesLocal->WAPI.present) |
| 4539 | { |
| 4540 | //Calculate the actual length |
| 4541 | nIeLen = 4 //version + akm_suite_count |
| 4542 | + pIesLocal->WAPI.akm_suite_count * 4 // akm_suites |
| 4543 | + 2 //pwise_cipher_suite_count |
| 4544 | + pIesLocal->WAPI.unicast_cipher_suite_count * 4 //pwise_cipher_suites |
| 4545 | + 6; //gp_cipher_suite + preauth + reserved |
| 4546 | if( pIesLocal->WAPI.bkid_count ) |
| 4547 | { |
| 4548 | nIeLen += 2 + pIesLocal->WAPI.bkid_count * 4; //bkid |
| 4549 | } |
| 4550 | |
| 4551 | //nIeLen doesn't count EID and length fields |
| 4552 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiRspIE, nIeLen + 2)))) |
| 4553 | { |
| 4554 | pSession->pWapiRspIE[0] = DOT11F_EID_WAPI; |
| 4555 | pSession->pWapiRspIE[1] = (tANI_U8)nIeLen; |
| 4556 | pIeBuf = pSession->pWapiRspIE + 2; |
| 4557 | //copy upto akm_suite_count |
| 4558 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.version, 4); |
| 4559 | pIeBuf += 4; |
| 4560 | if( pIesLocal->WAPI.akm_suite_count ) |
| 4561 | { |
| 4562 | //copy akm_suites |
| 4563 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.akm_suites, |
| 4564 | pIesLocal->WAPI.akm_suite_count * 4); |
| 4565 | pIeBuf += pIesLocal->WAPI.akm_suite_count * 4; |
| 4566 | } |
| 4567 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.unicast_cipher_suite_count, 2); |
| 4568 | pIeBuf += 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4569 | if( pIesLocal->WAPI.unicast_cipher_suite_count ) |
| 4570 | { |
| 4571 | //copy pwise_cipher_suites |
| 4572 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.unicast_cipher_suites, |
| 4573 | pIesLocal->WAPI.unicast_cipher_suite_count * 4); |
| 4574 | pIeBuf += pIesLocal->WAPI.unicast_cipher_suite_count * 4; |
| 4575 | } |
| 4576 | //gp_cipher_suite + preauth + reserved + bkid_count |
| 4577 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.multicast_cipher_suite, 8); |
| 4578 | pIeBuf += 8; |
| 4579 | if( pIesLocal->WAPI.bkid_count ) |
| 4580 | { |
| 4581 | //copy akm_suites |
| 4582 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.bkid, pIesLocal->WAPI.bkid_count * 4); |
| 4583 | pIeBuf += pIesLocal->WAPI.bkid_count * 4; |
| 4584 | } |
| 4585 | pSession->nWapiRspIeLength = nIeLen + 2; |
| 4586 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4587 | } |
| 4588 | } |
| 4589 | #endif /* FEATURE_WLAN_WAPI */ |
| 4590 | if( !pIes ) |
| 4591 | { |
| 4592 | //locally allocated |
| 4593 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 4594 | } |
| 4595 | } |
| 4596 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4597 | return (status); |
| 4598 | } |
| 4599 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4600 | static void csrCheckAndUpdateACWeight( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIEs ) |
| 4601 | { |
| 4602 | v_U8_t bACWeights[WLANTL_MAX_AC]; |
| 4603 | v_U8_t paramBk, paramBe, paramVi, paramVo; |
| 4604 | v_BOOL_t fWeightChange = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4605 | //Compare two ACs' EDCA parameters, from low to high (BK, BE, VI, VO) |
| 4606 | //The "formula" is, if lower AC's AIFSN+CWMin is bigger than a fixed amount |
| 4607 | //of the higher AC one, make the higher AC has the same weight as the lower AC. |
| 4608 | //This doesn't address the case where the lower AC needs a real higher weight |
| 4609 | if( pIEs->WMMParams.present ) |
| 4610 | { |
| 4611 | //no change to the lowest ones |
| 4612 | bACWeights[WLANTL_AC_BK] = pMac->roam.ucACWeights[WLANTL_AC_BK]; |
| 4613 | bACWeights[WLANTL_AC_BE] = pMac->roam.ucACWeights[WLANTL_AC_BE]; |
| 4614 | bACWeights[WLANTL_AC_VI] = pMac->roam.ucACWeights[WLANTL_AC_VI]; |
| 4615 | bACWeights[WLANTL_AC_VO] = pMac->roam.ucACWeights[WLANTL_AC_VO]; |
| 4616 | paramBk = pIEs->WMMParams.acbk_aifsn + pIEs->WMMParams.acbk_acwmin; |
| 4617 | paramBe = pIEs->WMMParams.acbe_aifsn + pIEs->WMMParams.acbe_acwmin; |
| 4618 | paramVi = pIEs->WMMParams.acvi_aifsn + pIEs->WMMParams.acvi_acwmin; |
| 4619 | paramVo = pIEs->WMMParams.acvo_aifsn + pIEs->WMMParams.acvo_acwmin; |
| 4620 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramBe) ) |
| 4621 | { |
| 4622 | bACWeights[WLANTL_AC_BE] = bACWeights[WLANTL_AC_BK]; |
| 4623 | fWeightChange = VOS_TRUE; |
| 4624 | } |
| 4625 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVi) ) |
| 4626 | { |
| 4627 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BK]; |
| 4628 | fWeightChange = VOS_TRUE; |
| 4629 | } |
| 4630 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVi) ) |
| 4631 | { |
| 4632 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BE]; |
| 4633 | fWeightChange = VOS_TRUE; |
| 4634 | } |
| 4635 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVo) ) |
| 4636 | { |
| 4637 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BK]; |
| 4638 | fWeightChange = VOS_TRUE; |
| 4639 | } |
| 4640 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVo) ) |
| 4641 | { |
| 4642 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BE]; |
| 4643 | fWeightChange = VOS_TRUE; |
| 4644 | } |
| 4645 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramVi, paramVo) ) |
| 4646 | { |
| 4647 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_VI]; |
| 4648 | fWeightChange = VOS_TRUE; |
| 4649 | } |
| 4650 | if(fWeightChange) |
| 4651 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4652 | 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] | 4653 | bACWeights[2], bACWeights[3]); |
| 4654 | WLANTL_SetACWeights(pMac->roam.gVosContext, bACWeights); |
| 4655 | } |
| 4656 | } |
| 4657 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4658 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4659 | //Returns whether the current association is a 11r assoc or not |
| 4660 | tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac) |
| 4661 | { |
| 4662 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4663 | return csrNeighborRoamIs11rAssoc(pMac); |
| 4664 | #else |
| 4665 | return eANI_BOOLEAN_FALSE; |
| 4666 | #endif |
| 4667 | } |
| 4668 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4669 | #ifdef FEATURE_WLAN_CCX |
| 4670 | //Returns whether the current association is a CCX assoc or not |
| 4671 | tANI_BOOLEAN csrRoamIsCCXAssoc(tpAniSirGlobal pMac) |
| 4672 | { |
| 4673 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4674 | return csrNeighborRoamIsCCXAssoc(pMac); |
| 4675 | #else |
| 4676 | return eANI_BOOLEAN_FALSE; |
| 4677 | #endif |
| 4678 | } |
| 4679 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4680 | #ifdef FEATURE_WLAN_LFR |
| 4681 | //Returns whether "Legacy Fast Roaming" is currently enabled...or not |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4682 | tANI_BOOLEAN csrRoamIsFastRoamEnabled(tpAniSirGlobal pMac, tANI_U32 sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4683 | { |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4684 | tCsrRoamSession *pSession = NULL; |
| 4685 | |
| 4686 | if (CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 4687 | { |
| 4688 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4689 | if (NULL != pSession->pCurRoamProfile) |
| 4690 | { |
| 4691 | if (pSession->pCurRoamProfile->csrPersona != VOS_STA_MODE) |
| 4692 | { |
| 4693 | return eANI_BOOLEAN_FALSE; |
| 4694 | } |
| 4695 | } |
| 4696 | } |
| 4697 | |
Madan Mohan Koyyalamudi | 9ce36ec | 2012-10-15 16:03:17 -0700 | [diff] [blame] | 4698 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled && |
Madan Mohan Koyyalamudi | 393a434 | 2012-10-15 16:07:09 -0700 | [diff] [blame] | 4699 | (!csrIsConcurrentSessionRunning(pMac))); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4700 | } |
| 4701 | #endif |
| 4702 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4703 | //Return true means the command can be release, else not |
| 4704 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 4705 | eCsrRoamCompleteResult Result, void *Context ) |
| 4706 | { |
| 4707 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
| 4708 | tSirBssDescription *pSirBssDesc = NULL; |
| 4709 | tSirMacAddr BroadcastMac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 4710 | tCsrScanResult *pScanResult = NULL; |
| 4711 | tCsrRoamInfo roamInfo; |
| 4712 | sme_QosAssocInfo assocInfo; |
| 4713 | sme_QosCsrEventIndType ind_qos;//indication for QoS module in SME |
| 4714 | tANI_U8 acm_mask = 0; //HDD needs the ACM mask in the assoc rsp callback |
| 4715 | tDot11fBeaconIEs *pIes = NULL; |
| 4716 | tANI_U32 sessionId = pCommand->sessionId; |
| 4717 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4718 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4719 | eRoamCmdStatus roamStatus; |
| 4720 | eCsrRoamResult roamResult; |
| 4721 | eHalStatus status; |
| 4722 | tANI_U32 key_timeout_interval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4723 | tSirSmeStartBssRsp *pSmeStartBssRsp = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4724 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4725 | if(!pSession) |
| 4726 | { |
| 4727 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4728 | return eANI_BOOLEAN_FALSE; |
| 4729 | } |
| 4730 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4731 | smsLog( pMac, LOG1, FL("Processing ROAM results...")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4732 | switch( Result ) |
| 4733 | { |
| 4734 | case eCsrJoinSuccess: |
| 4735 | // reset the IDLE timer |
| 4736 | // !! |
| 4737 | // !! fall through to the next CASE statement here is intentional !! |
| 4738 | // !! |
| 4739 | case eCsrReassocSuccess: |
| 4740 | if(eCsrReassocSuccess == Result) |
| 4741 | { |
| 4742 | ind_qos = SME_QOS_CSR_REASSOC_COMPLETE; |
| 4743 | } |
| 4744 | else |
| 4745 | { |
| 4746 | ind_qos = SME_QOS_CSR_ASSOC_COMPLETE; |
| 4747 | } |
| 4748 | // Success Join Response from LIM. Tell NDIS we are connected and save the |
| 4749 | // Connected state... |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4750 | smsLog(pMac, LOGW, FL("receives association indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4751 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 4752 | //always free the memory here |
| 4753 | if(pSession->pWpaRsnRspIE) |
| 4754 | { |
| 4755 | pSession->nWpaRsnRspIeLength = 0; |
| 4756 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE); |
| 4757 | pSession->pWpaRsnRspIE = NULL; |
| 4758 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4759 | #ifdef FEATURE_WLAN_WAPI |
| 4760 | if(pSession->pWapiRspIE) |
| 4761 | { |
| 4762 | pSession->nWapiRspIeLength = 0; |
| 4763 | palFreeMemory(pMac->hHdd, pSession->pWapiRspIE); |
| 4764 | pSession->pWapiRspIE = NULL; |
| 4765 | } |
| 4766 | #endif /* FEATURE_WLAN_WAPI */ |
| 4767 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 4768 | //Reset counter so no join retry is needed. |
| 4769 | pSession->maxRetryCount = 0; |
| 4770 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 4771 | #endif |
| 4772 | /* This creates problem since we have not saved the connected profile. |
| 4773 | So moving this after saving the profile |
| 4774 | */ |
| 4775 | //csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED ); |
| 4776 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 4777 | { |
| 4778 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
| 4779 | } |
| 4780 | else |
| 4781 | { |
| 4782 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED; |
| 4783 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4784 | //Use the last connected bssdesc for reassoc-ing to the same AP. |
| 4785 | //NOTE: What to do when reassoc to a different AP??? |
| 4786 | if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) || |
| 4787 | (eCsrSmeIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ) |
| 4788 | { |
| 4789 | pSirBssDesc = pSession->pConnectBssDesc; |
| 4790 | if(pSirBssDesc) |
| 4791 | { |
| 4792 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 4793 | } |
| 4794 | } |
| 4795 | else |
| 4796 | { |
| 4797 | |
| 4798 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 4799 | { |
| 4800 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4801 | if(pScanResult != NULL) |
| 4802 | { |
| 4803 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 4804 | //this can be NULL |
| 4805 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 4806 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 4807 | } |
| 4808 | } |
| 4809 | } |
| 4810 | if( pSirBssDesc ) |
| 4811 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4812 | roamInfo.staId = HAL_STA_INVALID_IDX; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4813 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 4814 | //Save WPA/RSN IE |
| 4815 | csrRoamSaveSecurityRspIE(pMac, sessionId, pProfile->negotiatedAuthType, pSirBssDesc, pIes); |
| 4816 | #ifdef FEATURE_WLAN_CCX |
| 4817 | roamInfo.isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
| 4818 | #endif |
| 4819 | |
| 4820 | // csrRoamStateChange also affects sub-state. Hence, csrRoamStateChange happens first and then |
| 4821 | // substate change. |
| 4822 | // Moving even save profile above so that below mentioned conditon is also met. |
| 4823 | // JEZ100225: Moved to after saving the profile. Fix needed in main/latest |
| 4824 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4825 | // Make sure the Set Context is issued before link indication to NDIS. After link indication is |
| 4826 | // made to NDIS, frames could start flowing. If we have not set context with LIM, the frames |
| 4827 | // will be dropped for the security context may not be set properly. |
| 4828 | // |
| 4829 | // this was causing issues in the 2c_wlan_wep WHQL test when the SetContext was issued after the link |
| 4830 | // indication. (Link Indication happens in the profFSMSetConnectedInfra call). |
| 4831 | // |
| 4832 | // this reordering was done on titan_prod_usb branch and is being replicated here. |
| 4833 | // |
| 4834 | |
| 4835 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && |
| 4836 | !pProfile->bWPSAssociation) |
| 4837 | { |
| 4838 | // Issue the set Context request to LIM to establish the Unicast STA context |
| 4839 | if( !HAL_STATUS_SUCCESS( csrRoamIssueSetContextReq( pMac, sessionId, |
| 4840 | pProfile->negotiatedUCEncryptionType, |
| 4841 | pSirBssDesc, &(pSirBssDesc->bssId), |
| 4842 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ) ) ) // NO keys... these key parameters don't matter. |
| 4843 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4844 | smsLog( pMac, LOGE, FL(" Set context for unicast fail") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4845 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 4846 | } |
| 4847 | // Issue the set Context request to LIM to establish the Broadcast STA context |
| 4848 | csrRoamIssueSetContextReq( pMac, sessionId, pProfile->negotiatedMCEncryptionType, |
| 4849 | pSirBssDesc, &BroadcastMac, |
| 4850 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 4851 | } |
| 4852 | else |
| 4853 | { |
| 4854 | //Need to wait for supplicant authtication |
| 4855 | roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4856 | //Set the subestate to WaitForKey in case authentiation is needed |
| 4857 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId ); |
| 4858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4859 | if(pProfile->bWPSAssociation) |
| 4860 | { |
| 4861 | key_timeout_interval = CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD; |
| 4862 | } |
| 4863 | else |
| 4864 | { |
| 4865 | key_timeout_interval = CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD; |
| 4866 | } |
| 4867 | |
| 4868 | //Save sessionId in case of timeout |
| 4869 | pMac->roam.WaitForKeyTimerInfo.sessionId = (tANI_U8)sessionId; |
| 4870 | //This time should be long enough for the rest of the process plus setting key |
| 4871 | if(!HAL_STATUS_SUCCESS( csrRoamStartWaitForKeyTimer( pMac, key_timeout_interval ) ) ) |
| 4872 | { |
| 4873 | //Reset our state so nothting is blocked. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4874 | smsLog( pMac, LOGE, FL(" Failed to start pre-auth timer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4875 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 4876 | } |
| 4877 | } |
| 4878 | |
| 4879 | assocInfo.pBssDesc = pSirBssDesc; //could be NULL |
| 4880 | assocInfo.pProfile = pProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4881 | if(Context) |
| 4882 | { |
| 4883 | tSirSmeJoinRsp *pJoinRsp = (tSirSmeJoinRsp *)Context; |
| 4884 | tANI_U32 len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4885 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 4886 | len = pJoinRsp->assocReqLength + pJoinRsp->assocRspLength + pJoinRsp->beaconLength; |
| 4887 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4888 | len += pJoinRsp->parsedRicRspLen; |
| 4889 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4890 | #ifdef FEATURE_WLAN_CCX |
| 4891 | len += pJoinRsp->tspecIeLen; |
| 4892 | #endif |
| 4893 | if(len) |
| 4894 | { |
| 4895 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 4896 | (void **)&pSession->connectedInfo.pbFrames, len))) |
| 4897 | { |
| 4898 | if(HAL_STATUS_SUCCESS( palCopyMemory(pMac->hHdd, |
| 4899 | pSession->connectedInfo.pbFrames, pJoinRsp->frames, len) )) |
| 4900 | { |
| 4901 | pSession->connectedInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 4902 | pSession->connectedInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 4903 | pSession->connectedInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 4904 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4905 | pSession->connectedInfo.nRICRspLength = pJoinRsp->parsedRicRspLen; |
| 4906 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4907 | #ifdef FEATURE_WLAN_CCX |
| 4908 | pSession->connectedInfo.nTspecIeLength = pJoinRsp->tspecIeLen; |
| 4909 | #endif |
| 4910 | roamInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 4911 | roamInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 4912 | roamInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 4913 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 4914 | } |
| 4915 | else |
| 4916 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4917 | smsLog(pMac, LOGE, "%s: Copying of memory failed for %d bytes !!!", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4918 | __func__, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4919 | palFreeMemory( pMac->hHdd, pSession->connectedInfo.pbFrames ); |
| 4920 | pSession->connectedInfo.pbFrames = NULL; |
| 4921 | } |
| 4922 | } |
| 4923 | } |
| 4924 | if(pCommand->u.roamCmd.fReassoc) |
| 4925 | { |
| 4926 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 4927 | } |
| 4928 | pSession->connectedInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 4929 | roamInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 4930 | roamInfo.ucastSig = ( tANI_U8 )pJoinRsp->ucastSig; |
| 4931 | roamInfo.bcastSig = ( tANI_U8 )pJoinRsp->bcastSig; |
| 4932 | } |
| 4933 | else |
| 4934 | { |
| 4935 | if(pCommand->u.roamCmd.fReassoc) |
| 4936 | { |
| 4937 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 4938 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 4939 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 4940 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 4941 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 4942 | } |
| 4943 | } |
| 4944 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4945 | // Indicate SME-QOS with reassoc success event, only after |
| 4946 | // copying the frames |
| 4947 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, ind_qos, &assocInfo); |
| 4948 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4949 | roamInfo.pBssDesc = pSirBssDesc; |
| 4950 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4951 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4952 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4953 | acm_mask = sme_QosGetACMMask(pMac, pSirBssDesc, NULL); |
| 4954 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 4955 | pSession->connectedProfile.acm_mask = acm_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4956 | //start UAPSD if uapsd_mask is not 0 because HDD will configure for trigger frame |
| 4957 | //It may be better to let QoS do this???? |
| 4958 | if( pSession->connectedProfile.modifyProfileFields.uapsd_mask ) |
| 4959 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4960 | smsLog(pMac, LOGE, " uapsd_mask (0x%X) set, request UAPSD now", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4961 | pSession->connectedProfile.modifyProfileFields.uapsd_mask); |
| 4962 | pmcStartUapsd( pMac, NULL, NULL ); |
| 4963 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4964 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 4965 | if( pSession->bRefAssocStartCnt > 0 ) |
| 4966 | { |
| 4967 | pSession->bRefAssocStartCnt--; |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 4968 | //Remove this code once SLM_Sessionization is supported |
| 4969 | //BMPS_WORKAROUND_NOT_NEEDED |
| 4970 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4971 | { |
| 4972 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 4973 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4974 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 4975 | } |
| 4976 | |
| 4977 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_NONE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4978 | // reset the PMKID candidate list |
| 4979 | csrResetPMKIDCandidateList( pMac, sessionId ); |
| 4980 | //Update TL's AC weight base on the current EDCA parameters |
| 4981 | //These parameters may change in the course of the connection, that sictuation |
| 4982 | //is not taken care here. This change is mainly to address a WIFI WMM test where |
| 4983 | //BE has a equal or higher TX priority than VI. |
| 4984 | //We only do this for infra link |
| 4985 | if( csrIsConnStateConnectedInfra(pMac, sessionId ) && pIes ) |
| 4986 | { |
| 4987 | csrCheckAndUpdateACWeight(pMac, pIes); |
| 4988 | } |
| 4989 | #ifdef FEATURE_WLAN_WAPI |
| 4990 | // reset the BKID candidate list |
| 4991 | csrResetBKIDCandidateList( pMac, sessionId ); |
| 4992 | #endif /* FEATURE_WLAN_WAPI */ |
| 4993 | } |
| 4994 | else |
| 4995 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4996 | smsLog(pMac, LOGW, " Roam command doesn't have a BSS desc"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4997 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4998 | csrScanCancelIdleScan(pMac); |
| 4999 | //Not to signal link up because keys are yet to be set. |
| 5000 | //The linkup function will overwrite the sub-state that we need to keep at this point. |
| 5001 | if( !CSR_IS_WAIT_FOR_KEY(pMac, sessionId) ) |
| 5002 | { |
| 5003 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 5004 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5005 | //Check if BMPS is required and start the BMPS retry timer. Timer period is large |
| 5006 | //enough to let security and DHCP handshake succeed before entry into BMPS |
| 5007 | if (pmcShouldBmpsTimerRun(pMac)) |
| 5008 | { |
| 5009 | if (pmcStartTrafficTimer(pMac, BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP) |
| 5010 | != eHAL_STATUS_SUCCESS) |
| 5011 | { |
| 5012 | smsLog(pMac, LOGP, FL("Cannot start BMPS Retry timer")); |
| 5013 | } |
| 5014 | smsLog(pMac, LOG2, FL("BMPS Retry Timer already running or started")); |
| 5015 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5016 | break; |
| 5017 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5018 | case eCsrStartBssSuccess: |
| 5019 | // on the StartBss Response, LIM is returning the Bss Description that we |
| 5020 | // are beaconing. Add this Bss Description to our scan results and |
| 5021 | // chain the Profile to this Bss Description. On a Start BSS, there was no |
| 5022 | // detected Bss description (no partner) so we issued the Start Bss to |
| 5023 | // start the Ibss without any Bss description. Lim was kind enough to return |
| 5024 | // 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] | 5025 | smsLog(pMac, LOG2, FL("receives start BSS ok indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5026 | status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5027 | pSmeStartBssRsp = (tSirSmeStartBssRsp *)Context; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5028 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5029 | if( CSR_IS_IBSS( pProfile ) ) |
| 5030 | { |
| 5031 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 5032 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5033 | else if (CSR_IS_INFRA_AP(pProfile)) |
| 5034 | { |
| 5035 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 5036 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5037 | else |
| 5038 | { |
| 5039 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 5040 | } |
| 5041 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 5042 | { |
| 5043 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5044 | pSirBssDesc = &pSmeStartBssRsp->bssDescription; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5045 | if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs( pMac, pSirBssDesc, &pIes )) ) |
| 5046 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5047 | smsLog(pMac, LOG2, FL("cannot parse IBSS IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5048 | roamInfo.pBssDesc = pSirBssDesc; |
| 5049 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5050 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5051 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_START_FAILED ); |
| 5052 | break; |
| 5053 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5054 | if (!CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5055 | { |
| 5056 | pScanResult = csrScanAppendBssDescription( pMac, pSirBssDesc, pIes ); |
| 5057 | } |
| 5058 | csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
| 5059 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5060 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5061 | if(pSirBssDesc) |
| 5062 | { |
| 5063 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 5064 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 5065 | } |
| 5066 | //We are doen with the IEs so free it |
| 5067 | palFreeMemory(pMac->hHdd, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5068 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5069 | { |
| 5070 | vos_log_ibss_pkt_type *pIbssLog; |
| 5071 | tANI_U32 bi; |
| 5072 | |
| 5073 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5074 | if(pIbssLog) |
| 5075 | { |
| 5076 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 5077 | { |
| 5078 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5079 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_RSP; |
| 5080 | } |
| 5081 | else |
| 5082 | { |
| 5083 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_RSP; |
| 5084 | } |
| 5085 | if(pSirBssDesc) |
| 5086 | { |
| 5087 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pSirBssDesc->bssId, 6); |
| 5088 | pIbssLog->operatingChannel = pSirBssDesc->channelId; |
| 5089 | } |
| 5090 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 5091 | { |
| 5092 | //***U8 is not enough for beacon interval |
| 5093 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 5094 | } |
| 5095 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5096 | } |
| 5097 | } |
| 5098 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5099 | //Only set context for non-WDS_STA. We don't even need it for WDS_AP. But since the encryption |
| 5100 | //is WPA2-PSK so it won't matter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5101 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && !CSR_IS_INFRA_AP( pSession->pCurRoamProfile )) |
| 5102 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5103 | // Issue the set Context request to LIM to establish the Broadcast STA context for the Ibss. |
| 5104 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 5105 | pProfile->negotiatedMCEncryptionType, |
| 5106 | pSirBssDesc, &BroadcastMac, |
| 5107 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5108 | } |
| 5109 | } |
| 5110 | else |
| 5111 | { |
| 5112 | //Keep the state to eCSR_ROAMING_STATE_JOINING |
| 5113 | //Need to send join_req. |
| 5114 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5115 | { |
| 5116 | if((pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link))) |
| 5117 | { |
| 5118 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5119 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 5120 | // Set the roaming substate to 'join attempt'... |
| 5121 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 5122 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5123 | } |
| 5124 | } |
| 5125 | else |
| 5126 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5127 | smsLog( pMac, LOGE, " StartBSS for WDS station with no BssDesc" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5128 | VOS_ASSERT( 0 ); |
| 5129 | } |
| 5130 | } |
| 5131 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5132 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5133 | //trigger the connection start indication in Vista |
| 5134 | if( !CSR_IS_JOIN_TO_IBSS( pProfile ) ) |
| 5135 | { |
| 5136 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5137 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5138 | if( CSR_IS_WDS( pProfile ) ) |
| 5139 | { |
| 5140 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5141 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5142 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5143 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5144 | { |
| 5145 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5146 | roamResult = eCSR_ROAM_RESULT_INFRA_STARTED; |
| 5147 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5148 | |
| 5149 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5150 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5151 | //trigger the connection start indication in Vista |
| 5152 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5153 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5154 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5155 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 5156 | { |
| 5157 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5158 | roamInfo.pBssDesc = pSirBssDesc; |
| 5159 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5160 | roamInfo.staId = (tANI_U8)pSmeStartBssRsp->staId; |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5161 | //Remove this code once SLM_Sessionization is supported |
| 5162 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5163 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5164 | ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5165 | { |
| 5166 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5167 | } |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5168 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5169 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5170 | } |
| 5171 | |
| 5172 | csrScanCancelIdleScan(pMac); |
| 5173 | //Only use this timer for ibss. BAP has its own timer for WDS |
| 5174 | if( CSR_IS_IBSS( pProfile) && CSR_INVALID_SCANRESULT_HANDLE != pCommand->u.roamCmd.hBSSList) |
| 5175 | { |
| 5176 | //start the join IBSS timer |
| 5177 | csrRoamStartIbssJoinTimer(pMac, sessionId, CSR_IBSS_JOIN_TIMEOUT_PERIOD); //interval |
| 5178 | pSession->ibss_join_pending = TRUE; |
| 5179 | } |
| 5180 | if( HAL_STATUS_SUCCESS( status ) ) |
| 5181 | { |
| 5182 | //Already sent join_req for the WDS station |
| 5183 | fReleaseCommand = eANI_BOOLEAN_FALSE; |
| 5184 | } |
| 5185 | else if( CSR_IS_WDS_STA( pProfile ) ) |
| 5186 | { |
| 5187 | //need to send stop BSS because we fail to send join_req |
| 5188 | csrRoamIssueDisassociateCmd( pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 5189 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5190 | eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_STOPPED ); |
| 5191 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5192 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5193 | case eCsrStartBssFailure: |
| 5194 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5195 | { |
| 5196 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5197 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5198 | if(pIbssLog) |
| 5199 | { |
| 5200 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 5201 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5202 | } |
| 5203 | } |
| 5204 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5205 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5206 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5207 | if( CSR_IS_WDS( pProfile ) ) |
| 5208 | { |
| 5209 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5210 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5212 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5213 | { |
| 5214 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5215 | roamResult = eCSR_ROAM_RESULT_INFRA_START_FAILED; |
| 5216 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5217 | if(Context) |
| 5218 | { |
| 5219 | pSirBssDesc = (tSirBssDescription *)Context; |
| 5220 | } |
| 5221 | else |
| 5222 | { |
| 5223 | pSirBssDesc = NULL; |
| 5224 | } |
| 5225 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5226 | roamInfo.pBssDesc = pSirBssDesc; |
| 5227 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5228 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5229 | csrSetDefaultDot11Mode( pMac ); |
| 5230 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5231 | case eCsrSilentlyStopRoaming: |
| 5232 | // We are here because we try to start the same IBSS |
| 5233 | //No message to PE |
| 5234 | // return the roaming state to Joined. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5235 | smsLog(pMac, LOGW, FL("receives silently roaming indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5236 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
| 5237 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 5238 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5239 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5240 | if( roamInfo.pBssDesc ) |
| 5241 | { |
| 5242 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid)); |
| 5243 | } |
| 5244 | //Since there is no change in the current state, simply pass back no result otherwise |
| 5245 | //HDD may be mistakenly mark to disconnected state. |
| 5246 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5247 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5248 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5249 | case eCsrSilentlyStopRoamingSaveState: |
| 5250 | //We are here because we try to connect to the same AP |
| 5251 | //No message to PE |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5252 | smsLog(pMac, LOGW, FL("receives silently stop roaming indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5253 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 5254 | |
| 5255 | //to aviod resetting the substate to NONE |
| 5256 | pMac->roam.curState[sessionId] = eCSR_ROAMING_STATE_JOINED; |
| 5257 | //No need to change substate to wai_for_key because there is no state change |
| 5258 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5259 | if( roamInfo.pBssDesc ) |
| 5260 | { |
| 5261 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid)); |
| 5262 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5263 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5264 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5265 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5266 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5267 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5268 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5269 | roamInfo.staId = pSession->connectedInfo.staId; |
| 5270 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5271 | VOS_ASSERT( roamInfo.staId != 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5272 | pSession->bRefAssocStartCnt--; |
| 5273 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5274 | eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5275 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_ASSOCIATED, eANI_BOOLEAN_TRUE); |
| 5276 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5277 | case eCsrReassocFailure: |
| 5278 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5279 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_REASSOC_FAILURE, NULL); |
| 5280 | #endif |
| 5281 | case eCsrJoinWdsFailure: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5282 | smsLog(pMac, LOGW, FL("failed to join WDS")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5283 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5284 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5285 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5286 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5287 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5288 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5289 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5290 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5291 | eCSR_ROAM_WDS_IND, |
| 5292 | eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED); |
| 5293 | //Need to issue stop_bss |
| 5294 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5295 | case eCsrJoinFailure: |
| 5296 | case eCsrNothingToJoin: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5297 | case eCsrJoinFailureDueToConcurrency: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5298 | default: |
| 5299 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5300 | smsLog(pMac, LOGW, FL("receives no association indication")); |
| 5301 | smsLog(pMac, LOG1, FL("Assoc ref count %d"), |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 5302 | pSession->bRefAssocStartCnt); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5303 | if( CSR_IS_INFRASTRUCTURE( &pSession->connectedProfile ) || |
| 5304 | CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, sessionId ) ) |
| 5305 | { |
| 5306 | //do not free for the other profiles as we need to send down stop BSS later |
| 5307 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5308 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5309 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5310 | csrSetDefaultDot11Mode( pMac ); |
| 5311 | } |
| 5312 | |
| 5313 | switch( pCommand->u.roamCmd.roamReason ) |
| 5314 | { |
| 5315 | // If this transition is because of an 802.11 OID, then we transition |
| 5316 | // back to INIT state so we sit waiting for more OIDs to be issued and |
| 5317 | // we don't start the IDLE timer. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5318 | case eCsrSmeIssuedFTReassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5319 | case eCsrSmeIssuedAssocToSimilarAP: |
| 5320 | case eCsrHddIssued: |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 5321 | case eCsrSmeIssuedDisassocForHandoff: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5322 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5323 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5324 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5325 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5326 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5327 | /* Defeaturize this later if needed */ |
| 5328 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5329 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 5330 | if (csrRoamIsHandoffInProgress(pMac)) |
| 5331 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5332 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 5333 | csrNeighborRoamIndicateConnect(pMac, (tANI_U8)sessionId, VOS_STATUS_E_FAILURE); |
| 5334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5335 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5336 | if(pSession->bRefAssocStartCnt > 0) |
| 5337 | { |
| 5338 | pSession->bRefAssocStartCnt--; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5339 | if(eCsrJoinFailureDueToConcurrency == Result) |
| 5340 | { |
| 5341 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5342 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5343 | eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL); |
| 5344 | } |
| 5345 | else |
| 5346 | { |
| 5347 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5348 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5349 | eCSR_ROAM_RESULT_FAILURE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5350 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5351 | } |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5352 | else |
| 5353 | { |
| 5354 | /* bRefAssocStartCnt is not incremented when |
| 5355 | * eRoamState == eCsrStopRoamingDueToConcurrency |
| 5356 | * in csrRoamJoinNextBss API. so handle this in |
| 5357 | * else case by sending assoc failure |
| 5358 | */ |
| 5359 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5360 | pCommand->u.scanCmd.roamId, |
| 5361 | eCSR_ROAM_ASSOCIATION_FAILURE, |
| 5362 | eCSR_ROAM_RESULT_FAILURE); |
| 5363 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5364 | smsLog(pMac, LOG1, FL(" roam(reason %d) failed"), pCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5365 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5366 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5367 | #endif |
| 5368 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5369 | csrScanStartIdleScan(pMac); |
| 5370 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5371 | //For WDS STA. To fix the issue where the WDS AP side may be too busy by |
| 5372 | //BT activity and not able to recevie WLAN traffic. Retry the join |
| 5373 | if( CSR_IS_WDS_STA(pProfile) ) |
| 5374 | { |
| 5375 | csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD); |
| 5376 | } |
| 5377 | #endif |
| 5378 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5379 | case eCsrHddIssuedReassocToSameAP: |
| 5380 | case eCsrSmeIssuedReassocToSameAP: |
| 5381 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5382 | |
| 5383 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5384 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5385 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5386 | #endif |
| 5387 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5388 | csrScanStartIdleScan(pMac); |
| 5389 | break; |
| 5390 | case eCsrForcedDisassoc: |
| 5391 | case eCsrForcedDeauth: |
| 5392 | case eCsrSmeIssuedIbssJoinFailure: |
| 5393 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5394 | |
| 5395 | if(eCsrSmeIssuedIbssJoinFailure == pCommand->u.roamCmd.roamReason) |
| 5396 | { |
| 5397 | // Notify HDD that IBSS join failed |
| 5398 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 5399 | } |
| 5400 | else |
| 5401 | { |
| 5402 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5403 | pCommand->u.roamCmd.roamId, |
| 5404 | eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5405 | } |
| 5406 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5407 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5408 | #endif |
| 5409 | csrRoamLinkDown(pMac, sessionId); |
| 5410 | csrScanStartIdleScan(pMac); |
| 5411 | break; |
| 5412 | case eCsrForcedIbssLeave: |
| 5413 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5414 | pCommand->u.roamCmd.roamId, |
| 5415 | eCSR_ROAM_IBSS_LEAVE, |
| 5416 | eCSR_ROAM_RESULT_IBSS_STOP); |
| 5417 | break; |
| 5418 | case eCsrForcedDisassocMICFailure: |
| 5419 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5420 | |
| 5421 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_MIC_FAILURE); |
| 5422 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5423 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 5424 | #endif |
| 5425 | csrScanStartIdleScan(pMac); |
| 5426 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5427 | case eCsrStopBss: |
| 5428 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5429 | pCommand->u.roamCmd.roamId, |
| 5430 | eCSR_ROAM_INFRA_IND, |
| 5431 | eCSR_ROAM_RESULT_INFRA_STOPPED); |
| 5432 | break; |
| 5433 | case eCsrForcedDisassocSta: |
| 5434 | case eCsrForcedDeauthSta: |
| 5435 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId); |
| 5436 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 5437 | { |
| 5438 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5439 | if (!pSession) |
| 5440 | break; |
| 5441 | |
| 5442 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 5443 | { |
| 5444 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5445 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, |
| 5446 | pCommand->u.roamCmd.peerMac, sizeof(tSirMacAddr)); |
| 5447 | roamInfo.reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 5448 | roamInfo.statusCode = eSIR_SME_SUCCESS; |
| 5449 | status = csrRoamCallCallback(pMac, sessionId, |
| 5450 | &roamInfo, pCommand->u.roamCmd.roamId, |
| 5451 | eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 5452 | } |
| 5453 | } |
| 5454 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5455 | case eCsrLostLink1: |
| 5456 | // if lost link roam1 failed, then issue lost link Scan2 ... |
| 5457 | csrScanRequestLostLink2(pMac, sessionId); |
| 5458 | break; |
| 5459 | case eCsrLostLink2: |
| 5460 | // if lost link roam2 failed, then issue lost link scan3 ... |
| 5461 | csrScanRequestLostLink3(pMac, sessionId); |
| 5462 | break; |
| 5463 | case eCsrLostLink3: |
| 5464 | default: |
| 5465 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5466 | |
| 5467 | //We are done with one round of lostlink roaming here |
| 5468 | csrScanHandleFailedLostlink3(pMac, sessionId); |
| 5469 | break; |
| 5470 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5471 | break; |
| 5472 | } |
| 5473 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5474 | return ( fReleaseCommand ); |
| 5475 | } |
| 5476 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5477 | eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext) |
| 5478 | { |
| 5479 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5480 | return (status); |
| 5481 | } |
| 5482 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5483 | eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile) |
| 5484 | { |
| 5485 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5486 | tANI_U32 size = 0; |
| 5487 | |
| 5488 | do |
| 5489 | { |
| 5490 | palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile)); |
| 5491 | if(pSrcProfile->BSSIDs.numOfBSSIDs) |
| 5492 | { |
| 5493 | size = sizeof(tCsrBssid) * pSrcProfile->BSSIDs.numOfBSSIDs; |
| 5494 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, size); |
| 5495 | if(!HAL_STATUS_SUCCESS(status)) |
| 5496 | { |
| 5497 | break; |
| 5498 | } |
| 5499 | pDstProfile->BSSIDs.numOfBSSIDs = pSrcProfile->BSSIDs.numOfBSSIDs; |
| 5500 | palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->BSSIDs.bssid, size); |
| 5501 | } |
| 5502 | if(pSrcProfile->SSIDs.numOfSSIDs) |
| 5503 | { |
| 5504 | size = sizeof(tCsrSSIDInfo) * pSrcProfile->SSIDs.numOfSSIDs; |
| 5505 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, size); |
| 5506 | if(!HAL_STATUS_SUCCESS(status)) |
| 5507 | { |
| 5508 | break; |
| 5509 | } |
| 5510 | pDstProfile->SSIDs.numOfSSIDs = pSrcProfile->SSIDs.numOfSSIDs; |
| 5511 | palCopyMemory(pMac->hHdd, pDstProfile->SSIDs.SSIDList, pSrcProfile->SSIDs.SSIDList, size); |
| 5512 | } |
| 5513 | if(pSrcProfile->nWPAReqIELength) |
| 5514 | { |
| 5515 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength); |
| 5516 | if(!HAL_STATUS_SUCCESS(status)) |
| 5517 | { |
| 5518 | break; |
| 5519 | } |
| 5520 | pDstProfile->nWPAReqIELength = pSrcProfile->nWPAReqIELength; |
| 5521 | palCopyMemory(pMac->hHdd, pDstProfile->pWPAReqIE, pSrcProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength); |
| 5522 | } |
| 5523 | if(pSrcProfile->nRSNReqIELength) |
| 5524 | { |
| 5525 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength); |
| 5526 | if(!HAL_STATUS_SUCCESS(status)) |
| 5527 | { |
| 5528 | break; |
| 5529 | } |
| 5530 | pDstProfile->nRSNReqIELength = pSrcProfile->nRSNReqIELength; |
| 5531 | palCopyMemory(pMac->hHdd, pDstProfile->pRSNReqIE, pSrcProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength); |
| 5532 | } |
| 5533 | #ifdef FEATURE_WLAN_WAPI |
| 5534 | if(pSrcProfile->nWAPIReqIELength) |
| 5535 | { |
| 5536 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength); |
| 5537 | if(!HAL_STATUS_SUCCESS(status)) |
| 5538 | { |
| 5539 | break; |
| 5540 | } |
| 5541 | pDstProfile->nWAPIReqIELength = pSrcProfile->nWAPIReqIELength; |
| 5542 | palCopyMemory(pMac->hHdd, pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength); |
| 5543 | } |
| 5544 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5545 | if(pSrcProfile->nAddIEScanLength) |
| 5546 | { |
| 5547 | status = palAllocateMemory(pMac->hHdd, |
| 5548 | (void **)&pDstProfile->pAddIEScan, pSrcProfile->nAddIEScanLength); |
| 5549 | if(!HAL_STATUS_SUCCESS(status)) |
| 5550 | { |
| 5551 | break; |
| 5552 | } |
| 5553 | pDstProfile->nAddIEScanLength = pSrcProfile->nAddIEScanLength; |
| 5554 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEScan, pSrcProfile->pAddIEScan, |
| 5555 | pSrcProfile->nAddIEScanLength); |
| 5556 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5557 | if(pSrcProfile->nAddIEAssocLength) |
| 5558 | { |
| 5559 | status = palAllocateMemory(pMac->hHdd, |
| 5560 | (void **)&pDstProfile->pAddIEAssoc, pSrcProfile->nAddIEAssocLength); |
| 5561 | if(!HAL_STATUS_SUCCESS(status)) |
| 5562 | { |
| 5563 | break; |
| 5564 | } |
| 5565 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
| 5566 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 5567 | pSrcProfile->nAddIEAssocLength); |
| 5568 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5569 | if(pSrcProfile->ChannelInfo.ChannelList) |
| 5570 | { |
| 5571 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); |
| 5572 | if(!HAL_STATUS_SUCCESS(status)) |
| 5573 | { |
| 5574 | break; |
| 5575 | } |
| 5576 | pDstProfile->ChannelInfo.numOfChannels = pSrcProfile->ChannelInfo.numOfChannels; |
| 5577 | palCopyMemory(pMac->hHdd, pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); |
| 5578 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5579 | pDstProfile->AuthType = pSrcProfile->AuthType; |
| 5580 | pDstProfile->EncryptionType = pSrcProfile->EncryptionType; |
| 5581 | pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType; |
| 5582 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->negotiatedUCEncryptionType; |
| 5583 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->negotiatedMCEncryptionType; |
| 5584 | pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType; |
| 5585 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 5586 | pDstProfile->phyMode = pSrcProfile->phyMode; |
| 5587 | pDstProfile->csrPersona = pSrcProfile->csrPersona; |
| 5588 | |
| 5589 | #ifdef FEATURE_WLAN_WAPI |
| 5590 | if(csrIsProfileWapi(pSrcProfile)) |
| 5591 | { |
| 5592 | if(pDstProfile->phyMode & eCSR_DOT11_MODE_11n) |
| 5593 | { |
| 5594 | pDstProfile->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 5595 | } |
| 5596 | } |
| 5597 | #endif /* FEATURE_WLAN_WAPI */ |
| 5598 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 5599 | /*Save the WPS info*/ |
| 5600 | pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation; |
| 5601 | pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5602 | pDstProfile->beaconInterval = pSrcProfile->beaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5603 | pDstProfile->privacy = pSrcProfile->privacy; |
| 5604 | pDstProfile->fwdWPSPBCProbeReq = pSrcProfile->fwdWPSPBCProbeReq; |
| 5605 | pDstProfile->csr80211AuthType = pSrcProfile->csr80211AuthType; |
| 5606 | pDstProfile->dtimPeriod = pSrcProfile->dtimPeriod; |
| 5607 | pDstProfile->ApUapsdEnable = pSrcProfile->ApUapsdEnable; |
| 5608 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->SSIDs.SSIDList[0].ssidHidden; |
| 5609 | pDstProfile->protEnabled = pSrcProfile->protEnabled; |
| 5610 | pDstProfile->obssProtEnabled = pSrcProfile->obssProtEnabled; |
| 5611 | pDstProfile->cfg_protection = pSrcProfile->cfg_protection; |
| 5612 | pDstProfile->wps_state = pSrcProfile->wps_state; |
| 5613 | pDstProfile->ieee80211d = pSrcProfile->ieee80211d; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5614 | palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5615 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5616 | if (pSrcProfile->MDID.mdiePresent) |
| 5617 | { |
| 5618 | pDstProfile->MDID.mdiePresent = 1; |
| 5619 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 5620 | } |
| 5621 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5622 | }while(0); |
| 5623 | |
| 5624 | if(!HAL_STATUS_SUCCESS(status)) |
| 5625 | { |
| 5626 | csrReleaseProfile(pMac, pDstProfile); |
| 5627 | pDstProfile = NULL; |
| 5628 | } |
| 5629 | |
| 5630 | return (status); |
| 5631 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5632 | eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile ) |
| 5633 | { |
| 5634 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5635 | tCsrRoamConnectedProfile *pSrcProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 5636 | do |
| 5637 | { |
| 5638 | palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile)); |
| 5639 | if(pSrcProfile->bssid) |
| 5640 | { |
| 5641 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 5642 | if(!HAL_STATUS_SUCCESS(status)) |
| 5643 | { |
| 5644 | break; |
| 5645 | } |
| 5646 | pDstProfile->BSSIDs.numOfBSSIDs = 1; |
| 5647 | palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->bssid, sizeof(tCsrBssid)); |
| 5648 | } |
| 5649 | if(pSrcProfile->SSID.ssId) |
| 5650 | { |
| 5651 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, sizeof(tCsrSSIDInfo)); |
| 5652 | if(!HAL_STATUS_SUCCESS(status)) |
| 5653 | { |
| 5654 | break; |
| 5655 | } |
| 5656 | pDstProfile->SSIDs.numOfSSIDs = 1; |
| 5657 | pDstProfile->SSIDs.SSIDList[0].handoffPermitted = pSrcProfile->handoffPermitted; |
| 5658 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->ssidHidden; |
| 5659 | palCopyMemory(pMac->hHdd, &pDstProfile->SSIDs.SSIDList[0].SSID, &pSrcProfile->SSID, sizeof(tSirMacSSid)); |
| 5660 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 5661 | if(pSrcProfile->nAddIEAssocLength) |
| 5662 | { |
| 5663 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pAddIEAssoc, pSrcProfile->nAddIEAssocLength); |
| 5664 | if(!HAL_STATUS_SUCCESS(status)) |
| 5665 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5666 | smsLog( pMac, LOGE, FL(" failed to allocate memory for additional IEs ") ); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 5667 | break; |
| 5668 | } |
| 5669 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
| 5670 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 5671 | pSrcProfile->nAddIEAssocLength); |
| 5672 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5673 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, 1); |
| 5674 | if(!HAL_STATUS_SUCCESS(status)) |
| 5675 | { |
| 5676 | break; |
| 5677 | } |
| 5678 | pDstProfile->ChannelInfo.numOfChannels = 1; |
| 5679 | pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5680 | pDstProfile->AuthType.numEntries = 1; |
| 5681 | pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType; |
| 5682 | pDstProfile->negotiatedAuthType = pSrcProfile->AuthType; |
| 5683 | pDstProfile->EncryptionType.numEntries = 1; |
| 5684 | pDstProfile->EncryptionType.encryptionType[0] = pSrcProfile->EncryptionType; |
| 5685 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->EncryptionType; |
| 5686 | pDstProfile->mcEncryptionType.numEntries = 1; |
| 5687 | pDstProfile->mcEncryptionType.encryptionType[0] = pSrcProfile->mcEncryptionType; |
| 5688 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->mcEncryptionType; |
| 5689 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 5690 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 5691 | palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys)); |
| 5692 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5693 | if (pSrcProfile->MDID.mdiePresent) |
| 5694 | { |
| 5695 | pDstProfile->MDID.mdiePresent = 1; |
| 5696 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 5697 | } |
| 5698 | #endif |
| 5699 | |
| 5700 | }while(0); |
| 5701 | |
| 5702 | if(!HAL_STATUS_SUCCESS(status)) |
| 5703 | { |
| 5704 | csrReleaseProfile(pMac, pDstProfile); |
| 5705 | pDstProfile = NULL; |
| 5706 | } |
| 5707 | |
| 5708 | return (status); |
| 5709 | } |
| 5710 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5711 | eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5712 | tScanResultHandle hBSSList, |
| 5713 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate, |
| 5714 | tANI_BOOLEAN fClearScan) |
| 5715 | { |
| 5716 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5717 | tSmeCmd *pCommand; |
| 5718 | |
| 5719 | pCommand = csrGetCommandBuffer(pMac); |
| 5720 | if(NULL == pCommand) |
| 5721 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5722 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5723 | status = eHAL_STATUS_RESOURCES; |
| 5724 | } |
| 5725 | else |
| 5726 | { |
| 5727 | if( fClearScan ) |
| 5728 | { |
| 5729 | csrScanCancelIdleScan(pMac); |
| 5730 | csrScanAbortMacScanNotForConnect(pMac); |
| 5731 | } |
| 5732 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 5733 | if(NULL == pProfile) |
| 5734 | { |
| 5735 | //We can roam now |
| 5736 | //Since pProfile is NULL, we need to build our own profile, set everything to default |
| 5737 | //We can only support open and no encryption |
| 5738 | pCommand->u.roamCmd.roamProfile.AuthType.numEntries = 1; |
| 5739 | pCommand->u.roamCmd.roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5740 | pCommand->u.roamCmd.roamProfile.EncryptionType.numEntries = 1; |
| 5741 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 5742 | pCommand->u.roamCmd.roamProfile.csrPersona = VOS_STA_MODE; |
| 5743 | } |
| 5744 | else |
| 5745 | { |
| 5746 | //make a copy of the profile |
| 5747 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 5748 | if(HAL_STATUS_SUCCESS(status)) |
| 5749 | { |
| 5750 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 5751 | } |
| 5752 | } |
| 5753 | pCommand->command = eSmeCommandRoam; |
| 5754 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5755 | pCommand->u.roamCmd.hBSSList = hBSSList; |
| 5756 | pCommand->u.roamCmd.roamId = roamId; |
| 5757 | pCommand->u.roamCmd.roamReason = reason; |
| 5758 | //We need to free the BssList when the command is done |
| 5759 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_TRUE; |
| 5760 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5761 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 5762 | FL("CSR PERSONA=%d"), |
| 5763 | pCommand->u.roamCmd.roamProfile.csrPersona); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5764 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 5765 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5766 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5767 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5768 | csrReleaseCommandRoam( pMac, pCommand ); |
| 5769 | } |
| 5770 | } |
| 5771 | |
| 5772 | return (status); |
| 5773 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5774 | eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5775 | tCsrRoamModifyProfileFields *pMmodProfileFields, |
| 5776 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 5777 | { |
| 5778 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5779 | tSmeCmd *pCommand; |
| 5780 | |
| 5781 | pCommand = csrGetCommandBuffer(pMac); |
| 5782 | if(NULL == pCommand) |
| 5783 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5784 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5785 | status = eHAL_STATUS_RESOURCES; |
| 5786 | } |
| 5787 | else |
| 5788 | { |
| 5789 | csrScanCancelIdleScan(pMac); |
| 5790 | csrScanAbortMacScanNotForConnect(pMac); |
| 5791 | if(pProfile) |
| 5792 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5793 | //This is likely trying to reassoc to different profile |
| 5794 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 5795 | //make a copy of the profile |
| 5796 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 5797 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5798 | } |
| 5799 | else |
| 5800 | { |
| 5801 | status = csrRoamCopyConnectedProfile(pMac, sessionId, &pCommand->u.roamCmd.roamProfile); |
| 5802 | //how to update WPA/WPA2 info in roamProfile?? |
| 5803 | pCommand->u.roamCmd.roamProfile.uapsd_mask = pMmodProfileFields->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5804 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5805 | if(HAL_STATUS_SUCCESS(status)) |
| 5806 | { |
| 5807 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 5808 | } |
| 5809 | pCommand->command = eSmeCommandRoam; |
| 5810 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5811 | pCommand->u.roamCmd.roamId = roamId; |
| 5812 | pCommand->u.roamCmd.roamReason = reason; |
| 5813 | //We need to free the BssList when the command is done |
| 5814 | //For reassoc there is no BSS list, so the boolean set to false |
| 5815 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 5816 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 5817 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5818 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 5819 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5820 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5821 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5822 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5823 | csrReleaseCommandRoam( pMac, pCommand ); |
| 5824 | } |
| 5825 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5826 | return (status); |
| 5827 | } |
| 5828 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 5829 | eHalStatus csrRoamEnqueuePreauth(tpAniSirGlobal pMac, tANI_U32 sessionId, tpSirBssDescription pBssDescription, |
| 5830 | eCsrRoamReason reason, tANI_BOOLEAN fImmediate) |
| 5831 | // , eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 5832 | { |
| 5833 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5834 | tSmeCmd *pCommand; |
| 5835 | |
| 5836 | pCommand = csrGetCommandBuffer(pMac); |
| 5837 | if(NULL == pCommand) |
| 5838 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5839 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 5840 | status = eHAL_STATUS_RESOURCES; |
| 5841 | } |
| 5842 | else |
| 5843 | { |
| 5844 | if(pBssDescription) |
| 5845 | { |
| 5846 | //copy over the parameters we need later |
| 5847 | pCommand->command = eSmeCommandRoam; |
| 5848 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5849 | pCommand->u.roamCmd.roamReason = reason; |
| 5850 | //this is the important parameter |
| 5851 | //in this case we are using this field for the "next" BSS |
| 5852 | pCommand->u.roamCmd.pLastRoamBss = pBssDescription; |
| 5853 | status = csrQueueSmeCommand(pMac, pCommand, fImmediate); |
| 5854 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5855 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5856 | 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] | 5857 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 5858 | } |
| 5859 | } |
| 5860 | else |
| 5861 | { |
| 5862 | //Return failure |
| 5863 | status = eHAL_STATUS_RESOURCES; |
| 5864 | } |
| 5865 | } |
| 5866 | return (status); |
| 5867 | } |
| 5868 | |
| 5869 | eHalStatus csrRoamDequeuePreauth(tpAniSirGlobal pMac) |
| 5870 | { |
| 5871 | tListElem *pEntry; |
| 5872 | tSmeCmd *pCommand; |
| 5873 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 5874 | if ( pEntry ) |
| 5875 | { |
| 5876 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 5877 | if ( (eSmeCommandRoam == pCommand->command) && |
| 5878 | (eCsrPerformPreauth == pCommand->u.roamCmd.roamReason)) |
| 5879 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 5880 | smsLog( pMac, LOG1, FL("DQ-Command = %d, Reason = %d"), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 5881 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 5882 | if (csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK )) { |
| 5883 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 5884 | } |
| 5885 | } else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5886 | smsLog( pMac, LOGE, FL("Command = %d, Reason = %d "), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 5887 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 5888 | } |
| 5889 | } |
| 5890 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5891 | 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] | 5892 | } |
| 5893 | smeProcessPendingQueue( pMac ); |
| 5894 | return eHAL_STATUS_SUCCESS; |
| 5895 | } |
| 5896 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5897 | eHalStatus csrRoamConnectWithBSSList(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5898 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 5899 | { |
| 5900 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5901 | tScanResultHandle hBSSList; |
| 5902 | tANI_U32 roamId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5903 | status = csrScanCopyResultList(pMac, hBssListIn, &hBSSList); |
| 5904 | if(HAL_STATUS_SUCCESS(status)) |
| 5905 | { |
| 5906 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 5907 | if(pRoamId) |
| 5908 | { |
| 5909 | *pRoamId = roamId; |
| 5910 | } |
| 5911 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 5912 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 5913 | if(!HAL_STATUS_SUCCESS(status)) |
| 5914 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5915 | smsLog(pMac, LOGE, FL("failed to start a join process")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5916 | csrScanResultPurge(pMac, hBSSList); |
| 5917 | } |
| 5918 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5919 | return (status); |
| 5920 | } |
| 5921 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5922 | eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5923 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 5924 | { |
| 5925 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5926 | tScanResultHandle hBSSList; |
| 5927 | tCsrScanResultFilter *pScanFilter; |
| 5928 | tANI_U32 roamId = 0; |
| 5929 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_FALSE; |
| 5930 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5931 | if (NULL == pProfile) |
| 5932 | { |
| 5933 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 5934 | return eHAL_STATUS_FAILURE; |
| 5935 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5936 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5937 | pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5938 | if( CSR_IS_WDS( pProfile ) && |
| 5939 | !HAL_STATUS_SUCCESS( status = csrIsBTAMPAllowed( pMac, pProfile->operationChannel ) ) ) |
| 5940 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5941 | 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] | 5942 | pProfile->operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5943 | return status; |
| 5944 | } |
| 5945 | csrRoamCancelRoaming(pMac, sessionId); |
| 5946 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 5947 | csrScanCancelIdleScan(pMac); |
| 5948 | //Only abort the scan if it is not used for other roam/connect purpose |
| 5949 | csrScanAbortMacScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5950 | if (!vos_concurrent_sessions_running() && (VOS_STA_SAP_MODE == pProfile->csrPersona))//In case of AP mode we do not want idle mode scan |
| 5951 | { |
| 5952 | csrScanDisable(pMac); |
| 5953 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5954 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 5955 | //Check whether ssid changes |
| 5956 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 5957 | { |
| 5958 | if(pProfile->SSIDs.numOfSSIDs && !csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 5959 | { |
| 5960 | csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 5961 | } |
| 5962 | } |
| 5963 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5964 | pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; |
| 5965 | #endif |
| 5966 | if(CSR_INVALID_SCANRESULT_HANDLE != hBssListIn) |
| 5967 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5968 | smsLog(pMac, LOG1, FL("is called with BSSList")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5969 | status = csrRoamConnectWithBSSList(pMac, sessionId, pProfile, hBssListIn, pRoamId); |
| 5970 | if(pRoamId) |
| 5971 | { |
| 5972 | roamId = *pRoamId; |
| 5973 | } |
| 5974 | if(!HAL_STATUS_SUCCESS(status)) |
| 5975 | { |
| 5976 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5977 | } |
| 5978 | } |
| 5979 | else |
| 5980 | { |
| 5981 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 5982 | if(HAL_STATUS_SUCCESS(status)) |
| 5983 | { |
| 5984 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 5985 | //Try to connect to any BSS |
| 5986 | if(NULL == pProfile) |
| 5987 | { |
| 5988 | //No encryption |
| 5989 | pScanFilter->EncryptionType.numEntries = 1; |
| 5990 | pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 5991 | }//we don't have a profile |
| 5992 | else |
| 5993 | { |
| 5994 | //Here is the profile we need to connect to |
| 5995 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 5996 | }//We have a profile |
| 5997 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 5998 | if(pRoamId) |
| 5999 | { |
| 6000 | *pRoamId = roamId; |
| 6001 | } |
| 6002 | |
| 6003 | if(HAL_STATUS_SUCCESS(status)) |
| 6004 | { |
| 6005 | /*Save the WPS info*/ |
| 6006 | if(NULL != pProfile) |
| 6007 | { |
| 6008 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
| 6009 | } |
| 6010 | else |
| 6011 | { |
| 6012 | pScanFilter->bWPSAssociation = 0; |
| 6013 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6014 | do |
| 6015 | { |
| 6016 | if( (pProfile && CSR_IS_WDS_AP( pProfile ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6017 | || (pProfile && CSR_IS_INFRA_AP ( pProfile )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6018 | ) |
| 6019 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6020 | //This can be started right away |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6021 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6022 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6023 | if(!HAL_STATUS_SUCCESS(status)) |
| 6024 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6025 | 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] | 6026 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6027 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6028 | else |
| 6029 | { |
| 6030 | smsLog(pMac, LOG1, FL("Connect request to proceed for AMP/SoftAP mode")); |
| 6031 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6032 | break; |
| 6033 | } |
| 6034 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6035 | smsLog(pMac, LOG1, "************ csrScanGetResult Status ********* %d", status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6036 | if(HAL_STATUS_SUCCESS(status)) |
| 6037 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6038 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6039 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6040 | if(!HAL_STATUS_SUCCESS(status)) |
| 6041 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6042 | 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] | 6043 | csrScanResultPurge(pMac, hBSSList); |
| 6044 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6045 | } |
| 6046 | }//Have scan result |
| 6047 | else if(NULL != pProfile) |
| 6048 | { |
| 6049 | //Check whether it is for start ibss |
| 6050 | if(CSR_IS_START_IBSS(pProfile)) |
| 6051 | { |
| 6052 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6053 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6054 | if(!HAL_STATUS_SUCCESS(status)) |
| 6055 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6056 | 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] | 6057 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6058 | } |
| 6059 | } |
| 6060 | else |
| 6061 | { |
| 6062 | //scan for this SSID |
| 6063 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId); |
| 6064 | if(!HAL_STATUS_SUCCESS(status)) |
| 6065 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6066 | 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] | 6067 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6068 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6069 | else |
| 6070 | { |
| 6071 | smsLog(pMac, LOG1, FL("SSID scan requested for Infra connect req")); |
| 6072 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6073 | } |
| 6074 | } |
| 6075 | else |
| 6076 | { |
| 6077 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6078 | } |
| 6079 | } while (0); |
| 6080 | if(NULL != pProfile) |
| 6081 | { |
| 6082 | //we need to free memory for filter if profile exists |
| 6083 | csrFreeScanFilter(pMac, pScanFilter); |
| 6084 | } |
| 6085 | }//Got the scan filter from profile |
| 6086 | |
| 6087 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 6088 | }//allocated memory for pScanFilter |
| 6089 | }//No Bsslist coming in |
| 6090 | //tell the caller if we fail to trigger a join request |
| 6091 | if( fCallCallback ) |
| 6092 | { |
| 6093 | csrRoamCallCallback(pMac, sessionId, NULL, roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6094 | } |
| 6095 | |
| 6096 | return (status); |
| 6097 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6098 | eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6099 | tCsrRoamModifyProfileFields modProfileFields, |
| 6100 | tANI_U32 *pRoamId) |
| 6101 | { |
| 6102 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6103 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_TRUE; |
| 6104 | tANI_U32 roamId = 0; |
| 6105 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6106 | if (NULL == pProfile) |
| 6107 | { |
| 6108 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6109 | return eHAL_STATUS_FAILURE; |
| 6110 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6111 | 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] | 6112 | csrRoamCancelRoaming(pMac, sessionId); |
| 6113 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6114 | csrScanCancelIdleScan(pMac); |
| 6115 | csrScanAbortMacScanNotForConnect(pMac); |
| 6116 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssuedReassocToSameAP); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6117 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6118 | { |
| 6119 | if(pProfile) |
| 6120 | { |
| 6121 | if(pProfile->SSIDs.numOfSSIDs && |
| 6122 | csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6123 | { |
| 6124 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6125 | } |
| 6126 | else |
| 6127 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6128 | 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] | 6129 | } |
| 6130 | } |
| 6131 | else if(!palEqualMemory(pMac->hHdd, &modProfileFields, |
| 6132 | &pSession->connectedProfile.modifyProfileFields, |
| 6133 | sizeof(tCsrRoamModifyProfileFields))) |
| 6134 | { |
| 6135 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6136 | } |
| 6137 | else |
| 6138 | { |
| 6139 | 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] | 6140 | "in tCsrRoamModifyProfileFields got modified")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6141 | } |
| 6142 | } |
| 6143 | else |
| 6144 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6145 | smsLog(pMac, LOG1, FL("Not connected! No need to reassoc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6147 | if(!fCallCallback) |
| 6148 | { |
| 6149 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6150 | if(pRoamId) |
| 6151 | { |
| 6152 | *pRoamId = roamId; |
| 6153 | } |
| 6154 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6155 | status = csrRoamIssueReassoc(pMac, sessionId, pProfile, &modProfileFields, |
| 6156 | eCsrHddIssuedReassocToSameAP, roamId, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6157 | } |
| 6158 | else |
| 6159 | { |
| 6160 | status = csrRoamCallCallback(pMac, sessionId, NULL, roamId, |
| 6161 | eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6162 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6163 | return status; |
| 6164 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6165 | eHalStatus csrRoamJoinLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6166 | { |
| 6167 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6168 | tScanResultHandle hBSSList = NULL; |
| 6169 | tCsrScanResultFilter *pScanFilter = NULL; |
| 6170 | tANI_U32 roamId; |
| 6171 | tCsrRoamProfile *pProfile = NULL; |
| 6172 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6173 | |
| 6174 | if(!pSession) |
| 6175 | { |
| 6176 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6177 | return eHAL_STATUS_FAILURE; |
| 6178 | } |
| 6179 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6180 | do |
| 6181 | { |
| 6182 | if(pSession->pCurRoamProfile) |
| 6183 | { |
| 6184 | csrScanCancelIdleScan(pMac); |
| 6185 | csrScanAbortMacScanNotForConnect(pMac); |
| 6186 | //We have to make a copy of pCurRoamProfile because it will be free inside csrRoamIssueConnect |
| 6187 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile, sizeof(tCsrRoamProfile)); |
| 6188 | if(!HAL_STATUS_SUCCESS(status)) |
| 6189 | break; |
| 6190 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile)); |
| 6191 | status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile); |
| 6192 | if(!HAL_STATUS_SUCCESS(status)) |
| 6193 | break; |
| 6194 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6195 | if(!HAL_STATUS_SUCCESS(status)) |
| 6196 | { |
| 6197 | break; |
| 6198 | } |
| 6199 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6200 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6201 | if(!HAL_STATUS_SUCCESS(status)) |
| 6202 | { |
| 6203 | break; |
| 6204 | } |
| 6205 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6206 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 6207 | if(HAL_STATUS_SUCCESS(status)) |
| 6208 | { |
| 6209 | //we want to put the last connected BSS to the very beginning, if possible |
| 6210 | csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList); |
| 6211 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6212 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6213 | if(!HAL_STATUS_SUCCESS(status)) |
| 6214 | { |
| 6215 | csrScanResultPurge(pMac, hBSSList); |
| 6216 | break; |
| 6217 | } |
| 6218 | } |
| 6219 | else |
| 6220 | { |
| 6221 | //Do a scan on this profile |
| 6222 | //scan for this SSID only in case the AP suppresses SSID |
| 6223 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId); |
| 6224 | if(!HAL_STATUS_SUCCESS(status)) |
| 6225 | { |
| 6226 | break; |
| 6227 | } |
| 6228 | } |
| 6229 | }//We have a profile |
| 6230 | else |
| 6231 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6232 | smsLog(pMac, LOGW, FL("cannot find a roaming profile")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6233 | break; |
| 6234 | } |
| 6235 | }while(0); |
| 6236 | if(pScanFilter) |
| 6237 | { |
| 6238 | csrFreeScanFilter(pMac, pScanFilter); |
| 6239 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 6240 | } |
| 6241 | if(NULL != pProfile) |
| 6242 | { |
| 6243 | csrReleaseProfile(pMac, pProfile); |
| 6244 | palFreeMemory(pMac->hHdd, pProfile); |
| 6245 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6246 | return (status); |
| 6247 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6248 | eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6249 | { |
| 6250 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6251 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6252 | { |
| 6253 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6254 | if(HAL_STATUS_SUCCESS(status)) |
| 6255 | { |
| 6256 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6257 | } |
| 6258 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6259 | return (status); |
| 6260 | } |
| 6261 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6262 | eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6263 | { |
| 6264 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6265 | smsLog(pMac, LOGW, FL("is called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6266 | csrRoamCancelRoaming(pMac, sessionId); |
| 6267 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6268 | if(csrIsConnStateDisconnected(pMac, sessionId)) |
| 6269 | { |
| 6270 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6271 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6272 | return (status); |
| 6273 | } |
| 6274 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6275 | eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure ) |
| 6276 | { |
| 6277 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6278 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
| 6279 | eCsrRoamSubState NewSubstate; |
| 6280 | tANI_U32 sessionId = pCommand->sessionId; |
| 6281 | |
| 6282 | // change state to 'Roaming'... |
| 6283 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 6284 | |
| 6285 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 6286 | { |
| 6287 | // If we are in an IBSS, then stop the IBSS... |
| 6288 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6289 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6290 | } |
| 6291 | else if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6292 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6293 | 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] | 6294 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 6295 | //Restore AC weight in case we change it |
| 6296 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 6297 | // in Infrasturcture, we need to disassociate from the Infrastructure network... |
| 6298 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED; |
| 6299 | if(eCsrSmeIssuedDisassocForHandoff == pCommand->u.roamCmd.roamReason) |
| 6300 | { |
| 6301 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF; |
| 6302 | } |
| 6303 | if( fDisassoc ) |
| 6304 | { |
| 6305 | status = csrRoamIssueDisassociate( pMac, sessionId, NewSubstate, fMICFailure ); |
| 6306 | } |
| 6307 | else |
| 6308 | { |
| 6309 | status = csrRoamIssueDeauth( pMac, sessionId, eCSR_ROAM_SUBSTATE_DEAUTH_REQ ); |
| 6310 | } |
| 6311 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6312 | } |
| 6313 | else if ( csrIsConnStateWds( pMac, sessionId ) ) |
| 6314 | { |
| 6315 | if( CSR_IS_WDS_AP( &pMac->roam.roamSession[sessionId].connectedProfile ) ) |
| 6316 | { |
| 6317 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6318 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6319 | } |
| 6320 | //This has to be WDS station |
| 6321 | else if( csrIsConnStateConnectedWds( pMac, sessionId ) ) //This has to be WDS station |
| 6322 | { |
| 6323 | |
| 6324 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 6325 | if( fDisassoc ) |
| 6326 | { |
| 6327 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 6328 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, fMICFailure ); |
| 6329 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6330 | } |
| 6331 | } |
| 6332 | } else { |
| 6333 | // we got a dis-assoc request while not connected to any peer |
| 6334 | // just complete the command |
| 6335 | fComplete = eANI_BOOLEAN_TRUE; |
| 6336 | status = eHAL_STATUS_FAILURE; |
| 6337 | } |
| 6338 | if(fComplete) |
| 6339 | { |
| 6340 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6341 | } |
| 6342 | |
| 6343 | if(HAL_STATUS_SUCCESS(status)) |
| 6344 | { |
| 6345 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6346 | { |
| 6347 | //Set the state to disconnect here |
| 6348 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 6349 | } |
| 6350 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6351 | else |
| 6352 | { |
| 6353 | smsLog(pMac, LOGW, FL(" failed with status %d"), status); |
| 6354 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6355 | return (status); |
| 6356 | } |
| 6357 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6358 | /* This is been removed from latest code base */ |
| 6359 | /* |
| 6360 | static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 6361 | { |
| 6362 | eHalStatus status; |
| 6363 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6364 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING ); |
| 6365 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6366 | return ( status ); |
| 6367 | } |
| 6368 | */ |
| 6369 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6370 | eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason ) |
| 6371 | { |
| 6372 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6373 | tSmeCmd *pCommand; |
| 6374 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6375 | do |
| 6376 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6377 | smsLog( pMac, LOG1, FL(" reason = %d"), reason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6378 | pCommand = csrGetCommandBuffer( pMac ); |
| 6379 | if ( !pCommand ) |
| 6380 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6381 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6382 | status = eHAL_STATUS_RESOURCES; |
| 6383 | break; |
| 6384 | } |
| 6385 | //Change the substate in case it is wait-for-key |
| 6386 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 6387 | { |
| 6388 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6389 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 6390 | } |
| 6391 | pCommand->command = eSmeCommandRoam; |
| 6392 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6393 | switch ( reason ) |
| 6394 | { |
| 6395 | case eCSR_DISCONNECT_REASON_MIC_ERROR: |
| 6396 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocMICFailure; |
| 6397 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6398 | case eCSR_DISCONNECT_REASON_DEAUTH: |
| 6399 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauth; |
| 6400 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6401 | case eCSR_DISCONNECT_REASON_HANDOFF: |
| 6402 | fHighPriority = eANI_BOOLEAN_TRUE; |
| 6403 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff; |
| 6404 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6405 | case eCSR_DISCONNECT_REASON_UNSPECIFIED: |
| 6406 | case eCSR_DISCONNECT_REASON_DISASSOC: |
| 6407 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 6408 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6409 | case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE: |
| 6410 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedIbssJoinFailure; |
| 6411 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6412 | case eCSR_DISCONNECT_REASON_IBSS_LEAVE: |
| 6413 | pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave; |
| 6414 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6415 | default: |
| 6416 | break; |
| 6417 | } |
| 6418 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6419 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6420 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6421 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6422 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6423 | } |
| 6424 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6425 | return( status ); |
| 6426 | } |
| 6427 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6428 | eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority ) |
| 6429 | { |
| 6430 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6431 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6432 | pCommand = csrGetCommandBuffer( pMac ); |
| 6433 | if ( NULL != pCommand ) |
| 6434 | { |
| 6435 | //Change the substate in case it is wait-for-key |
| 6436 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 6437 | { |
| 6438 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6439 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 6440 | } |
| 6441 | pCommand->command = eSmeCommandRoam; |
| 6442 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6443 | pCommand->u.roamCmd.roamReason = eCsrStopBss; |
| 6444 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6445 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6446 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6447 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6448 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6449 | } |
| 6450 | } |
| 6451 | else |
| 6452 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6453 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6454 | status = eHAL_STATUS_RESOURCES; |
| 6455 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6456 | return ( status ); |
| 6457 | } |
| 6458 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6459 | eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 6460 | { |
| 6461 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6462 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6463 | |
| 6464 | if(!pSession) |
| 6465 | { |
| 6466 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6467 | return eHAL_STATUS_FAILURE; |
| 6468 | } |
| 6469 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6470 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6471 | //Stop te retry |
| 6472 | pSession->maxRetryCount = 0; |
| 6473 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 6474 | #endif |
| 6475 | //Not to call cancel roaming here |
| 6476 | //Only issue disconnect when necessary |
| 6477 | if(csrIsConnStateConnected(pMac, sessionId) || csrIsBssTypeIBSS(pSession->connectedProfile.BSSType) |
| 6478 | || csrIsBssTypeWDS(pSession->connectedProfile.BSSType) |
| 6479 | || csrIsRoamCommandWaitingForSession(pMac, sessionId) ) |
| 6480 | |
| 6481 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6482 | smsLog(pMac, LOG2, FL("called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6483 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, reason); |
| 6484 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6485 | return (status); |
| 6486 | } |
| 6487 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6488 | eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 6489 | { |
| 6490 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6491 | |
| 6492 | if(!pSession) |
| 6493 | { |
| 6494 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6495 | return eHAL_STATUS_FAILURE; |
| 6496 | } |
| 6497 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6498 | csrRoamCancelRoaming(pMac, sessionId); |
| 6499 | pSession->ibss_join_pending = FALSE; |
| 6500 | csrRoamStopIbssJoinTimer(pMac, sessionId); |
| 6501 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrForcedDisassoc); |
| 6502 | |
| 6503 | return (csrRoamDisconnectInternal(pMac, sessionId, reason)); |
| 6504 | } |
| 6505 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6506 | eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6507 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes) |
| 6508 | { |
| 6509 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6510 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 6511 | tANI_U8 index; |
| 6512 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 6513 | tCsrRoamConnectedProfile *pConnectProfile = &pSession->connectedProfile; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6514 | |
| 6515 | if(!pSession) |
| 6516 | { |
| 6517 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6518 | return eHAL_STATUS_FAILURE; |
| 6519 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6520 | |
| 6521 | palZeroMemory(pMac->hHdd, &pSession->connectedProfile, sizeof(tCsrRoamConnectedProfile)); |
| 6522 | pConnectProfile->AuthType = pProfile->negotiatedAuthType; |
| 6523 | pConnectProfile->AuthInfo = pProfile->AuthType; |
| 6524 | pConnectProfile->CBMode = pProfile->CBMode; //*** this may not be valid |
| 6525 | pConnectProfile->EncryptionType = pProfile->negotiatedUCEncryptionType; |
| 6526 | pConnectProfile->EncryptionInfo = pProfile->EncryptionType; |
| 6527 | pConnectProfile->mcEncryptionType = pProfile->negotiatedMCEncryptionType; |
| 6528 | pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType; |
| 6529 | pConnectProfile->BSSType = pProfile->BSSType; |
| 6530 | pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask; |
| 6531 | pConnectProfile->operationChannel = pSirBssDesc->channelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6532 | pConnectProfile->beaconInterval = pSirBssDesc->beaconInterval; |
| 6533 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6534 | palCopyMemory(pMac->hHdd, &pConnectProfile->Keys, &pProfile->Keys, sizeof(tCsrKeys)); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6535 | /* saving the addional IE`s like Hot spot indication element and extended capabilities */ |
| 6536 | if(pProfile->nAddIEAssocLength) |
| 6537 | { |
| 6538 | status = palAllocateMemory(pMac->hHdd, |
| 6539 | (void **)&pConnectProfile->pAddIEAssoc, pProfile->nAddIEAssocLength); |
| 6540 | if(!HAL_STATUS_SUCCESS(status)) |
| 6541 | { |
| 6542 | smsLog(pMac, LOGE, FL("Failed to allocate memory for additional IEs")) ; |
| 6543 | return eHAL_STATUS_FAILURE; |
| 6544 | } |
| 6545 | pConnectProfile->nAddIEAssocLength = pProfile->nAddIEAssocLength; |
| 6546 | palCopyMemory(pMac->hHdd, pConnectProfile->pAddIEAssoc, pProfile->pAddIEAssoc, |
| 6547 | pProfile->nAddIEAssocLength); |
| 6548 | } |
| 6549 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6550 | //Save bssid |
| 6551 | csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid); |
| 6552 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6553 | if (pSirBssDesc->mdiePresent) |
| 6554 | { |
| 6555 | pConnectProfile->MDID.mdiePresent = 1; |
| 6556 | pConnectProfile->MDID.mobilityDomain = (pSirBssDesc->mdie[1] << 8) | (pSirBssDesc->mdie[0]); |
| 6557 | } |
| 6558 | #endif |
| 6559 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6560 | if ((csrIsProfileCCX(pProfile) || |
| 6561 | ((pIesTemp->CCXVersion.present) |
| 6562 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 6563 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 6564 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 6565 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 6566 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6567 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6568 | { |
| 6569 | pConnectProfile->isCCXAssoc = 1; |
| 6570 | } |
| 6571 | #endif |
| 6572 | //save ssid |
| 6573 | if( NULL == pIesTemp ) |
| 6574 | { |
| 6575 | status = csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp); |
| 6576 | } |
| 6577 | if(HAL_STATUS_SUCCESS(status)) |
| 6578 | { |
| 6579 | if(pIesTemp->SSID.present) |
| 6580 | { |
| 6581 | pConnectProfile->SSID.length = pIesTemp->SSID.num_ssid; |
| 6582 | palCopyMemory(pMac->hHdd, pConnectProfile->SSID.ssId, |
| 6583 | pIesTemp->SSID.ssid, pIesTemp->SSID.num_ssid); |
| 6584 | } |
| 6585 | |
| 6586 | //Save the bss desc |
| 6587 | status = csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 6588 | |
| 6589 | if( CSR_IS_QOS_BSS(pIesTemp) || pIesTemp->HTCaps.present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6590 | { |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 6591 | //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] | 6592 | pConnectProfile->qap = TRUE; |
| 6593 | } |
| 6594 | else |
| 6595 | { |
| 6596 | pConnectProfile->qap = FALSE; |
| 6597 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6598 | if ( NULL == pIes ) |
| 6599 | { |
| 6600 | //Free memory if it allocated locally |
| 6601 | palFreeMemory(pMac->hHdd, pIesTemp); |
| 6602 | } |
| 6603 | } |
| 6604 | //Save Qos connection |
| 6605 | pConnectProfile->qosConnection = pMac->roam.roamSession[sessionId].fWMMConnection; |
| 6606 | |
| 6607 | if(!HAL_STATUS_SUCCESS(status)) |
| 6608 | { |
| 6609 | csrFreeConnectBssDesc(pMac, sessionId); |
| 6610 | } |
| 6611 | for(index = 0; index < pProfile->SSIDs.numOfSSIDs; index++) |
| 6612 | { |
| 6613 | if((pProfile->SSIDs.SSIDList[index].SSID.length == pConnectProfile->SSID.length) && |
| 6614 | palEqualMemory(pMac->hHdd, pProfile->SSIDs.SSIDList[index].SSID.ssId, |
| 6615 | pConnectProfile->SSID.ssId, pConnectProfile->SSID.length)) |
| 6616 | { |
| 6617 | pConnectProfile->handoffPermitted = pProfile->SSIDs.SSIDList[index].handoffPermitted; |
| 6618 | break; |
| 6619 | } |
| 6620 | pConnectProfile->handoffPermitted = FALSE; |
| 6621 | } |
| 6622 | |
| 6623 | return (status); |
| 6624 | } |
| 6625 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6626 | static void csrRoamJoinRspProcessor( tpAniSirGlobal pMac, tSirSmeJoinRsp *pSmeJoinRsp ) |
| 6627 | { |
| 6628 | tListElem *pEntry = NULL; |
| 6629 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6630 | //The head of the active list is the request we sent |
| 6631 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6632 | if(pEntry) |
| 6633 | { |
| 6634 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6635 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6636 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 6637 | { |
| 6638 | if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason) |
| 6639 | { |
| 6640 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6641 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 6642 | #endif |
| 6643 | } |
| 6644 | csrRoamComplete( pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp ); |
| 6645 | } |
| 6646 | else |
| 6647 | { |
| 6648 | tANI_U32 roamId = 0; |
| 6649 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6650 | if(!pSession) |
| 6651 | { |
| 6652 | smsLog(pMac, LOGE, FL(" session %d not found "), pSmeJoinRsp->sessionId); |
| 6653 | return; |
| 6654 | } |
| 6655 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6656 | |
| 6657 | //The head of the active list is the request we sent |
| 6658 | //Try to get back the same profile and roam again |
| 6659 | if(pCommand) |
| 6660 | { |
| 6661 | roamId = pCommand->u.roamCmd.roamId; |
| 6662 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6663 | pSession->joinFailStatusCode.statusCode = pSmeJoinRsp->statusCode; |
| 6664 | pSession->joinFailStatusCode.reasonCode = pSmeJoinRsp->protStatusCode; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6665 | 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] | 6666 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 6667 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 6668 | if (csrRoamIsHandoffInProgress(pMac)) |
| 6669 | { |
| 6670 | csrRoamCallCallback(pMac, pSmeJoinRsp->sessionId, NULL, roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 6671 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 6672 | csrNeighborRoamIndicateConnect(pMac, pSmeJoinRsp->sessionId, VOS_STATUS_E_FAILURE); |
| 6673 | } |
| 6674 | #endif |
| 6675 | if (pCommand) |
| 6676 | { |
| 6677 | if(CSR_IS_WDS_STA( &pCommand->u.roamCmd.roamProfile )) |
| 6678 | { |
| 6679 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 6680 | pSession->connectedProfile.BSSType = eCSR_BSS_TYPE_WDS_STA; |
| 6681 | csrRoamReissueRoamCommand(pMac); |
| 6682 | } |
| 6683 | else if( CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) ) |
| 6684 | { |
| 6685 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6686 | } |
| 6687 | else |
| 6688 | { |
| 6689 | csrRoam(pMac, pCommand); |
| 6690 | } |
| 6691 | } |
| 6692 | else |
| 6693 | { |
| 6694 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6695 | } |
| 6696 | } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */ |
| 6697 | } |
| 6698 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6699 | eHalStatus csrRoamIssueJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 6700 | tDot11fBeaconIEs *pIes, |
| 6701 | tCsrRoamProfile *pProfile, tANI_U32 roamId ) |
| 6702 | { |
| 6703 | eHalStatus status; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6704 | 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] | 6705 | pSirBssDesc->bssId[ 0 ],pSirBssDesc->bssId[ 1 ],pSirBssDesc->bssId[ 2 ], |
| 6706 | pSirBssDesc->bssId[ 3 ],pSirBssDesc->bssId[ 4 ],pSirBssDesc->bssId[ 5 ] ); |
| 6707 | |
| 6708 | // Set the roaming substate to 'join attempt'... |
| 6709 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6710 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 6711 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6712 | return (status); |
| 6713 | } |
| 6714 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6715 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 6716 | tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile) |
| 6717 | { |
| 6718 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6719 | // Set the roaming substate to 'join attempt'... |
| 6720 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId ); |
| 6721 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6722 | smsLog(pMac, LOGE, FL(" calling csrSendJoinReqMsg (eWNI_SME_REASSOC_REQ)")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6723 | |
| 6724 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 6725 | return csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_REASSOC_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6726 | } |
| 6727 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6728 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac) |
| 6729 | { |
| 6730 | tListElem *pEntry; |
| 6731 | tSmeCmd *pCommand; |
| 6732 | tCsrRoamInfo roamInfo; |
| 6733 | tANI_U32 sessionId; |
| 6734 | tCsrRoamSession *pSession; |
| 6735 | |
| 6736 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6737 | if(pEntry) |
| 6738 | { |
| 6739 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6740 | if ( eSmeCommandRoam == pCommand->command ) |
| 6741 | { |
| 6742 | sessionId = pCommand->sessionId; |
| 6743 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6744 | |
| 6745 | if(!pSession) |
| 6746 | { |
| 6747 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6748 | return; |
| 6749 | } |
| 6750 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6751 | if( pCommand->u.roamCmd.fStopWds ) |
| 6752 | { |
| 6753 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 6754 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 6755 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 6756 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6757 | if (CSR_IS_WDS(&pSession->connectedProfile)){ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6758 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 6759 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 6760 | eCSR_ROAM_WDS_IND, |
| 6761 | eCSR_ROAM_RESULT_WDS_DISASSOCIATED); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6762 | }else if (CSR_IS_INFRA_AP(&pSession->connectedProfile)){ |
| 6763 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 6764 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 6765 | eCSR_ROAM_INFRA_IND, |
| 6766 | eCSR_ROAM_RESULT_INFRA_DISASSOCIATED); |
| 6767 | } |
| 6768 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6769 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6770 | if( !HAL_STATUS_SUCCESS( csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ) ) ) |
| 6771 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6772 | 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] | 6773 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6774 | } |
| 6775 | } |
| 6776 | else if(eCsrStopRoaming == csrRoamJoinNextBss(pMac, pCommand, eANI_BOOLEAN_TRUE)) |
| 6777 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6778 | smsLog(pMac, LOGW, " Failed to reissue join command after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6779 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6780 | } |
| 6781 | } |
| 6782 | else |
| 6783 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6784 | smsLog(pMac, LOGW, " Command is not roaming after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6785 | } |
| 6786 | } |
| 6787 | else |
| 6788 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6789 | smsLog(pMac, LOGE, " Disassoc rsp cannot continue because no command is available"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6790 | } |
| 6791 | } |
| 6792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6793 | tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6794 | { |
| 6795 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 6796 | tListElem *pEntry; |
| 6797 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6798 | //alwasy lock active list before locking pending list |
| 6799 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 6800 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 6801 | if(pEntry) |
| 6802 | { |
| 6803 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6804 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 6805 | { |
| 6806 | fRet = eANI_BOOLEAN_TRUE; |
| 6807 | } |
| 6808 | } |
| 6809 | if(eANI_BOOLEAN_FALSE == fRet) |
| 6810 | { |
| 6811 | csrLLLock(&pMac->sme.smeCmdPendingList); |
| 6812 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK); |
| 6813 | while(pEntry) |
| 6814 | { |
| 6815 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6816 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 6817 | { |
| 6818 | fRet = eANI_BOOLEAN_TRUE; |
| 6819 | break; |
| 6820 | } |
| 6821 | pEntry = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK); |
| 6822 | } |
| 6823 | csrLLUnlock(&pMac->sme.smeCmdPendingList); |
| 6824 | } |
| 6825 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6826 | return (fRet); |
| 6827 | } |
| 6828 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6829 | tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac) |
| 6830 | { |
| 6831 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 6832 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6833 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 6834 | { |
| 6835 | if( CSR_IS_SESSION_VALID( pMac, i ) && ( fRet = csrIsRoamCommandWaitingForSession( pMac, i ) ) ) |
| 6836 | { |
| 6837 | break; |
| 6838 | } |
| 6839 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6840 | return ( fRet ); |
| 6841 | } |
| 6842 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6843 | tANI_BOOLEAN csrIsCommandWaiting(tpAniSirGlobal pMac) |
| 6844 | { |
| 6845 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6846 | //alwasy lock active list before locking pending list |
| 6847 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 6848 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 6849 | if(eANI_BOOLEAN_FALSE == fRet) |
| 6850 | { |
| 6851 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK); |
| 6852 | } |
| 6853 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6854 | return (fRet); |
| 6855 | } |
| 6856 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6857 | tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac ) |
| 6858 | { |
| 6859 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 6860 | tListElem *pEntry; |
| 6861 | tCsrCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6862 | //alwasy lock active list before locking pending list |
| 6863 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 6864 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 6865 | if( pEntry ) |
| 6866 | { |
| 6867 | pCommand = GET_BASE_ADDR(pEntry, tCsrCmd, Link); |
| 6868 | if( ( eCsrRoamCommandScan == pCommand->command ) && |
| 6869 | ( ( eCsrScanForSsid == pCommand->u.scanCmd.reason ) || |
| 6870 | ( eCsrScanForCapsChange == pCommand->u.scanCmd.reason ) || |
| 6871 | ( eCsrScanP2PFindPeer == pCommand->u.scanCmd.reason ) ) ) |
| 6872 | { |
| 6873 | fRet = eANI_BOOLEAN_TRUE; |
| 6874 | } |
| 6875 | } |
| 6876 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6877 | return (fRet); |
| 6878 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6879 | eHalStatus csrRoamIssueReassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 6880 | { |
| 6881 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6882 | tSmeCmd *pCommand = NULL; |
| 6883 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_TRUE; |
| 6884 | tANI_BOOLEAN fRemoveCmd = FALSE; |
| 6885 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6886 | // Delete the old assoc command. All is setup for reassoc to be serialized |
| 6887 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 6888 | if ( pEntry ) |
| 6889 | { |
| 6890 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 6891 | if ( !pCommand ) |
| 6892 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6893 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6894 | return eHAL_STATUS_RESOURCES; |
| 6895 | } |
| 6896 | if ( eSmeCommandRoam == pCommand->command ) |
| 6897 | { |
| 6898 | if (pCommand->u.roamCmd.roamReason == eCsrSmeIssuedAssocToSimilarAP) |
| 6899 | { |
| 6900 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 6901 | } |
| 6902 | else |
| 6903 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6904 | smsLog( pMac, LOGE, FL(" Unexpected active roam command present ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6905 | } |
| 6906 | if (fRemoveCmd == FALSE) |
| 6907 | { |
| 6908 | // Implies we did not get the serialized assoc command we |
| 6909 | // were expecting |
| 6910 | pCommand = NULL; |
| 6911 | } |
| 6912 | } |
| 6913 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6914 | if(NULL == pCommand) |
| 6915 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6916 | 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] | 6917 | return eHAL_STATUS_RESOURCES; |
| 6918 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6919 | do |
| 6920 | { |
| 6921 | //Change the substate in case it is wait-for-key |
| 6922 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 6923 | { |
| 6924 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6925 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 6926 | } |
| 6927 | pCommand->command = eSmeCommandRoam; |
| 6928 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6929 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedFTReassoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6930 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6931 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6932 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6933 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6934 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6935 | } |
| 6936 | } while( 0 ); |
| 6937 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6938 | return( status ); |
| 6939 | } |
| 6940 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ) |
| 6941 | { |
| 6942 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6943 | tCsrScanResult *pScanResult = NULL; |
| 6944 | tSirBssDescription *pBssDesc = NULL; |
| 6945 | tSmeCmd *pCommand = NULL; |
| 6946 | tANI_U32 sessionId; |
| 6947 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6948 | if(NULL == pEntry) |
| 6949 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6950 | smsLog(pMac, LOGW, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6951 | return; |
| 6952 | } |
| 6953 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6954 | sessionId = pCommand->sessionId; |
| 6955 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6956 | |
| 6957 | if(!pSession) |
| 6958 | { |
| 6959 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6960 | return; |
| 6961 | } |
| 6962 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6963 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 6964 | { |
| 6965 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6966 | smsLog(pMac, LOGW, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6967 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 6968 | } |
| 6969 | else |
| 6970 | { |
| 6971 | if ( CCM_IS_RESULT_SUCCESS(result) ) |
| 6972 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6973 | smsLog(pMac, LOG2, "Cfg sequence complete"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6974 | // Successfully set the configuration parameters for the new Bss. Attempt to |
| 6975 | // join the roaming Bss. |
| 6976 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 6977 | { |
| 6978 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 6979 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 6980 | } |
| 6981 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) || |
| 6982 | CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6983 | || CSR_IS_INFRA_AP(&pCommand->u.roamCmd.roamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6984 | ) |
| 6985 | { |
| 6986 | if(!HAL_STATUS_SUCCESS(csrRoamIssueStartBss( pMac, sessionId, |
| 6987 | &pSession->bssParams, &pCommand->u.roamCmd.roamProfile, |
| 6988 | pBssDesc, pCommand->u.roamCmd.roamId ))) |
| 6989 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6990 | smsLog(pMac, LOGW, " CSR start BSS failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6991 | //We need to complete the command |
| 6992 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 6993 | } |
| 6994 | } |
| 6995 | else |
| 6996 | { |
| 6997 | if (!pCommand->u.roamCmd.pRoamBssEntry) |
| 6998 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6999 | smsLog(pMac, LOGW, " pRoamBssEntry is NULL"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7000 | //We need to complete the command |
| 7001 | csrRoamComplete(pMac, eCsrJoinFailure, NULL); |
| 7002 | return; |
| 7003 | } |
| 7004 | // If we are roaming TO an Infrastructure BSS... |
| 7005 | VOS_ASSERT(pScanResult != NULL); |
| 7006 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7007 | { |
| 7008 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7009 | if(pIesLocal || (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 7010 | { |
| 7011 | // ..and currently in an Infrastructure connection.... |
| 7012 | if( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 7013 | { |
| 7014 | // ...and the SSIDs are equal, then we Reassoc. |
| 7015 | if ( csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, |
| 7016 | pIesLocal ) ) |
| 7017 | // ..and currently in an infrastructure connection |
| 7018 | { |
| 7019 | // then issue a Reassoc. |
| 7020 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
| 7021 | csrRoamIssueReassociate( pMac, sessionId, pBssDesc, pIesLocal, |
| 7022 | &pCommand->u.roamCmd.roamProfile ); |
| 7023 | } |
| 7024 | else |
| 7025 | { |
| 7026 | |
| 7027 | // otherwise, we have to issue a new Join request to LIM because we disassociated from the |
| 7028 | // previously associated AP. |
| 7029 | if(!HAL_STATUS_SUCCESS(csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7030 | pIesLocal, |
| 7031 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ))) |
| 7032 | { |
| 7033 | //try something else |
| 7034 | csrRoam( pMac, pCommand ); |
| 7035 | } |
| 7036 | } |
| 7037 | } |
| 7038 | else |
| 7039 | { |
| 7040 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7041 | |
| 7042 | /* We need to come with other way to figure out that this is because of HO in BMP |
| 7043 | The below API will be only available for Android as it uses a different HO algorithm */ |
| 7044 | /* Reassoc request will be used only for CCX and 11r handoff whereas other legacy roaming should |
| 7045 | * use join request */ |
| 7046 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7047 | if (csrRoamIsHandoffInProgress(pMac) && |
| 7048 | csrRoamIs11rAssoc(pMac)) |
| 7049 | { |
| 7050 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 7051 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 7052 | } |
| 7053 | else |
| 7054 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7055 | #ifdef FEATURE_WLAN_CCX |
| 7056 | if (csrRoamIsHandoffInProgress(pMac) && |
| 7057 | csrRoamIsCCXAssoc(pMac)) |
| 7058 | { |
| 7059 | // Now serialize the reassoc command. |
| 7060 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7061 | } |
| 7062 | else |
| 7063 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7064 | #ifdef FEATURE_WLAN_LFR |
| 7065 | if (csrRoamIsHandoffInProgress(pMac) && |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 7066 | csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7067 | { |
| 7068 | // Now serialize the reassoc command. |
| 7069 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7070 | } |
| 7071 | else |
| 7072 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7073 | // else we are not connected and attempting to Join. Issue the |
| 7074 | // Join request. |
| 7075 | { |
| 7076 | status = csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7077 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), |
| 7078 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ); |
| 7079 | } |
| 7080 | if(!HAL_STATUS_SUCCESS(status)) |
| 7081 | { |
| 7082 | //try something else |
| 7083 | csrRoam( pMac, pCommand ); |
| 7084 | } |
| 7085 | } |
| 7086 | if( !pScanResult->Result.pvIes ) |
| 7087 | { |
| 7088 | //Locally allocated |
| 7089 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 7090 | } |
| 7091 | } |
| 7092 | }//if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7093 | else |
| 7094 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7095 | smsLog(pMac, LOGW, FL(" found BSSType mismatching the one in BSS description")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7096 | } |
| 7097 | }//else |
| 7098 | }//if ( WNI_CFG_SUCCESS == result ) |
| 7099 | else |
| 7100 | { |
| 7101 | // In the event the configuration failed, for infra let the roam processor |
| 7102 | //attempt to join something else... |
| 7103 | if( pCommand->u.roamCmd.pRoamBssEntry && CSR_IS_INFRASTRUCTURE( &pCommand->u.roamCmd.roamProfile ) ) |
| 7104 | { |
| 7105 | csrRoam(pMac, pCommand); |
| 7106 | } |
| 7107 | else |
| 7108 | { |
| 7109 | //We need to complete the command |
| 7110 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) ) |
| 7111 | { |
| 7112 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7113 | } |
| 7114 | else |
| 7115 | { |
| 7116 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7117 | } |
| 7118 | } |
| 7119 | } |
| 7120 | }//we have active entry |
| 7121 | } |
| 7122 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7123 | static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp ) |
| 7124 | { |
| 7125 | //No one is sending eWNI_SME_AUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7126 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7127 | if ( eSIR_SME_SUCCESS == pSmeAuthRsp->statusCode ) |
| 7128 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7129 | smsLog( pMac, LOGW, "CSR SmeAuthReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7130 | // Successfully authenticated with a new Bss. Attempt to stop the current Bss and |
| 7131 | // join the new one... |
| 7132 | /***pBssDesc = profGetRoamingBssDesc( pAdapter, &pHddProfile ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7133 | roamStopNetwork( pAdapter, &pBssDesc->SirBssDescription );***/ |
| 7134 | } |
| 7135 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7136 | 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] | 7137 | /***profHandleLostLinkAfterReset(pAdapter); |
| 7138 | // In the event the authenticate fails, let the roam processor attempt to join something else... |
| 7139 | roamRoam( pAdapter );***/ |
| 7140 | } |
| 7141 | } |
| 7142 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7143 | static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSmeJoinRsp pSmeJoinRsp ) |
| 7144 | { |
| 7145 | eCsrRoamCompleteResult result; |
| 7146 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 7147 | tCsrRoamInfo roamInfo; |
| 7148 | tANI_U32 roamId = 0; |
| 7149 | |
| 7150 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 7151 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7152 | smsLog( pMac, LOGW, "CSR SmeReassocReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7153 | result = eCsrReassocSuccess; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7154 | /* Defeaturize this part later if needed */ |
| 7155 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7156 | /* Since the neighbor roam algorithm uses reassoc req for handoff instead of join, |
| 7157 | * we need the response contents while processing the result in csrRoamProcessResults() */ |
| 7158 | if (csrRoamIsHandoffInProgress(pMac)) |
| 7159 | { |
| 7160 | /* Need to dig more on indicating events to SME QoS module */ |
| 7161 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 7162 | csrRoamComplete( pMac, result, pSmeJoinRsp); |
| 7163 | } |
| 7164 | else |
| 7165 | #endif |
| 7166 | { |
| 7167 | csrRoamComplete( pMac, result, NULL ); |
| 7168 | } |
| 7169 | } |
| 7170 | /* Should we handle this similar to handling the join failure? Is it ok |
| 7171 | * to call csrRoamComplete() with state as CsrJoinFailure */ |
| 7172 | else |
| 7173 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7174 | 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] | 7175 | result = eCsrReassocFailure; |
| 7176 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7177 | if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) || |
| 7178 | (eSIR_SME_FT_REASSOC_FAILURE == pSmeJoinRsp->statusCode)) |
| 7179 | { |
| 7180 | // Inform HDD to turn off FT flag in HDD |
| 7181 | if (pNeighborRoamInfo) |
| 7182 | { |
| 7183 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7184 | csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, |
| 7185 | &roamInfo, roamId, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
Madan Mohan Koyyalamudi | 5777216 | 2012-10-18 19:46:14 -0700 | [diff] [blame] | 7186 | /* |
| 7187 | * Since the above callback sends a disconnect |
| 7188 | * to HDD, we should clean-up our state |
| 7189 | * machine as well to be in sync with the upper |
| 7190 | * layers. There is no need to send a disassoc |
| 7191 | * since: 1) we will never reassoc to the current |
| 7192 | * AP in LFR, and 2) there is no need to issue a |
| 7193 | * disassoc to the AP with which we were trying |
| 7194 | * to reassoc. |
| 7195 | */ |
| 7196 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7197 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7198 | } |
| 7199 | } |
| 7200 | #endif |
| 7201 | // In the event that the Reassociation fails, then we need to Disassociate the current association and keep |
| 7202 | // roaming. Note that we will attempt to Join the AP instead of a Reassoc since we may have attempted a |
| 7203 | // 'Reassoc to self', which AP's that don't support Reassoc will force a Disassoc. |
| 7204 | //The disassoc rsp message will remove the command from active list |
| 7205 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, pSmeJoinRsp->sessionId, |
| 7206 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE ))) |
| 7207 | { |
| 7208 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7209 | } |
| 7210 | } |
| 7211 | } |
| 7212 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7213 | static void csrRoamRoamingStateStopBssRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSmeRsp) |
| 7214 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7215 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7216 | { |
| 7217 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7218 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 7219 | if(pIbssLog) |
| 7220 | { |
| 7221 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_RSP; |
| 7222 | if(eSIR_SME_SUCCESS != pSmeRsp->statusCode) |
| 7223 | { |
| 7224 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 7225 | } |
| 7226 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 7227 | } |
| 7228 | } |
| 7229 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7230 | pMac->roam.roamSession[pSmeRsp->sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7231 | if(CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, pSmeRsp->sessionId)) |
| 7232 | { |
| 7233 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7234 | } |
| 7235 | else if(CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId)) |
| 7236 | { |
| 7237 | csrRoamReissueRoamCommand(pMac); |
| 7238 | } |
| 7239 | } |
| 7240 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7241 | void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeRsp ) |
| 7242 | { |
| 7243 | tSirResultCodes statusCode; |
| 7244 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7245 | tScanResultHandle hBSSList; |
| 7246 | tANI_BOOLEAN fCallCallback, fRemoveCmd; |
| 7247 | eHalStatus status; |
| 7248 | tCsrRoamInfo roamInfo; |
| 7249 | tCsrScanResultFilter *pScanFilter = NULL; |
| 7250 | tANI_U32 roamId = 0; |
| 7251 | tCsrRoamProfile *pCurRoamProfile = NULL; |
| 7252 | tListElem *pEntry = NULL; |
| 7253 | tSmeCmd *pCommand = NULL; |
| 7254 | #endif |
| 7255 | tANI_U32 sessionId; |
| 7256 | tCsrRoamSession *pSession; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7257 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7258 | tSirSmeDisassocRsp SmeDisassocRsp; |
| 7259 | |
| 7260 | csrSerDesUnpackDiassocRsp((tANI_U8 *)pSmeRsp, &SmeDisassocRsp); |
| 7261 | sessionId = SmeDisassocRsp.sessionId; |
| 7262 | statusCode = SmeDisassocRsp.statusCode; |
| 7263 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7264 | smsLog( pMac, LOG2, "csrRoamRoamingStateDisassocRspProcessor sessionId %d", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7265 | |
| 7266 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 7267 | { |
| 7268 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7269 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7270 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7271 | |
| 7272 | if(!pSession) |
| 7273 | { |
| 7274 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7275 | return; |
| 7276 | } |
| 7277 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7278 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) ) |
| 7279 | { |
| 7280 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7281 | } |
| 7282 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, sessionId ) || |
| 7283 | CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, sessionId ) ) |
| 7284 | { |
| 7285 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7286 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7287 | smsLog( pMac, LOG2, "CSR SmeDisassocReq force disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7288 | //A callback to HDD will be issued from csrRoamComplete so no need to do anything here |
| 7289 | } |
| 7290 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7291 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7292 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId ) ) |
| 7293 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7294 | smsLog( pMac, LOGE, "CSR SmeDisassocReq due to HO on session %d", sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7295 | #if defined (WLAN_FEATURE_NEIGHBOR_ROAMING) |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7296 | /* |
| 7297 | * First ensure if the roam profile is in the scan cache. |
| 7298 | * If not, post a reassoc failure and disconnect. |
| 7299 | */ |
| 7300 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 7301 | if(HAL_STATUS_SUCCESS(status)) |
| 7302 | { |
| 7303 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 7304 | status = csrRoamPrepareFilterFromProfile(pMac, |
| 7305 | &pMac->roam.neighborRoamInfo.csrNeighborRoamProfile, pScanFilter); |
| 7306 | if(!HAL_STATUS_SUCCESS(status)) |
| 7307 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7308 | 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] | 7309 | __func__, status); |
| 7310 | goto POST_ROAM_FAILURE; |
| 7311 | } |
| 7312 | else |
| 7313 | { |
| 7314 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 7315 | if (!HAL_STATUS_SUCCESS(status)) |
| 7316 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7317 | smsLog( pMac, LOGE,"%s: csrScanGetResult failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7318 | __func__, status); |
| 7319 | goto POST_ROAM_FAILURE; |
| 7320 | } |
| 7321 | } |
| 7322 | } |
| 7323 | else |
| 7324 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7325 | smsLog( pMac, LOGE,"%s: alloc for pScanFilter failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7326 | __func__, status); |
| 7327 | goto POST_ROAM_FAILURE; |
| 7328 | } |
| 7329 | |
| 7330 | /* |
| 7331 | * After ensuring that the roam profile is in the scan result list, |
| 7332 | * dequeue the command from the active list. |
| 7333 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7334 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 7335 | if ( pEntry ) |
| 7336 | { |
| 7337 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7338 | /* If the head of the queue is Active and it is a ROAM command, remove |
| 7339 | * and put this on the Free queue. |
| 7340 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7341 | if ( eSmeCommandRoam == pCommand->command ) |
| 7342 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7343 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7344 | /* |
| 7345 | * we need to process the result first before removing it from active list |
| 7346 | * because state changes still happening insides roamQProcessRoamResults so |
| 7347 | * no other roam command should be issued. |
| 7348 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7349 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 7350 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 7351 | { |
| 7352 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 7353 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 7354 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7355 | if( fRemoveCmd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7356 | csrReleaseCommandRoam( pMac, pCommand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7357 | else |
| 7358 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7359 | smsLog( pMac, LOGE, "%s: fail to remove cmd reason %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7360 | __func__, pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7361 | } |
| 7362 | } |
| 7363 | else |
| 7364 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7365 | smsLog( pMac, LOGE, "%s: roam command not active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7366 | } |
| 7367 | } |
| 7368 | else |
| 7369 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7370 | smsLog( pMac, LOGE, "%s: NO commands are active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7371 | } |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7372 | |
| 7373 | /* Notify HDD about handoff and provide the BSSID too */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7374 | roamInfo.reasonCode = eCsrRoamReasonBetterAP; |
| 7375 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7376 | palCopyMemory(pMac->hHdd, roamInfo.bssid, |
| 7377 | pMac->roam.neighborRoamInfo.csrNeighborRoamProfile.BSSIDs.bssid, |
| 7378 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7379 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7380 | csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, |
| 7381 | eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7382 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7383 | /* Copy the connected profile to apply the same for this connection as well */ |
| 7384 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 7385 | (void **)&pCurRoamProfile, sizeof(tCsrRoamProfile)))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7386 | { |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7387 | palZeroMemory(pMac->hHdd, pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 7388 | csrRoamCopyProfile(pMac, pCurRoamProfile, pSession->pCurRoamProfile); |
| 7389 | //make sure to put it at the head of the cmd queue |
| 7390 | status = csrRoamIssueConnect(pMac, sessionId, pCurRoamProfile, |
| 7391 | hBSSList, eCsrSmeIssuedAssocToSimilarAP, |
| 7392 | roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE); |
| 7393 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7394 | if(!HAL_STATUS_SUCCESS(status)) |
| 7395 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7396 | smsLog( pMac, LOGE,"%s: csrRoamIssueConnect failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7397 | __func__, status); |
| 7398 | fCallCallback = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7399 | } |
| 7400 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7401 | /* Notify sub-modules like QoS etc. that handoff happening */ |
| 7402 | sme_QosCsrEventInd(pMac, sessionId, SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 7403 | csrReleaseProfile(pMac, pCurRoamProfile); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7404 | palFreeMemory(pMac->hHdd, pCurRoamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7405 | csrFreeScanFilter(pMac, pScanFilter); |
| 7406 | palFreeMemory( pMac->hHdd, pScanFilter ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7407 | return; |
| 7408 | } |
| 7409 | |
| 7410 | POST_ROAM_FAILURE: |
| 7411 | if (pScanFilter) |
| 7412 | { |
| 7413 | csrFreeScanFilter(pMac, pScanFilter); |
| 7414 | palFreeMemory( pMac->hHdd, pScanFilter ); |
| 7415 | } |
| 7416 | if (pCurRoamProfile) |
| 7417 | palFreeMemory(pMac->hHdd, pCurRoamProfile); |
| 7418 | |
| 7419 | /* Inform the upper layers that the reassoc failed */ |
| 7420 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7421 | csrRoamCallCallback(pMac, sessionId, |
| 7422 | &roamInfo, 0, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
| 7423 | |
| 7424 | /* |
| 7425 | * Issue a disassoc request so that PE/LIM uses this to clean-up the FT session. |
| 7426 | * Upon success, we would re-enter this routine after receiving the disassoc |
| 7427 | * response and will fall into the reassoc fail sub-state. And, eventually |
| 7428 | * call csrRoamComplete which would remove the roam command from SME active |
| 7429 | * queue. |
| 7430 | */ |
| 7431 | if (!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate(pMac, sessionId, |
| 7432 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE))) |
| 7433 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7434 | smsLog( pMac, LOGE,"%s: csrRoamIssueDisassociate failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7435 | __func__, status); |
| 7436 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7437 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7438 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7440 | } //else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) ) |
| 7441 | else if ( CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, sessionId ) ) |
| 7442 | { |
| 7443 | // Disassoc due to Reassoc failure falls into this codepath.... |
| 7444 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7445 | } |
| 7446 | else |
| 7447 | { |
| 7448 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7449 | { |
| 7450 | // Successfully disassociated from the 'old' Bss... |
| 7451 | // |
| 7452 | // We get Disassociate response in three conditions. |
| 7453 | // - First is the case where we are disasociating from an Infra Bss to start an IBSS. |
| 7454 | // - Second is the when we are disassociating from an Infra Bss to join an IBSS or a new |
| 7455 | // Infrastructure network. |
| 7456 | // - Third is where we are doing an Infra to Infra roam between networks with different |
| 7457 | // SSIDs. In all cases, we set the new Bss configuration here and attempt to join |
| 7458 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7459 | smsLog( pMac, LOG2, "CSR SmeDisassocReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7460 | } |
| 7461 | else |
| 7462 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7463 | smsLog( pMac, LOGE, "SmeDisassocReq failed with statusCode= 0x%08lX", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7464 | } |
| 7465 | //We are not done yet. Get the data and continue roaming |
| 7466 | csrRoamReissueRoamCommand(pMac); |
| 7467 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7468 | } |
| 7469 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7470 | static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp ) |
| 7471 | { |
| 7472 | tSirResultCodes statusCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7473 | //No one is sending eWNI_SME_DEAUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7474 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7475 | statusCode = csrGetDeAuthRspStatusCode( pSmeRsp ); |
| 7476 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 7477 | { |
| 7478 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7479 | } |
| 7480 | else |
| 7481 | { |
| 7482 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7483 | { |
| 7484 | // Successfully deauth from the 'old' Bss... |
| 7485 | // |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7486 | smsLog( pMac, LOG2, "CSR SmeDeauthReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7487 | } |
| 7488 | else |
| 7489 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7490 | smsLog( pMac, LOGW, "SmeDeauthReq failed with statusCode= 0x%08lX", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7491 | } |
| 7492 | //We are not done yet. Get the data and continue roaming |
| 7493 | csrRoamReissueRoamCommand(pMac); |
| 7494 | } |
| 7495 | } |
| 7496 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7497 | static void csrRoamRoamingStateStartBssRspProcessor( tpAniSirGlobal pMac, tSirSmeStartBssRsp *pSmeStartBssRsp ) |
| 7498 | { |
| 7499 | eCsrRoamCompleteResult result; |
| 7500 | |
| 7501 | if ( eSIR_SME_SUCCESS == pSmeStartBssRsp->statusCode ) |
| 7502 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7503 | smsLog( pMac, LOGW, "SmeStartBssReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7504 | result = eCsrStartBssSuccess; |
| 7505 | } |
| 7506 | else |
| 7507 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7508 | smsLog( pMac, LOGW, "SmeStartBssReq failed with statusCode= 0x%08lX", pSmeStartBssRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7509 | //Let csrRoamComplete decide what to do |
| 7510 | result = eCsrStartBssFailure; |
| 7511 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7512 | csrRoamComplete( pMac, result, pSmeStartBssRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7513 | } |
| 7514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7515 | /* |
| 7516 | We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of strucutres. |
| 7517 | It depends on how the message is constructed. If the message is sent by limSendSmeRsp, |
| 7518 | the pMsgBuf is only a generic response and can only be used as pointer to tSirSmeRsp. |
| 7519 | For the messages where sender allocates memory for specific structures, then it can be |
| 7520 | cast accordingly. |
| 7521 | */ |
| 7522 | void csrRoamingStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 7523 | { |
| 7524 | tSirSmeRsp *pSmeRsp; |
| 7525 | tSmeIbssPeerInd *pIbssPeerInd; |
| 7526 | tCsrRoamInfo roamInfo; |
| 7527 | // TODO Session Id need to be acquired in this function |
| 7528 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7529 | pSmeRsp = (tSirSmeRsp *)pMsgBuf; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7530 | smsLog( pMac, LOG2, "Message %d[0x%04X] received in substate %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7531 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 7532 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7533 | pSmeRsp->messageType = (pSmeRsp->messageType); |
| 7534 | pSmeRsp->length = (pSmeRsp->length); |
| 7535 | pSmeRsp->statusCode = (pSmeRsp->statusCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7536 | switch (pSmeRsp->messageType) |
| 7537 | { |
| 7538 | |
| 7539 | case eWNI_SME_JOIN_RSP: // in Roaming state, process the Join response message... |
| 7540 | if (CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, pSmeRsp->sessionId)) |
| 7541 | { |
| 7542 | //We sent a JOIN_REQ |
| 7543 | csrRoamJoinRspProcessor( pMac, (tSirSmeJoinRsp *)pSmeRsp ); |
| 7544 | } |
| 7545 | break; |
| 7546 | |
| 7547 | case eWNI_SME_AUTH_RSP: // or the Authenticate response message... |
| 7548 | if (CSR_IS_ROAM_SUBSTATE_AUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 7549 | { |
| 7550 | //We sent a AUTH_REQ |
| 7551 | csrRoamRoamingStateAuthRspProcessor( pMac, (tSirSmeAuthRsp *)pSmeRsp ); |
| 7552 | } |
| 7553 | break; |
| 7554 | |
| 7555 | case eWNI_SME_REASSOC_RSP: // or the Reassociation response message... |
| 7556 | if (CSR_IS_ROAM_SUBSTATE_REASSOC_REQ( pMac, pSmeRsp->sessionId) ) |
| 7557 | { |
| 7558 | csrRoamRoamingStateReassocRspProcessor( pMac, (tpSirSmeJoinRsp )pSmeRsp ); |
| 7559 | } |
| 7560 | break; |
| 7561 | |
| 7562 | case eWNI_SME_STOP_BSS_RSP: // or the Stop Bss response message... |
| 7563 | { |
| 7564 | csrRoamRoamingStateStopBssRspProcessor(pMac, pSmeRsp); |
| 7565 | } |
| 7566 | break; |
| 7567 | |
| 7568 | case eWNI_SME_DISASSOC_RSP: // or the Disassociate response message... |
| 7569 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, pSmeRsp->sessionId ) || |
| 7570 | CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, pSmeRsp->sessionId ) || |
| 7571 | CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, pSmeRsp->sessionId ) || |
| 7572 | CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, pSmeRsp->sessionId ) || |
| 7573 | CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId ) || |
| 7574 | //HO |
| 7575 | CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, pSmeRsp->sessionId ) ) |
| 7576 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7577 | 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] | 7578 | csrRoamRoamingStateDisassocRspProcessor( pMac, (tSirSmeDisassocRsp *)pSmeRsp ); |
| 7579 | } |
| 7580 | break; |
| 7581 | |
| 7582 | case eWNI_SME_DEAUTH_RSP: // or the Deauthentication response message... |
| 7583 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId ) ) |
| 7584 | { |
| 7585 | csrRoamRoamingStateDeauthRspProcessor( pMac, (tSirSmeDeauthRsp *)pSmeRsp ); |
| 7586 | } |
| 7587 | break; |
| 7588 | |
| 7589 | case eWNI_SME_START_BSS_RSP: // or the Start BSS response message... |
| 7590 | if (CSR_IS_ROAM_SUBSTATE_START_BSS_REQ( pMac, pSmeRsp->sessionId ) ) |
| 7591 | { |
| 7592 | csrRoamRoamingStateStartBssRspProcessor( pMac, (tSirSmeStartBssRsp *)pSmeRsp ); |
| 7593 | } |
| 7594 | break; |
| 7595 | |
| 7596 | case WNI_CFG_SET_CNF: // process the Config Confirm messages when we are in 'Config' substate... |
| 7597 | if ( CSR_IS_ROAM_SUBSTATE_CONFIG( pMac, pSmeRsp->sessionId ) ) |
| 7598 | { |
| 7599 | csrRoamingStateConfigCnfProcessor( pMac, ((tCsrCfgSetRsp *)pSmeRsp)->respStatus ); |
| 7600 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7601 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7602 | //In case CSR issues STOP_BSS, we need to tell HDD about peer departed becasue PE is removing them |
| 7603 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 7604 | pIbssPeerInd = (tSmeIbssPeerInd*)pSmeRsp; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7605 | smsLog(pMac, LOGE, "CSR: Peer departed notification from LIM in joining state"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7606 | palZeroMemory( pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo) ); |
| 7607 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 7608 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 7609 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 7610 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 7611 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 7612 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 7613 | eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 7614 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7615 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7616 | 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] | 7617 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 7618 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
| 7619 | |
| 7620 | //If we are connected, check the link status change |
| 7621 | if(!csrIsConnStateDisconnected(pMac, sessionId)) |
| 7622 | { |
| 7623 | csrRoamCheckForLinkStatusChange( pMac, pSmeRsp ); |
| 7624 | } |
| 7625 | break; |
| 7626 | } |
| 7627 | } |
| 7628 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7629 | void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 7630 | { |
| 7631 | tSirSmeRsp *pSirMsg = (tSirSmeRsp *)pMsgBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7632 | switch (pSirMsg->messageType) |
| 7633 | { |
| 7634 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7635 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7636 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 7637 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7638 | case eWNI_SME_UPPER_LAYER_ASSOC_CNF: |
| 7639 | { |
| 7640 | tCsrRoamSession *pSession; |
| 7641 | tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf; |
| 7642 | tCsrRoamInfo roamInfo; |
| 7643 | tCsrRoamInfo *pRoamInfo = NULL; |
| 7644 | tANI_U32 sessionId; |
| 7645 | eHalStatus status; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7646 | smsLog( pMac, LOG1, FL("ASSOCIATION confirmation can be given to upper layer ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7647 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 7648 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7649 | pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf; |
| 7650 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId ); |
| 7651 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7652 | |
| 7653 | if(!pSession) |
| 7654 | { |
| 7655 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7656 | return; |
| 7657 | } |
| 7658 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7659 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 7660 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7661 | pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid; |
| 7662 | pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length; |
| 7663 | pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7664 | pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length; |
| 7665 | pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7666 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, sizeof(tSirMacAddr)); |
| 7667 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7668 | pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7669 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) ) |
| 7670 | { |
| 7671 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED; |
| 7672 | pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq; |
| 7673 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 7674 | } |
| 7675 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 7676 | { |
| 7677 | vos_sleep( 100 ); |
| 7678 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta |
| 7679 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
| 7680 | } |
| 7681 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7682 | } |
| 7683 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7684 | default: |
| 7685 | csrRoamCheckForLinkStatusChange( pMac, pSirMsg ); |
| 7686 | break; |
| 7687 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7688 | } |
| 7689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7690 | eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, |
| 7691 | tSirBssDescription *pBssDescription, |
| 7692 | tSirMacAddr *bssId, tANI_BOOLEAN addKey, |
| 7693 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 7694 | tANI_U8 keyId, tANI_U16 keyLength, |
| 7695 | tANI_U8 *pKey, tANI_U8 paeRole ) |
| 7696 | { |
| 7697 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7698 | tAniEdType edType; |
| 7699 | |
| 7700 | if(eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType) |
| 7701 | { |
| 7702 | EncryptType = eCSR_ENCRYPT_TYPE_NONE; //*** |
| 7703 | } |
| 7704 | |
| 7705 | edType = csrTranslateEncryptTypeToEdType( EncryptType ); |
| 7706 | |
| 7707 | // Allow 0 keys to be set for the non-WPA encrypt types... For WPA encrypt types, the num keys must be non-zero |
| 7708 | // or LIM will reject the set context (assumes the SET_CONTEXT does not occur until the keys are distrubuted). |
| 7709 | if ( CSR_IS_ENC_TYPE_STATIC( EncryptType ) || |
| 7710 | addKey ) |
| 7711 | { |
| 7712 | tCsrRoamSetKey setKey; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7713 | setKey.encType = EncryptType; |
| 7714 | setKey.keyDirection = aniKeyDirection; //Tx, Rx or Tx-and-Rx |
| 7715 | palCopyMemory( pMac->hHdd, &setKey.peerMac, bssId, sizeof(tCsrBssid) ); |
| 7716 | setKey.paeRole = paeRole; //0 for supplicant |
| 7717 | setKey.keyId = keyId; // Kye index |
| 7718 | setKey.keyLength = keyLength; |
| 7719 | if( keyLength ) |
| 7720 | { |
| 7721 | palCopyMemory( pMac->hHdd, setKey.Key, pKey, keyLength ); |
| 7722 | } |
| 7723 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, &setKey, 0 ); |
| 7724 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7725 | return (status); |
| 7726 | } |
| 7727 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7728 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 7729 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 7730 | { |
| 7731 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 7732 | tSmeCmd *pCommand = NULL; |
| 7733 | #ifdef FEATURE_WLAN_CCX |
| 7734 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7735 | #endif /* FEATURE_WLAN_CCX */ |
| 7736 | |
| 7737 | do |
| 7738 | { |
| 7739 | pCommand = csrGetCommandBuffer(pMac); |
| 7740 | if(NULL == pCommand) |
| 7741 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7742 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7743 | status = eHAL_STATUS_RESOURCES; |
| 7744 | break; |
| 7745 | } |
| 7746 | pCommand->command = eSmeCommandSetKey; |
| 7747 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7748 | // validate the key length, Adjust if too long... |
| 7749 | // for static WEP the keys are not set thru' SetContextReq |
| 7750 | if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || |
| 7751 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ) ) |
| 7752 | { |
| 7753 | //KeyLength maybe 0 for static WEP |
| 7754 | if( pSetKey->keyLength ) |
| 7755 | { |
| 7756 | if ( pSetKey->keyLength < CSR_WEP40_KEY_LEN ) |
| 7757 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7758 | smsLog( pMac, LOGW, "Invalid WEP40 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7759 | break; |
| 7760 | } |
| 7761 | |
| 7762 | pCommand->u.setKeyCmd.keyLength = CSR_WEP40_KEY_LEN; |
| 7763 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP40_KEY_LEN ); |
| 7764 | } |
| 7765 | } |
| 7766 | else if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || |
| 7767 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ) ) |
| 7768 | { |
| 7769 | //KeyLength maybe 0 for static WEP |
| 7770 | if( pSetKey->keyLength ) |
| 7771 | { |
| 7772 | if ( pSetKey->keyLength < CSR_WEP104_KEY_LEN ) |
| 7773 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7774 | smsLog( pMac, LOGW, "Invalid WEP104 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7775 | break; |
| 7776 | } |
| 7777 | |
| 7778 | pCommand->u.setKeyCmd.keyLength = CSR_WEP104_KEY_LEN; |
| 7779 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP104_KEY_LEN ); |
| 7780 | } |
| 7781 | } |
| 7782 | else if ( eCSR_ENCRYPT_TYPE_TKIP == pSetKey->encType ) |
| 7783 | { |
| 7784 | if ( pSetKey->keyLength < CSR_TKIP_KEY_LEN ) |
| 7785 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7786 | smsLog( pMac, LOGW, "Invalid TKIP keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7787 | break; |
| 7788 | } |
| 7789 | pCommand->u.setKeyCmd.keyLength = CSR_TKIP_KEY_LEN; |
| 7790 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_TKIP_KEY_LEN ); |
| 7791 | } |
| 7792 | else if ( eCSR_ENCRYPT_TYPE_AES == pSetKey->encType ) |
| 7793 | { |
| 7794 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 7795 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7796 | 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] | 7797 | break; |
| 7798 | } |
| 7799 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
| 7800 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN ); |
| 7801 | } |
| 7802 | #ifdef FEATURE_WLAN_WAPI |
| 7803 | else if ( eCSR_ENCRYPT_TYPE_WPI == pSetKey->encType ) |
| 7804 | { |
| 7805 | if ( pSetKey->keyLength < CSR_WAPI_KEY_LEN ) |
| 7806 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7807 | smsLog( pMac, LOGW, "Invalid WAPI keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7808 | break; |
| 7809 | } |
| 7810 | pCommand->u.setKeyCmd.keyLength = CSR_WAPI_KEY_LEN; |
| 7811 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WAPI_KEY_LEN ); |
| 7812 | } |
| 7813 | #endif /* FEATURE_WLAN_WAPI */ |
| 7814 | #ifdef FEATURE_WLAN_CCX |
| 7815 | else if ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 7816 | { |
| 7817 | if ( pSetKey->keyLength < CSR_KRK_KEY_LEN ) |
| 7818 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7819 | smsLog( pMac, LOGW, "Invalid KRK keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7820 | break; |
| 7821 | } |
| 7822 | palCopyMemory( pMac->hHdd, pSession->ccxCckmInfo.krk, pSetKey->Key, CSR_KRK_KEY_LEN ); |
| 7823 | pSession->ccxCckmInfo.reassoc_req_num=1; |
| 7824 | pSession->ccxCckmInfo.krk_plumbed = eANI_BOOLEAN_TRUE; |
| 7825 | status = eHAL_STATUS_SUCCESS; |
| 7826 | break; |
| 7827 | } |
| 7828 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7829 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7830 | #ifdef WLAN_FEATURE_11W |
| 7831 | //Check for 11w BIP |
| 7832 | else if ( eCSR_ENCRYPT_TYPE_AES_CMAC == pSetKey->encType ) |
| 7833 | { |
| 7834 | tANI_U16 count = 0; |
| 7835 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 7836 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7837 | 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] | 7838 | break; |
| 7839 | } |
| 7840 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
| 7841 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN ); |
| 7842 | } |
| 7843 | #endif |
| 7844 | status = eHAL_STATUS_SUCCESS; |
| 7845 | pCommand->u.setKeyCmd.roamId = roamId; |
| 7846 | pCommand->u.setKeyCmd.encType = pSetKey->encType; |
| 7847 | pCommand->u.setKeyCmd.keyDirection = pSetKey->keyDirection; //Tx, Rx or Tx-and-Rx |
| 7848 | palCopyMemory( pMac->hHdd, &pCommand->u.setKeyCmd.peerMac, &pSetKey->peerMac, sizeof(tCsrBssid) ); |
| 7849 | pCommand->u.setKeyCmd.paeRole = pSetKey->paeRole; //0 for supplicant |
| 7850 | pCommand->u.setKeyCmd.keyId = pSetKey->keyId; |
| 7851 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.keyRsc, pSetKey->keyRsc, CSR_MAX_RSC_LEN ); |
| 7852 | //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 |
| 7853 | |
| 7854 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 7855 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7856 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7857 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7858 | } |
| 7859 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7860 | // Free the command if there has been a failure, or it is a |
| 7861 | // "local" operation like the set CCX CCKM KRK key. |
| 7862 | if( (!HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand )) |
| 7863 | #ifdef FEATURE_WLAN_CCX |
| 7864 | || ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 7865 | #endif /* FEATURE_WLAN_CCX */ |
| 7866 | ) |
| 7867 | { |
| 7868 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 7869 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7870 | return( status ); |
| 7871 | } |
| 7872 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7873 | eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 7874 | tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId ) |
| 7875 | { |
| 7876 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 7877 | tSmeCmd *pCommand = NULL; |
| 7878 | tANI_BOOLEAN fImediate = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7879 | do |
| 7880 | { |
| 7881 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 7882 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7883 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7884 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 7885 | break; |
| 7886 | } |
| 7887 | pCommand = csrGetCommandBuffer(pMac); |
| 7888 | if(NULL == pCommand) |
| 7889 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7890 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7891 | status = eHAL_STATUS_RESOURCES; |
| 7892 | break; |
| 7893 | } |
| 7894 | pCommand->command = eSmeCommandRemoveKey; |
| 7895 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7896 | pCommand->u.removeKeyCmd.roamId = roamId; |
| 7897 | pCommand->u.removeKeyCmd.encType = pRemoveKey->encType; |
| 7898 | palCopyMemory( pMac->hHdd, &pCommand->u.removeKeyCmd.peerMac, &pRemoveKey->peerMac, sizeof(tSirMacAddr) ); |
| 7899 | pCommand->u.removeKeyCmd.keyId = pRemoveKey->keyId; |
| 7900 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7901 | { |
| 7902 | //in this case, put it to the end of the Q incase there is a set key pending. |
| 7903 | fImediate = eANI_BOOLEAN_FALSE; |
| 7904 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7905 | 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] | 7906 | pRemoveKey->encType, pRemoveKey->keyId, |
| 7907 | pCommand->u.removeKeyCmd.peerMac[0], |
| 7908 | pCommand->u.removeKeyCmd.peerMac[1], |
| 7909 | pCommand->u.removeKeyCmd.peerMac[2], |
| 7910 | pCommand->u.removeKeyCmd.peerMac[3], |
| 7911 | pCommand->u.removeKeyCmd.peerMac[4], |
| 7912 | pCommand->u.removeKeyCmd.peerMac[5]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7913 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 7914 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7915 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7916 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7917 | break; |
| 7918 | } |
| 7919 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7920 | if( !HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand ) ) |
| 7921 | { |
| 7922 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 7923 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7924 | return (status ); |
| 7925 | } |
| 7926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7927 | eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 7928 | { |
| 7929 | eHalStatus status; |
| 7930 | tANI_U8 numKeys = ( pCommand->u.setKeyCmd.keyLength ) ? 1 : 0; |
| 7931 | tAniEdType edType = csrTranslateEncryptTypeToEdType( pCommand->u.setKeyCmd.encType ); |
| 7932 | tANI_BOOLEAN fUnicast = ( pCommand->u.setKeyCmd.peerMac[0] == 0xFF ) ? eANI_BOOLEAN_FALSE : eANI_BOOLEAN_TRUE; |
| 7933 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7934 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7935 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7936 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7937 | if(eCSR_ENCRYPT_TYPE_NONE != edType) |
| 7938 | { |
| 7939 | palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 7940 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 7941 | { |
| 7942 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ; |
| 7943 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 7944 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 7945 | } |
| 7946 | else |
| 7947 | { |
| 7948 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_REQ; |
| 7949 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 7950 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 7951 | } |
| 7952 | palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 7953 | if(CSR_IS_ENC_TYPE_STATIC(edType)) |
| 7954 | { |
| 7955 | tANI_U32 defKeyId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7956 | //It has to be static WEP here |
| 7957 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, &defKeyId))) |
| 7958 | { |
| 7959 | setKeyEvent.keyId = (v_U8_t)defKeyId; |
| 7960 | } |
| 7961 | } |
| 7962 | else |
| 7963 | { |
| 7964 | setKeyEvent.keyId = pCommand->u.setKeyCmd.keyId; |
| 7965 | } |
| 7966 | setKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 7967 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 7968 | } |
| 7969 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7970 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 7971 | { |
| 7972 | status = csrSendMBSetContextReqMsg( pMac, sessionId, |
| 7973 | ( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac, |
| 7974 | numKeys, edType, fUnicast, pCommand->u.setKeyCmd.keyDirection, |
| 7975 | pCommand->u.setKeyCmd.keyId, pCommand->u.setKeyCmd.keyLength, |
| 7976 | pCommand->u.setKeyCmd.Key, pCommand->u.setKeyCmd.paeRole, |
| 7977 | pCommand->u.setKeyCmd.keyRsc); |
| 7978 | } |
| 7979 | else |
| 7980 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7981 | smsLog( pMac, LOGW, FL(" cannot process not connected") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7982 | //Set this status so the error handling take care of the case. |
| 7983 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 7984 | } |
| 7985 | if( !HAL_STATUS_SUCCESS(status) ) |
| 7986 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7987 | smsLog( pMac, LOGE, FL(" error status %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7988 | 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] | 7989 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7990 | if(eCSR_ENCRYPT_TYPE_NONE != edType) |
| 7991 | { |
| 7992 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 7993 | { |
| 7994 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 7995 | } |
| 7996 | else |
| 7997 | { |
| 7998 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 7999 | } |
| 8000 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 8001 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8002 | } |
| 8003 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8004 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8005 | return ( status ); |
| 8006 | } |
| 8007 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8008 | eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8009 | { |
| 8010 | eHalStatus status; |
| 8011 | tpSirSmeRemoveKeyReq pMsg = NULL; |
| 8012 | tANI_U16 wMsgLen = sizeof(tSirSmeRemoveKeyReq); |
| 8013 | tANI_U8 *p; |
| 8014 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8015 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8016 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8017 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8018 | palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8019 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_REQ; |
| 8020 | removeKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8021 | removeKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8022 | palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 8023 | removeKeyEvent.keyId = pCommand->u.removeKeyCmd.keyId; |
| 8024 | removeKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8025 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8026 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8027 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8028 | { |
| 8029 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, wMsgLen ); |
| 8030 | } |
| 8031 | else |
| 8032 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8033 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8034 | //Set the error status so error handling kicks in below |
| 8035 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8036 | } |
| 8037 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8038 | { |
| 8039 | palZeroMemory(pMac->hHdd, pMsg, wMsgLen); |
| 8040 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REMOVEKEY_REQ); |
| 8041 | pMsg->length = pal_cpu_to_be16(wMsgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8042 | pMsg->sessionId = (tANI_U8)sessionId; |
| 8043 | pMsg->transactionId = 0; |
| 8044 | p = (tANI_U8 *)pMsg + sizeof(pMsg->messageType) + sizeof(pMsg->length) + |
| 8045 | sizeof(pMsg->sessionId) + sizeof(pMsg->transactionId); |
| 8046 | // bssId - copy from session Info |
| 8047 | palCopyMemory( pMac->hHdd, p, &pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 8048 | p += sizeof(tSirMacAddr); |
| 8049 | // peerMacAddr |
| 8050 | palCopyMemory( pMac->hHdd, p, pCommand->u.removeKeyCmd.peerMac, sizeof(tSirMacAddr) ); |
| 8051 | p += sizeof(tSirMacAddr); |
| 8052 | // edType |
| 8053 | *p = (tANI_U8)csrTranslateEncryptTypeToEdType( pCommand->u.removeKeyCmd.encType ); |
| 8054 | p++; |
| 8055 | // weptype |
| 8056 | if( ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pCommand->u.removeKeyCmd.encType ) || |
| 8057 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pCommand->u.removeKeyCmd.encType ) ) |
| 8058 | { |
| 8059 | *p = (tANI_U8)eSIR_WEP_STATIC; |
| 8060 | } |
| 8061 | else |
| 8062 | { |
| 8063 | *p = (tANI_U8)eSIR_WEP_DYNAMIC; |
| 8064 | } |
| 8065 | p++; |
| 8066 | //keyid |
| 8067 | *p = pCommand->u.removeKeyCmd.keyId; |
| 8068 | p++; |
| 8069 | *p = (pCommand->u.removeKeyCmd.peerMac[0] == 0xFF ) ? 0 : 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8070 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 8071 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8072 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8073 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8074 | smsLog( pMac, LOGE, FL(" error status "), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8075 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8076 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 8077 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8078 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8079 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8080 | csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.removeKeyCmd.roamId, eCSR_ROAM_REMOVE_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE); |
| 8081 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8082 | return ( status ); |
| 8083 | } |
| 8084 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8085 | eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 8086 | { |
| 8087 | eHalStatus status; |
| 8088 | |
| 8089 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8090 | { |
| 8091 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8092 | } |
| 8093 | else |
| 8094 | { |
| 8095 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, pSetKey, roamId ); |
| 8096 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8097 | return ( status ); |
| 8098 | } |
| 8099 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8100 | /* |
| 8101 | Prepare a filter base on a profile for parsing the scan results. |
| 8102 | Upon successful return, caller MUST call csrFreeScanFilter on |
| 8103 | pScanFilter when it is done with the filter. |
| 8104 | */ |
| 8105 | eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 8106 | tCsrScanResultFilter *pScanFilter) |
| 8107 | { |
| 8108 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8109 | tANI_U32 size = 0; |
| 8110 | tANI_U8 index = 0; |
| 8111 | |
| 8112 | do |
| 8113 | { |
| 8114 | if(pProfile->BSSIDs.numOfBSSIDs) |
| 8115 | { |
| 8116 | size = sizeof(tCsrBssid) * pProfile->BSSIDs.numOfBSSIDs; |
| 8117 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, size); |
| 8118 | if(!HAL_STATUS_SUCCESS(status)) |
| 8119 | { |
| 8120 | break; |
| 8121 | } |
| 8122 | pScanFilter->BSSIDs.numOfBSSIDs = pProfile->BSSIDs.numOfBSSIDs; |
| 8123 | palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, pProfile->BSSIDs.bssid, size); |
| 8124 | } |
| 8125 | if(pProfile->SSIDs.numOfSSIDs) |
| 8126 | { |
| 8127 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 8128 | { |
| 8129 | pScanFilter->SSIDs.numOfSSIDs = pProfile->SSIDs.numOfSSIDs; |
| 8130 | } |
| 8131 | else |
| 8132 | { |
| 8133 | //For WDS station |
| 8134 | //We always use index 1 for self SSID. Index 0 for peer's SSID that we want to join |
| 8135 | pScanFilter->SSIDs.numOfSSIDs = 1; |
| 8136 | } |
| 8137 | size = sizeof(tCsrSSIDInfo) * pProfile->SSIDs.numOfSSIDs; |
| 8138 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, size); |
| 8139 | if(!HAL_STATUS_SUCCESS(status)) |
| 8140 | { |
| 8141 | break; |
| 8142 | } |
| 8143 | palCopyMemory(pMac->hHdd, pScanFilter->SSIDs.SSIDList, pProfile->SSIDs.SSIDList, size); |
| 8144 | } |
| 8145 | if(!pProfile->ChannelInfo.ChannelList || (pProfile->ChannelInfo.ChannelList[0] == 0) ) |
| 8146 | { |
| 8147 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8148 | pScanFilter->ChannelInfo.ChannelList = NULL; |
| 8149 | } |
| 8150 | else if(pProfile->ChannelInfo.numOfChannels) |
| 8151 | { |
| 8152 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->ChannelInfo.ChannelList, sizeof(*pScanFilter->ChannelInfo.ChannelList) * pProfile->ChannelInfo.numOfChannels); |
| 8153 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8154 | if(HAL_STATUS_SUCCESS(status)) |
| 8155 | { |
| 8156 | for(index = 0; index < pProfile->ChannelInfo.numOfChannels; index++) |
| 8157 | { |
| 8158 | if(csrRoamIsChannelValid(pMac, pProfile->ChannelInfo.ChannelList[index])) |
| 8159 | { |
| 8160 | pScanFilter->ChannelInfo.ChannelList[pScanFilter->ChannelInfo.numOfChannels] |
| 8161 | = pProfile->ChannelInfo.ChannelList[index]; |
| 8162 | pScanFilter->ChannelInfo.numOfChannels++; |
| 8163 | } |
| 8164 | else |
| 8165 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8166 | 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] | 8167 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8168 | } |
| 8169 | } |
| 8170 | else |
| 8171 | { |
| 8172 | break; |
| 8173 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8174 | } |
| 8175 | else |
| 8176 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8177 | smsLog(pMac, LOGW, FL("Channel list empty")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8178 | status = eHAL_STATUS_FAILURE; |
| 8179 | break; |
| 8180 | } |
| 8181 | pScanFilter->uapsd_mask = pProfile->uapsd_mask; |
| 8182 | pScanFilter->authType = pProfile->AuthType; |
| 8183 | pScanFilter->EncryptionType = pProfile->EncryptionType; |
| 8184 | pScanFilter->mcEncryptionType = pProfile->mcEncryptionType; |
| 8185 | pScanFilter->BSSType = pProfile->BSSType; |
| 8186 | pScanFilter->phyMode = pProfile->phyMode; |
| 8187 | #ifdef FEATURE_WLAN_WAPI |
| 8188 | //check if user asked for WAPI with 11n or auto mode, in that case modify |
| 8189 | //the phymode to 11g |
| 8190 | if(csrIsProfileWapi(pProfile)) |
| 8191 | { |
| 8192 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_11n) |
| 8193 | { |
| 8194 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 8195 | } |
| 8196 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_AUTO) |
| 8197 | { |
| 8198 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_AUTO; |
| 8199 | } |
| 8200 | if(!pScanFilter->phyMode) |
| 8201 | { |
| 8202 | pScanFilter->phyMode = eCSR_DOT11_MODE_11g; |
| 8203 | } |
| 8204 | } |
| 8205 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8206 | /*Save the WPS info*/ |
| 8207 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8208 | if( pProfile->countryCode[0] ) |
| 8209 | { |
| 8210 | //This causes the matching function to use countryCode as one of the criteria. |
| 8211 | palCopyMemory( pMac->hHdd, pScanFilter->countryCode, pProfile->countryCode, |
| 8212 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 8213 | } |
| 8214 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8215 | if (pProfile->MDID.mdiePresent) |
| 8216 | { |
| 8217 | pScanFilter->MDID.mdiePresent = 1; |
| 8218 | pScanFilter->MDID.mobilityDomain = pProfile->MDID.mobilityDomain; |
| 8219 | } |
| 8220 | #endif |
| 8221 | |
| 8222 | }while(0); |
| 8223 | |
| 8224 | if(!HAL_STATUS_SUCCESS(status)) |
| 8225 | { |
| 8226 | csrFreeScanFilter(pMac, pScanFilter); |
| 8227 | } |
| 8228 | |
| 8229 | return(status); |
| 8230 | } |
| 8231 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8232 | tANI_BOOLEAN csrRoamIssueWmStatusChange( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8233 | eCsrRoamWmStatusChangeTypes Type, tSirSmeRsp *pSmeRsp ) |
| 8234 | { |
| 8235 | tANI_BOOLEAN fCommandQueued = eANI_BOOLEAN_FALSE; |
| 8236 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8237 | do |
| 8238 | { |
| 8239 | // Validate the type is ok... |
| 8240 | if ( ( eCsrDisassociated != Type ) && ( eCsrDeauthenticated != Type ) ) break; |
| 8241 | pCommand = csrGetCommandBuffer( pMac ); |
| 8242 | if ( !pCommand ) |
| 8243 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8244 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8245 | break; |
| 8246 | } |
| 8247 | //Change the substate in case it is waiting for key |
| 8248 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8249 | { |
| 8250 | csrRoamStopWaitForKeyTimer( pMac ); |
| 8251 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 8252 | } |
| 8253 | pCommand->command = eSmeCommandWmStatusChange; |
| 8254 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8255 | pCommand->u.wmStatusChangeCmd.Type = Type; |
| 8256 | if ( eCsrDisassociated == Type ) |
| 8257 | { |
| 8258 | palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg, pSmeRsp, |
| 8259 | sizeof( pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg ) ); |
| 8260 | } |
| 8261 | else |
| 8262 | { |
| 8263 | palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg, pSmeRsp, |
| 8264 | sizeof( pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg ) ); |
| 8265 | } |
| 8266 | if( HAL_STATUS_SUCCESS( csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE) ) ) |
| 8267 | { |
| 8268 | fCommandQueued = eANI_BOOLEAN_TRUE; |
| 8269 | } |
| 8270 | else |
| 8271 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8272 | smsLog( pMac, LOGE, FL(" fail to send message ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8273 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 8274 | } |
| 8275 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8276 | /* AP has issued Dissac/Deauth, Set the operating mode value to configured value */ |
| 8277 | csrSetDefaultDot11Mode( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8278 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8279 | return( fCommandQueued ); |
| 8280 | } |
| 8281 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8282 | static void csrUpdateRssi(tpAniSirGlobal pMac, void* pMsg) |
| 8283 | { |
| 8284 | v_S7_t rssi = 0; |
| 8285 | tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq*)pMsg; |
| 8286 | if(pGetRssiReq) |
| 8287 | { |
| 8288 | if(NULL != pGetRssiReq->pVosContext) |
| 8289 | { |
| 8290 | WLANTL_GetRssi(pGetRssiReq->pVosContext, pGetRssiReq->staId, &rssi); |
| 8291 | } |
| 8292 | else |
| 8293 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8294 | smsLog( pMac, LOGE, FL("pGetRssiReq->pVosContext is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8295 | return; |
| 8296 | } |
| 8297 | |
| 8298 | if(NULL != pGetRssiReq->rssiCallback) |
| 8299 | { |
| 8300 | ((tCsrRssiCallback)(pGetRssiReq->rssiCallback))(rssi, pGetRssiReq->staId, pGetRssiReq->pDevContext); |
| 8301 | } |
| 8302 | else |
| 8303 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8304 | smsLog( pMac, LOGE, FL("pGetRssiReq->rssiCallback is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8305 | return; |
| 8306 | } |
| 8307 | } |
| 8308 | else |
| 8309 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8310 | smsLog( pMac, LOGE, FL("pGetRssiReq is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8311 | } |
| 8312 | return; |
| 8313 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8314 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 8315 | void csrRoamRssiRspProcessor(tpAniSirGlobal pMac, void* pMsg) |
| 8316 | { |
| 8317 | v_S7_t rssi = 0; |
| 8318 | tAniGetRoamRssiRsp* pRoamRssiRsp = (tAniGetRoamRssiRsp*)pMsg; |
| 8319 | |
| 8320 | /* Get roam Rssi request is backed up and passed back to the response, |
| 8321 | Extract the request message to fetch callback */ |
| 8322 | tpAniGetRssiReq reqBkp = (tAniGetRssiReq*)pRoamRssiRsp->rssiReq; |
| 8323 | if(pRoamRssiRsp) |
| 8324 | { |
| 8325 | rssi = pRoamRssiRsp->rssi; |
| 8326 | if((reqBkp) && (NULL != reqBkp->rssiCallback)) |
| 8327 | { |
| 8328 | ((tCsrRssiCallback)(reqBkp->rssiCallback))(rssi, pRoamRssiRsp->staId, reqBkp->pDevContext); |
| 8329 | reqBkp->rssiCallback = NULL; |
| 8330 | vos_mem_free(reqBkp); |
| 8331 | } |
| 8332 | else |
| 8333 | { |
| 8334 | smsLog( pMac, LOGE, FL("reqBkp->rssiCallback is NULL")); |
| 8335 | if (NULL != reqBkp) |
| 8336 | { |
| 8337 | vos_mem_free(reqBkp); |
| 8338 | } |
| 8339 | } |
| 8340 | } |
| 8341 | else |
| 8342 | { |
| 8343 | smsLog( pMac, LOGE, FL("pRoamRssiRsp is NULL")); |
| 8344 | } |
| 8345 | return; |
| 8346 | } |
| 8347 | #endif |
| 8348 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8349 | static void csrRoamRssiIndHdlr(tpAniSirGlobal pMac, void* pMsg) |
| 8350 | { |
| 8351 | WLANTL_TlIndicationReq *pTlRssiInd = (WLANTL_TlIndicationReq*)pMsg; |
| 8352 | if(pTlRssiInd) |
| 8353 | { |
| 8354 | if(NULL != pTlRssiInd->tlCallback) |
| 8355 | { |
| 8356 | ((WLANTL_RSSICrossThresholdCBType)(pTlRssiInd->tlCallback)) |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 8357 | (pTlRssiInd->pAdapter, pTlRssiInd->rssiNotification, pTlRssiInd->pUserCtxt, pTlRssiInd->avgRssi); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8358 | } |
| 8359 | else |
| 8360 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8361 | smsLog( pMac, LOGE, FL("pTlRssiInd->tlCallback is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8362 | } |
| 8363 | } |
| 8364 | else |
| 8365 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8366 | smsLog( pMac, LOGE, FL("pTlRssiInd is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8367 | } |
| 8368 | return; |
| 8369 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8370 | |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 8371 | eHalStatus csrSendResetApCapsChanged(tpAniSirGlobal pMac, tSirMacAddr *bssId) |
| 8372 | { |
| 8373 | tpSirResetAPCapsChange pMsg; |
| 8374 | tANI_U16 len; |
| 8375 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8376 | |
| 8377 | /* Create the message and send to lim */ |
| 8378 | len = sizeof(tSirResetAPCapsChange); |
| 8379 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len ); |
| 8380 | if (HAL_STATUS_SUCCESS(status)) |
| 8381 | { |
| 8382 | palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirResetAPCapsChange) ); |
| 8383 | pMsg->messageType = eWNI_SME_RESET_AP_CAPS_CHANGED; |
| 8384 | pMsg->length = len; |
| 8385 | palCopyMemory( pMac->hHdd, pMsg->bssId, bssId, sizeof(tSirMacAddr) ); |
| 8386 | smsLog( pMac, LOG1, FL("CSR reset caps change for Bssid= %02x-%02x-%02x-%02x-%02x-%02x"), |
| 8387 | pMsg->bssId[ 0 ], pMsg->bssId[ 1 ], pMsg->bssId[ 2 ], |
| 8388 | pMsg->bssId[ 3 ], pMsg->bssId[ 4 ], pMsg->bssId[ 5 ]); |
| 8389 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 8390 | } |
| 8391 | else |
| 8392 | { |
| 8393 | smsLog( pMac, LOGE, FL("Memory allocation failed\n")); |
| 8394 | } |
| 8395 | return status; |
| 8396 | } |
| 8397 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8398 | void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) |
| 8399 | { |
| 8400 | tSirSmeAssocInd *pAssocInd; |
| 8401 | tSirSmeDisassocInd *pDisassocInd; |
| 8402 | tSirSmeDeauthInd *pDeauthInd; |
| 8403 | tSirSmeWmStatusChangeNtf *pStatusChangeMsg; |
| 8404 | tSirSmeNewBssInfo *pNewBss; |
| 8405 | tSmeIbssPeerInd *pIbssPeerInd; |
| 8406 | tSirMacAddr Broadcastaddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 8407 | tSirSmeApNewCaps *pApNewCaps; |
| 8408 | eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; |
| 8409 | eRoamCmdStatus roamStatus = eCSR_ROAM_FAILED; |
| 8410 | tCsrRoamInfo *pRoamInfo = NULL; |
| 8411 | tCsrRoamInfo roamInfo; |
| 8412 | eHalStatus status; |
| 8413 | tANI_U32 sessionId = CSR_SESSION_ID_INVALID; |
| 8414 | tCsrRoamSession *pSession = NULL; |
| 8415 | tpSirSmeSwitchChannelInd pSwitchChnInd; |
| 8416 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 8417 | tSmeCmd pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8418 | pSirMsg->messageType = (pSirMsg->messageType); |
| 8419 | pSirMsg->length = (pSirMsg->length); |
| 8420 | pSirMsg->statusCode = (pSirMsg->statusCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8421 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8422 | switch( pSirMsg->messageType ) |
| 8423 | { |
| 8424 | case eWNI_SME_ASSOC_IND: |
| 8425 | { |
| 8426 | tCsrRoamSession *pSession; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8427 | smsLog( pMac, LOG1, FL("ASSOCIATION Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8428 | pAssocInd = (tSirSmeAssocInd *)pSirMsg; |
| 8429 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pAssocInd->bssId, &sessionId ); |
| 8430 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8431 | { |
| 8432 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8433 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8434 | if(!pSession) |
| 8435 | { |
| 8436 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8437 | return; |
| 8438 | } |
| 8439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8440 | pRoamInfo = &roamInfo; |
| 8441 | |
| 8442 | // Required for indicating the frames to upper layer |
| 8443 | pRoamInfo->assocReqLength = pAssocInd->assocReqLength; |
| 8444 | pRoamInfo->assocReqPtr = pAssocInd->assocReqPtr; |
| 8445 | |
| 8446 | pRoamInfo->beaconPtr = pAssocInd->beaconPtr; |
| 8447 | pRoamInfo->beaconLength = pAssocInd->beaconLength; |
| 8448 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 8449 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8450 | |
| 8451 | pRoamInfo->staId = (tANI_U8)pAssocInd->staId; |
| 8452 | pRoamInfo->rsnIELen = (tANI_U8)pAssocInd->rsnIE.length; |
| 8453 | pRoamInfo->prsnIE = pAssocInd->rsnIE.rsnIEdata; |
| 8454 | |
| 8455 | pRoamInfo->addIELen = (tANI_U8)pAssocInd->addIE.length; |
| 8456 | pRoamInfo->paddIE = pAssocInd->addIE.addIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8457 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8458 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pAssocInd->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8459 | pRoamInfo->wmmEnabledSta = pAssocInd->wmmEnabledSta; |
| 8460 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8461 | 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] | 8462 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile)) |
| 8463 | { |
| 8464 | if( CSR_IS_ENC_TYPE_STATIC( pSession->pCurRoamProfile->negotiatedUCEncryptionType )) |
| 8465 | { |
| 8466 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->pCurRoamProfile->negotiatedUCEncryptionType, |
| 8467 | pSession->pConnectBssDesc, |
| 8468 | &(pRoamInfo->peerMac), |
| 8469 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 8470 | pRoamInfo->fAuthRequired = FALSE; |
| 8471 | } |
| 8472 | else |
| 8473 | { |
| 8474 | pRoamInfo->fAuthRequired = TRUE; |
| 8475 | } |
| 8476 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND); |
| 8477 | if (!HAL_STATUS_SUCCESS(status)) |
| 8478 | pRoamInfo->statusCode = eSIR_SME_ASSOC_REFUSED;// Refused due to Mac filtering |
| 8479 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8480 | /* Send Association completion message to PE */ |
| 8481 | status = csrSendAssocCnfMsg( pMac, pAssocInd, status );//Sta |
| 8482 | |
| 8483 | /* send a message to CSR itself just to avoid the EAPOL frames going |
| 8484 | * OTA before association response */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8485 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 8486 | { |
| 8487 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 8488 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8489 | else if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) && (pRoamInfo->statusCode != eSIR_SME_ASSOC_REFUSED)) |
| 8490 | { |
| 8491 | pRoamInfo->fReassocReq = pAssocInd->reassocReq; |
| 8492 | //status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 8493 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 8494 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8495 | } |
| 8496 | } |
| 8497 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8498 | case eWNI_SME_DISASSOC_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8499 | smsLog( pMac, LOGE, FL("DISASSOCIATION Indication from MAC")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8500 | // Check if AP dis-associated us because of MIC failure. If so, |
| 8501 | // then we need to take action immediately and not wait till the |
| 8502 | // the WmStatusChange requests is pushed and processed |
| 8503 | pDisassocInd = (tSirSmeDisassocInd *)pSirMsg; |
| 8504 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDisassocInd->bssId, &sessionId ); |
| 8505 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8506 | { |
| 8507 | // If we are in neighbor preauth done state then on receiving |
| 8508 | // disassoc or deauth we dont roam instead we just disassoc |
| 8509 | // from current ap and then go to disconnected state |
| 8510 | // This happens for CCX and 11r FT connections ONLY. |
| 8511 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8512 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8513 | { |
| 8514 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8515 | } |
| 8516 | #endif |
| 8517 | #ifdef FEATURE_WLAN_CCX |
| 8518 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8519 | { |
| 8520 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8521 | } |
| 8522 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8523 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 8524 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8525 | { |
| 8526 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8527 | } |
| 8528 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8529 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8530 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8531 | if(!pSession) |
| 8532 | { |
| 8533 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8534 | return; |
| 8535 | } |
| 8536 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8537 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 8538 | { |
| 8539 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8540 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8541 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 8542 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 8543 | #endif |
| 8544 | csrRoamLinkDown(pMac, sessionId); |
| 8545 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDisassociated, pSirMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8546 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 8547 | { |
| 8548 | |
| 8549 | pRoamInfo = &roamInfo; |
| 8550 | |
| 8551 | pRoamInfo->statusCode = pDisassocInd->statusCode; |
| 8552 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8553 | |
| 8554 | pRoamInfo->staId = (tANI_U8)pDisassocInd->staId; |
| 8555 | |
| 8556 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8557 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDisassocInd->bssId, sizeof(tCsrBssid)); |
| 8558 | |
| 8559 | 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] | 8560 | |
| 8561 | /* |
| 8562 | * STA/P2P client got disassociated so remove any pending deauth |
| 8563 | * commands in sme pending list |
| 8564 | */ |
| 8565 | pCommand.command = eSmeCommandRoam; |
| 8566 | pCommand.sessionId = (tANI_U8)sessionId; |
| 8567 | pCommand.u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 8568 | vos_mem_copy(pCommand.u.roamCmd.peerMac, pDisassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8569 | csrRoamRemoveDuplicateCommand(pMac, sessionId, &pCommand, eCsrForcedDeauthSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8570 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8571 | } |
| 8572 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8573 | case eWNI_SME_DEAUTH_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8574 | smsLog( pMac, LOG1, FL("DEAUTHENTICATION Indication from MAC")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8575 | pDeauthInd = (tpSirSmeDeauthInd)pSirMsg; |
| 8576 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDeauthInd->bssId, &sessionId ); |
| 8577 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8578 | { |
| 8579 | // If we are in neighbor preauth done state then on receiving |
| 8580 | // disassoc or deauth we dont roam instead we just disassoc |
| 8581 | // from current ap and then go to disconnected state |
| 8582 | // This happens for CCX and 11r FT connections ONLY. |
| 8583 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8584 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8585 | { |
| 8586 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8587 | } |
| 8588 | #endif |
| 8589 | #ifdef FEATURE_WLAN_CCX |
| 8590 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8591 | { |
| 8592 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8593 | } |
| 8594 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8595 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 8596 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8597 | { |
| 8598 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8599 | } |
| 8600 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8601 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8602 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8603 | if(!pSession) |
| 8604 | { |
| 8605 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8606 | return; |
| 8607 | } |
| 8608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8609 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 8610 | { |
| 8611 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8612 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8613 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 8614 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 8615 | #endif |
| 8616 | csrRoamLinkDown(pMac, sessionId); |
| 8617 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDeauthenticated, pSirMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8618 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 8619 | { |
| 8620 | |
| 8621 | pRoamInfo = &roamInfo; |
| 8622 | |
| 8623 | pRoamInfo->statusCode = pDeauthInd->statusCode; |
| 8624 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8625 | |
| 8626 | pRoamInfo->staId = (tANI_U8)pDeauthInd->staId; |
| 8627 | |
| 8628 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8629 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDeauthInd->bssId, sizeof(tCsrBssid)); |
| 8630 | |
| 8631 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DEAUTH_IND); |
| 8632 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8633 | } |
| 8634 | break; |
| 8635 | |
| 8636 | 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] | 8637 | smsLog( pMac, LOGW, FL("eWNI_SME_SWITCH_CHL_REQ from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8638 | pSwitchChnInd = (tpSirSmeSwitchChannelInd)pSirMsg; |
| 8639 | //Update with the new channel id. |
| 8640 | //The channel id is hidden in the statusCode. |
| 8641 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pSwitchChnInd->bssId, &sessionId ); |
| 8642 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8643 | { |
| 8644 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8645 | if(!pSession) |
| 8646 | { |
| 8647 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8648 | return; |
| 8649 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8650 | pSession->connectedProfile.operationChannel = (tANI_U8)pSwitchChnInd->newChannelId; |
| 8651 | if(pSession->pConnectBssDesc) |
| 8652 | { |
| 8653 | pSession->pConnectBssDesc->channelId = (tANI_U8)pSwitchChnInd->newChannelId; |
| 8654 | } |
| 8655 | } |
| 8656 | break; |
| 8657 | |
| 8658 | case eWNI_SME_DEAUTH_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8659 | smsLog( pMac, LOGW, FL("eWNI_SME_DEAUTH_RSP from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8660 | { |
| 8661 | tSirSmeDeauthRsp* pDeauthRsp = (tSirSmeDeauthRsp *)pSirMsg; |
| 8662 | sessionId = pDeauthRsp->sessionId; |
| 8663 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 8664 | { |
| 8665 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8666 | if(!pSession) |
| 8667 | { |
| 8668 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8669 | return; |
| 8670 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8671 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 8672 | { |
| 8673 | pRoamInfo = &roamInfo; |
| 8674 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8675 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthRsp->peerMacAddr, sizeof(tSirMacAddr)); |
| 8676 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 8677 | pRoamInfo->statusCode = pDeauthRsp->statusCode; |
| 8678 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 8679 | } |
| 8680 | } |
| 8681 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8682 | break; |
| 8683 | |
| 8684 | case eWNI_SME_DISASSOC_RSP: |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 8685 | /* 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] | 8686 | smsLog( pMac, LOGW, FL("eWNI_SME_DISASSOC_RSP from SME ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8687 | { |
| 8688 | tSirSmeDisassocRsp *pDisassocRsp = (tSirSmeDisassocRsp *)pSirMsg; |
| 8689 | sessionId = pDisassocRsp->sessionId; |
| 8690 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 8691 | { |
| 8692 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8693 | if(!pSession) |
| 8694 | { |
| 8695 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8696 | return; |
| 8697 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8698 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 8699 | { |
| 8700 | pRoamInfo = &roamInfo; |
| 8701 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8702 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocRsp->peerMacAddr, sizeof(tSirMacAddr)); |
| 8703 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 8704 | pRoamInfo->statusCode = pDisassocRsp->statusCode; |
| 8705 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 8706 | } |
| 8707 | } |
| 8708 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8709 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8710 | case eWNI_SME_MIC_FAILURE_IND: |
| 8711 | { |
| 8712 | tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg; |
| 8713 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 8714 | eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8715 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8716 | { |
| 8717 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8718 | if(!pSession) |
| 8719 | { |
| 8720 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8721 | return; |
| 8722 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8723 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
| 8724 | palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8725 | secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR; |
| 8726 | secEvent.encryptionModeMulticast = |
| 8727 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8728 | secEvent.encryptionModeUnicast = |
| 8729 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8730 | secEvent.authMode = |
| 8731 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8732 | palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 8733 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 8734 | } |
| 8735 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8736 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pMicInd->bssId, &sessionId ); |
| 8737 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8738 | { |
| 8739 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 8740 | roamInfo.u.pMICFailureInfo = &pMicInd->info; |
| 8741 | pRoamInfo = &roamInfo; |
| 8742 | if(pMicInd->info.multicast) |
| 8743 | { |
| 8744 | result = eCSR_ROAM_RESULT_MIC_ERROR_GROUP; |
| 8745 | } |
| 8746 | else |
| 8747 | { |
| 8748 | result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
| 8749 | } |
| 8750 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_MIC_ERROR_IND, result); |
| 8751 | } |
| 8752 | } |
| 8753 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8754 | case eWNI_SME_WPS_PBC_PROBE_REQ_IND: |
| 8755 | { |
| 8756 | tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd)pSirMsg; |
| 8757 | tCsrRoamInfo roamInfo; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8758 | smsLog( pMac, LOG1, FL("WPS PBC Probe request Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8759 | |
| 8760 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pProbeReqInd->bssId, &sessionId ); |
| 8761 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8762 | { |
| 8763 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 8764 | roamInfo.u.pWPSPBCProbeReq = &pProbeReqInd->WPSPBCProbeReq; |
| 8765 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_WPS_PBC_PROBE_REQ_IND, |
| 8766 | eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND); |
| 8767 | } |
| 8768 | } |
| 8769 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8771 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 8772 | pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *)pSirMsg; |
| 8773 | switch( pStatusChangeMsg->statusChangeCode ) |
| 8774 | { |
| 8775 | case eSIR_SME_IBSS_ACTIVE: |
| 8776 | sessionId = csrFindIbssSession( pMac ); |
| 8777 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8778 | { |
| 8779 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8780 | if(!pSession) |
| 8781 | { |
| 8782 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8783 | return; |
| 8784 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8785 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED; |
| 8786 | if(pSession->pConnectBssDesc) |
| 8787 | { |
| 8788 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 8789 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 8790 | pRoamInfo = &roamInfo; |
| 8791 | } |
| 8792 | else |
| 8793 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8794 | 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] | 8795 | } |
| 8796 | result = eCSR_ROAM_RESULT_IBSS_CONNECT; |
| 8797 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 8798 | } |
| 8799 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8800 | case eSIR_SME_IBSS_INACTIVE: |
| 8801 | sessionId = csrFindIbssSession( pMac ); |
| 8802 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8803 | { |
| 8804 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8805 | if(!pSession) |
| 8806 | { |
| 8807 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8808 | return; |
| 8809 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8810 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 8811 | result = eCSR_ROAM_RESULT_IBSS_INACTIVE; |
| 8812 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 8813 | } |
| 8814 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8815 | case eSIR_SME_JOINED_NEW_BSS: // IBSS coalescing. |
| 8816 | sessionId = csrFindIbssSession( pMac ); |
| 8817 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8818 | { |
| 8819 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8820 | if(!pSession) |
| 8821 | { |
| 8822 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8823 | return; |
| 8824 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8825 | // update the connection state information |
| 8826 | pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8827 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8828 | { |
| 8829 | vos_log_ibss_pkt_type *pIbssLog; |
| 8830 | tANI_U32 bi; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8831 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 8832 | if(pIbssLog) |
| 8833 | { |
| 8834 | pIbssLog->eventId = WLAN_IBSS_EVENT_COALESCING; |
| 8835 | if(pNewBss) |
| 8836 | { |
| 8837 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pNewBss->bssId, 6); |
| 8838 | if(pNewBss->ssId.length) |
| 8839 | { |
| 8840 | palCopyMemory(pMac->hHdd, pIbssLog->ssid, pNewBss->ssId.ssId, pNewBss->ssId.length); |
| 8841 | } |
| 8842 | pIbssLog->operatingChannel = pNewBss->channelNumber; |
| 8843 | } |
| 8844 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 8845 | { |
| 8846 | //***U8 is not enough for beacon interval |
| 8847 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 8848 | } |
| 8849 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 8850 | } |
| 8851 | } |
| 8852 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8853 | csrRoamUpdateConnectedProfileFromNewBss( pMac, sessionId, pNewBss ); |
| 8854 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->connectedProfile.EncryptionType, |
| 8855 | pSession->pConnectBssDesc, |
| 8856 | &Broadcastaddr, |
| 8857 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); |
| 8858 | result = eCSR_ROAM_RESULT_IBSS_COALESCED; |
| 8859 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 8860 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pNewBss->bssId, sizeof(tCsrBssid)); |
| 8861 | pRoamInfo = &roamInfo; |
| 8862 | //This BSSID is th ereal BSSID, let's save it |
| 8863 | if(pSession->pConnectBssDesc) |
| 8864 | { |
| 8865 | palCopyMemory(pMac->hHdd, pSession->pConnectBssDesc->bssId, &pNewBss->bssId, sizeof(tCsrBssid)); |
| 8866 | } |
| 8867 | // Stop the join IBSS timer in case of join, for |
| 8868 | // genuine merge do nothing |
| 8869 | if(pSession->ibss_join_pending) |
| 8870 | { |
| 8871 | pSession->ibss_join_pending = FALSE; |
| 8872 | csrRoamStopIbssJoinTimer(pMac, sessionId); |
| 8873 | result = eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS; |
| 8874 | } |
| 8875 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8876 | smsLog(pMac, LOGW, "CSR: eSIR_SME_JOINED_NEW_BSS received from PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8877 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8878 | // detection by LIM that the capabilities of the associated AP have changed. |
| 8879 | case eSIR_SME_AP_CAPS_CHANGED: |
| 8880 | pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8881 | smsLog(pMac, LOGW, "CSR handling eSIR_SME_AP_CAPS_CHANGED"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8882 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pApNewCaps->bssId, &sessionId ); |
| 8883 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8884 | { |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 8885 | if ((eCSR_ROAMING_STATE_JOINED == pMac->roam.curState[sessionId]) && |
| 8886 | ((eCSR_ROAM_SUBSTATE_JOINED_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 8887 | (eCSR_ROAM_SUBSTATE_NONE == pMac->roam.curSubState[sessionId]) || |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 8888 | (eCSR_ROAM_SUBSTATE_JOINED_NON_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
| 8889 | (eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC == pMac->roam.curSubState[sessionId])) |
| 8890 | ) |
| 8891 | { |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 8892 | smsLog(pMac, LOGW, "Calling csrRoamDisconnectInternal"); |
| 8893 | csrRoamDisconnectInternal(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 8894 | } |
| 8895 | else |
| 8896 | { |
| 8897 | smsLog(pMac, LOGW, |
| 8898 | "Skipping csrScanForCapabilityChange as " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8899 | "CSR is in state %d and sub-state %d", |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 8900 | pMac->roam.curState[sessionId], |
| 8901 | pMac->roam.curSubState[sessionId]); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 8902 | /* We ignore the caps change event if CSR is not in full connected state. |
| 8903 | * Send one event to PE to reset limSentCapsChangeNtf |
| 8904 | * Once limSentCapsChangeNtf set 0, lim can send sub sequent CAPS change event |
| 8905 | * otherwise lim cannot send any CAPS change events to SME */ |
| 8906 | csrSendResetApCapsChanged(pMac, &pApNewCaps->bssId); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 8907 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8908 | } |
| 8909 | break; |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 8910 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8911 | default: |
| 8912 | roamStatus = eCSR_ROAM_FAILED; |
| 8913 | result = eCSR_ROAM_RESULT_NONE; |
| 8914 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8915 | } // end switch on statusChangeCode |
| 8916 | if(eCSR_ROAM_RESULT_NONE != result) |
| 8917 | { |
| 8918 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, roamStatus, result); |
| 8919 | } |
| 8920 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8921 | case eWNI_SME_IBSS_NEW_PEER_IND: |
| 8922 | pIbssPeerInd = (tSmeIbssPeerInd *)pSirMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8923 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8924 | { |
| 8925 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8926 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 8927 | if(pIbssLog) |
| 8928 | { |
| 8929 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_JOIN; |
| 8930 | palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
| 8931 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 8932 | } |
| 8933 | } |
| 8934 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8935 | sessionId = csrFindIbssSession( pMac ); |
| 8936 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8937 | { |
| 8938 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8939 | |
| 8940 | if(!pSession) |
| 8941 | { |
| 8942 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8943 | return; |
| 8944 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8945 | // Issue the set Context request to LIM to establish the Unicast STA context for the new peer... |
| 8946 | if(pSession->pConnectBssDesc) |
| 8947 | { |
| 8948 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 8949 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 8950 | if(pIbssPeerInd->mesgLen > sizeof(tSmeIbssPeerInd)) |
| 8951 | { |
| 8952 | status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pbFrames, |
| 8953 | (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd))); |
| 8954 | if(HAL_STATUS_SUCCESS(status)) |
| 8955 | { |
| 8956 | roamInfo.nBeaconLength = (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd)); |
| 8957 | palCopyMemory(pMac->hHdd, roamInfo.pbFrames, ((tANI_U8 *)pIbssPeerInd) + sizeof(tSmeIbssPeerInd), |
| 8958 | roamInfo.nBeaconLength); |
| 8959 | } |
| 8960 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 8961 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 8962 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 8963 | status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pBssDesc, |
| 8964 | pSession->pConnectBssDesc->length); |
| 8965 | if(HAL_STATUS_SUCCESS(status)) |
| 8966 | { |
| 8967 | palCopyMemory(pMac->hHdd, roamInfo.pBssDesc, pSession->pConnectBssDesc, |
| 8968 | pSession->pConnectBssDesc->length); |
| 8969 | } |
| 8970 | if(HAL_STATUS_SUCCESS(status)) |
| 8971 | { |
| 8972 | pRoamInfo = &roamInfo; |
| 8973 | } |
| 8974 | else |
| 8975 | { |
| 8976 | if(roamInfo.pbFrames) |
| 8977 | { |
| 8978 | palFreeMemory(pMac->hHdd, roamInfo.pbFrames); |
| 8979 | } |
| 8980 | if(roamInfo.pBssDesc) |
| 8981 | { |
| 8982 | palFreeMemory(pMac->hHdd, roamInfo.pBssDesc); |
| 8983 | } |
| 8984 | } |
| 8985 | } |
| 8986 | else |
| 8987 | { |
| 8988 | pRoamInfo = &roamInfo; |
| 8989 | } |
| 8990 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->connectedProfile.EncryptionType, |
| 8991 | pSession->pConnectBssDesc, |
| 8992 | &(pIbssPeerInd->peerAddr), |
| 8993 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 8994 | } |
| 8995 | else |
| 8996 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8997 | 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] | 8998 | } |
| 8999 | //send up the sec type for the new peer |
| 9000 | if (pRoamInfo) |
| 9001 | { |
| 9002 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9003 | } |
| 9004 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, |
| 9005 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_NEW_PEER); |
| 9006 | if(pRoamInfo) |
| 9007 | { |
| 9008 | if(roamInfo.pbFrames) |
| 9009 | { |
| 9010 | palFreeMemory(pMac->hHdd, roamInfo.pbFrames); |
| 9011 | } |
| 9012 | if(roamInfo.pBssDesc) |
| 9013 | { |
| 9014 | palFreeMemory(pMac->hHdd, roamInfo.pBssDesc); |
| 9015 | } |
| 9016 | } |
| 9017 | } |
| 9018 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9019 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 9020 | pIbssPeerInd = (tSmeIbssPeerInd*)pSirMsg; |
| 9021 | sessionId = csrFindIbssSession( pMac ); |
| 9022 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9023 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9024 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9025 | { |
| 9026 | vos_log_ibss_pkt_type *pIbssLog; |
| 9027 | |
| 9028 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9029 | if(pIbssLog) |
| 9030 | { |
| 9031 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_LEAVE; |
| 9032 | if(pIbssPeerInd) |
| 9033 | { |
| 9034 | palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
| 9035 | } |
| 9036 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9037 | } |
| 9038 | } |
| 9039 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9040 | smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9041 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 9042 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 9043 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 9044 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 9045 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 9046 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 9047 | } |
| 9048 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9049 | case eWNI_SME_SETCONTEXT_RSP: |
| 9050 | { |
| 9051 | tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *)pSirMsg; |
| 9052 | tListElem *pEntry; |
| 9053 | tSmeCmd *pCommand; |
| 9054 | |
| 9055 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9056 | if ( pEntry ) |
| 9057 | { |
| 9058 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9059 | if ( eSmeCommandSetKey == pCommand->command ) |
| 9060 | { |
| 9061 | sessionId = pCommand->sessionId; |
| 9062 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9063 | |
| 9064 | if(!pSession) |
| 9065 | { |
| 9066 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9067 | return; |
| 9068 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9069 | |
| 9070 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9071 | if(eCSR_ENCRYPT_TYPE_NONE != pSession->connectedProfile.EncryptionType) |
| 9072 | { |
| 9073 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
| 9074 | palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 9075 | if( pRsp->peerMacAddr[0] & 0x01 ) |
| 9076 | { |
| 9077 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 9078 | } |
| 9079 | else |
| 9080 | { |
| 9081 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 9082 | } |
| 9083 | setKeyEvent.encryptionModeMulticast = |
| 9084 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9085 | setKeyEvent.encryptionModeUnicast = |
| 9086 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9087 | palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 9088 | setKeyEvent.authMode = |
| 9089 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 9090 | if( eSIR_SUCCESS != pRsp->statusCode ) |
| 9091 | { |
| 9092 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 9093 | } |
| 9094 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 9095 | } |
| 9096 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9097 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 9098 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9099 | csrRoamStopWaitForKeyTimer( pMac ); |
| 9100 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9101 | //We are done with authentication, whethere succeed or not |
| 9102 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9103 | //We do it here because this linkup function is not called after association |
| 9104 | //when a key needs to be set. |
| 9105 | if( csrIsConnStateConnectedInfra(pMac, sessionId) ) |
| 9106 | { |
| 9107 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 9108 | } |
| 9109 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9110 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9111 | { |
| 9112 | palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9113 | //Make sure we install the GTK before indicating to HDD as authenticated |
| 9114 | //This is to prevent broadcast packets go out after PTK and before GTK. |
| 9115 | if( palEqualMemory( pMac->hHdd, &Broadcastaddr, pRsp->peerMacAddr, |
| 9116 | sizeof(tSirMacAddr) ) ) |
| 9117 | { |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 9118 | #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE |
| 9119 | if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE) |
| 9120 | { |
| 9121 | tpSirSetActiveModeSetBncFilterReq pMsg; |
| 9122 | palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tSirSetActiveModeSetBncFilterReq)); |
| 9123 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_BCN_FILTER_REQ); |
| 9124 | pMsg->length = pal_cpu_to_be16(sizeof( tANI_U8)); |
| 9125 | pMsg->seesionId = sessionId; |
| 9126 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 9127 | } |
| 9128 | #endif |
| 9129 | result = eCSR_ROAM_RESULT_AUTHENTICATED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9130 | } |
| 9131 | else |
| 9132 | { |
| 9133 | result = eCSR_ROAM_RESULT_NONE; |
| 9134 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9135 | pRoamInfo = &roamInfo; |
| 9136 | } |
| 9137 | else |
| 9138 | { |
| 9139 | result = eCSR_ROAM_RESULT_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9140 | 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] | 9141 | pRsp->statusCode, pRsp->peerMacAddr[0], pRsp->peerMacAddr[1], pRsp->peerMacAddr[2], |
| 9142 | pRsp->peerMacAddr[3], pRsp->peerMacAddr[4], pRsp->peerMacAddr[5] ); |
| 9143 | } |
| 9144 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 9145 | eCSR_ROAM_SET_KEY_COMPLETE, result); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9146 | // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS |
| 9147 | // can go ahead and initiate the TSPEC if any are pending |
| 9148 | 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] | 9149 | #ifdef FEATURE_WLAN_CCX |
| 9150 | //Send Adjacent AP repot to new AP. |
| 9151 | if (result == eCSR_ROAM_RESULT_AUTHENTICATED && |
| 9152 | pSession->isPrevApInfoValid && |
| 9153 | pSession->connectedProfile.isCCXAssoc) |
| 9154 | { |
| 9155 | #ifdef WLAN_FEATURE_VOWIFI |
| 9156 | csrCcxSendAdjacentApRepMsg(pMac, pSession); |
| 9157 | #endif |
| 9158 | pSession->isPrevApInfoValid = FALSE; |
| 9159 | } |
| 9160 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9161 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9162 | { |
| 9163 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 9164 | } |
| 9165 | } |
| 9166 | else |
| 9167 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9168 | 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] | 9169 | } |
| 9170 | } |
| 9171 | else |
| 9172 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9173 | smsLog( pMac, LOGE, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9174 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9175 | smeProcessPendingQueue( pMac ); |
| 9176 | } |
| 9177 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9178 | case eWNI_SME_REMOVEKEY_RSP: |
| 9179 | { |
| 9180 | tSirSmeRemoveKeyRsp *pRsp = (tSirSmeRemoveKeyRsp *)pSirMsg; |
| 9181 | tListElem *pEntry; |
| 9182 | tSmeCmd *pCommand; |
| 9183 | |
| 9184 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9185 | if ( pEntry ) |
| 9186 | { |
| 9187 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9188 | if ( eSmeCommandRemoveKey == pCommand->command ) |
| 9189 | { |
| 9190 | sessionId = pCommand->sessionId; |
| 9191 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9192 | |
| 9193 | if(!pSession) |
| 9194 | { |
| 9195 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9196 | return; |
| 9197 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9198 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9199 | { |
| 9200 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
| 9201 | palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 9202 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
| 9203 | removeKeyEvent.encryptionModeMulticast = |
| 9204 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9205 | removeKeyEvent.encryptionModeUnicast = |
| 9206 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9207 | palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 9208 | removeKeyEvent.authMode = |
| 9209 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 9210 | if( eSIR_SUCCESS != pRsp->statusCode ) |
| 9211 | { |
| 9212 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 9213 | } |
| 9214 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 9215 | } |
| 9216 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9217 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9218 | { |
| 9219 | palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) ); |
| 9220 | result = eCSR_ROAM_RESULT_NONE; |
| 9221 | pRoamInfo = &roamInfo; |
| 9222 | } |
| 9223 | else |
| 9224 | { |
| 9225 | result = eCSR_ROAM_RESULT_FAILURE; |
| 9226 | } |
| 9227 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 9228 | eCSR_ROAM_REMOVE_KEY_COMPLETE, result); |
| 9229 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9230 | { |
| 9231 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 9232 | } |
| 9233 | } |
| 9234 | else |
| 9235 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9236 | 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] | 9237 | } |
| 9238 | } |
| 9239 | else |
| 9240 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9241 | smsLog( pMac, LOGW, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9242 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9243 | smeProcessPendingQueue( pMac ); |
| 9244 | } |
| 9245 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9246 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9247 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9248 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 9249 | break; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9250 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 9251 | case eWNI_SME_GET_ROAM_RSSI_RSP: |
| 9252 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
| 9253 | csrRoamRssiRspProcessor( pMac, pSirMsg ); |
| 9254 | break; |
| 9255 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9256 | case eWNI_SME_GET_RSSI_REQ: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9257 | smsLog( pMac, LOG2, FL("GetRssiReq from self")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9258 | csrUpdateRssi( pMac, pSirMsg ); |
| 9259 | break; |
| 9260 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9261 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9262 | case eWNI_SME_FT_PRE_AUTH_RSP: |
| 9263 | csrRoamFTPreAuthRspProcessor( pMac, (tpSirFTPreAuthRsp)pSirMsg ); |
| 9264 | break; |
| 9265 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9266 | case eWNI_SME_MAX_ASSOC_EXCEEDED: |
| 9267 | pSmeMaxAssocInd = (tSmeMaxAssocInd*)pSirMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9268 | 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] | 9269 | sessionId = pSmeMaxAssocInd->sessionId; |
| 9270 | roamInfo.sessionId = sessionId; |
| 9271 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pSmeMaxAssocInd->peerMac, sizeof(tCsrBssid)); |
| 9272 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 9273 | eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED); |
| 9274 | break; |
| 9275 | |
| 9276 | case eWNI_SME_BTAMP_LOG_LINK_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9277 | 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] | 9278 | btampEstablishLogLinkHdlr( pSirMsg ); |
| 9279 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9280 | case eWNI_SME_RSSI_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9281 | smsLog( pMac, LOG1, FL("RSSI indication from TL serialized through MC thread")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9282 | csrRoamRssiIndHdlr( pMac, pSirMsg ); |
| 9283 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9284 | |
| 9285 | default: |
| 9286 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9287 | } // end switch on message type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9288 | } |
| 9289 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9290 | void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, |
| 9291 | tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult) |
| 9292 | { |
| 9293 | if(pSession) |
| 9294 | { |
| 9295 | if(pSession->bRefAssocStartCnt) |
| 9296 | { |
| 9297 | pSession->bRefAssocStartCnt--; |
| 9298 | VOS_ASSERT( pSession->bRefAssocStartCnt == 0); |
| 9299 | //Need to call association_completion because there is an assoc_start pending. |
| 9300 | csrRoamCallCallback(pMac, pSession->sessionId, NULL, roamId, |
| 9301 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 9302 | eCSR_ROAM_RESULT_FAILURE); |
| 9303 | } |
| 9304 | csrRoamCallCallback(pMac, pSession->sessionId, pRoamInfo, roamId, eCSR_ROAM_ROAMING_COMPLETION, roamResult); |
| 9305 | } |
| 9306 | else |
| 9307 | { |
| 9308 | smsLog(pMac, LOGW, FL(" pSession is NULL")); |
| 9309 | } |
| 9310 | } |
| 9311 | |
| 9312 | |
| 9313 | eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason) |
| 9314 | { |
| 9315 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9316 | if(CSR_IS_LOSTLINK_ROAMING(roamingReason) && |
| 9317 | (eANI_BOOLEAN_FALSE == pMac->roam.roamSession[sessionId].fCancelRoaming)) |
| 9318 | { |
| 9319 | status = csrScanRequestLostLink1( pMac, sessionId ); |
| 9320 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9321 | return(status); |
| 9322 | } |
| 9323 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9324 | //return a boolean to indicate whether roaming completed or continue. |
| 9325 | tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 9326 | tANI_BOOLEAN fForce, eCsrRoamResult roamResult) |
| 9327 | { |
| 9328 | tANI_BOOLEAN fCompleted = eANI_BOOLEAN_TRUE; |
| 9329 | tANI_TIMESTAMP roamTime = (tANI_TIMESTAMP)(pMac->roam.configParam.nRoamingTime * PAL_TICKS_PER_SECOND); |
| 9330 | tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 9331 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9332 | if(!pSession) |
| 9333 | { |
| 9334 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9335 | return eANI_BOOLEAN_FALSE; |
| 9336 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9337 | //Check whether time is up |
| 9338 | if(pSession->fCancelRoaming || fForce || |
| 9339 | ((curTime - pSession->roamingStartTime) > roamTime) || |
| 9340 | eCsrReassocRoaming == pSession->roamingReason || |
| 9341 | eCsrDynamicRoaming == pSession->roamingReason) |
| 9342 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9343 | smsLog(pMac, LOGW, FL(" indicates roaming completion")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9344 | if(pSession->fCancelRoaming && CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason)) |
| 9345 | { |
| 9346 | //roaming is cancelled, tell HDD to indicate disconnect |
| 9347 | //Because LIM overload deauth_ind for both deauth frame and missed beacon |
| 9348 | //we need to use this logic to detinguish it. For missed beacon, LIM set reason |
| 9349 | //to be eSIR_BEACON_MISSED |
| 9350 | if(eSIR_BEACON_MISSED == pSession->roamingStatusCode) |
| 9351 | { |
| 9352 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 9353 | } |
| 9354 | else if(eCsrLostlinkRoamingDisassoc == pSession->roamingReason) |
| 9355 | { |
| 9356 | roamResult = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 9357 | } |
| 9358 | else if(eCsrLostlinkRoamingDeauth == pSession->roamingReason) |
| 9359 | { |
| 9360 | roamResult = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 9361 | } |
| 9362 | else |
| 9363 | { |
| 9364 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 9365 | } |
| 9366 | } |
| 9367 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 9368 | pSession->roamingReason = eCsrNotRoaming; |
| 9369 | } |
| 9370 | else |
| 9371 | { |
| 9372 | pSession->roamResult = roamResult; |
| 9373 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoamingTimer(pMac, sessionId, PAL_TIMER_TO_SEC_UNIT))) |
| 9374 | { |
| 9375 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 9376 | pSession->roamingReason = eCsrNotRoaming; |
| 9377 | } |
| 9378 | else |
| 9379 | { |
| 9380 | fCompleted = eANI_BOOLEAN_FALSE; |
| 9381 | } |
| 9382 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9383 | return(fCompleted); |
| 9384 | } |
| 9385 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9386 | void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9387 | { |
| 9388 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9389 | |
| 9390 | if(!pSession) |
| 9391 | { |
| 9392 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9393 | return; |
| 9394 | } |
| 9395 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9396 | if(CSR_IS_ROAMING(pSession)) |
| 9397 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9398 | smsLog(pMac, LOGW, " Cancelling roaming"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9399 | pSession->fCancelRoaming = eANI_BOOLEAN_TRUE; |
| 9400 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 9401 | { |
| 9402 | //No need to do anything in here because the handler takes care of it |
| 9403 | } |
| 9404 | else |
| 9405 | { |
| 9406 | eCsrRoamResult roamResult = CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason) ? |
| 9407 | eCSR_ROAM_RESULT_LOSTLINK : eCSR_ROAM_RESULT_NONE; |
| 9408 | //Roaming is stopped after here |
| 9409 | csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_TRUE, roamResult); |
| 9410 | //Since CSR may be in lostlink roaming situation, abort all roaming related activities |
| 9411 | csrScanAbortMacScan(pMac); |
| 9412 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 9413 | } |
| 9414 | } |
| 9415 | } |
| 9416 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9417 | void csrRoamRoamingTimerHandler(void *pv) |
| 9418 | { |
| 9419 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9420 | tpAniSirGlobal pMac = pInfo->pMac; |
| 9421 | tANI_U32 sessionId = pInfo->sessionId; |
| 9422 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9423 | |
| 9424 | if(!pSession) |
| 9425 | { |
| 9426 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9427 | return; |
| 9428 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9429 | |
| 9430 | if(eANI_BOOLEAN_FALSE == pSession->fCancelRoaming) |
| 9431 | { |
| 9432 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoaming(pMac, sessionId, pSession->roamingReason))) |
| 9433 | { |
| 9434 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, pSession->roamResult); |
| 9435 | pSession->roamingReason = eCsrNotRoaming; |
| 9436 | } |
| 9437 | } |
| 9438 | } |
| 9439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9440 | eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 9441 | { |
| 9442 | eHalStatus status; |
| 9443 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9444 | |
| 9445 | if(!pSession) |
| 9446 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9447 | smsLog(pMac, LOGE, FL(" session %d not found"), sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9448 | return eHAL_STATUS_FAILURE; |
| 9449 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9450 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9451 | smsLog(pMac, LOG1, " csrScanStartRoamingTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9452 | pSession->roamingTimerInfo.sessionId = (tANI_U8)sessionId; |
| 9453 | status = palTimerStart(pMac->hHdd, pSession->hTimerRoaming, interval, eANI_BOOLEAN_FALSE); |
| 9454 | |
| 9455 | return (status); |
| 9456 | } |
| 9457 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9458 | eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9459 | { |
| 9460 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerRoaming)); |
| 9461 | } |
| 9462 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9463 | void csrRoamWaitForKeyTimeOutHandler(void *pv) |
| 9464 | { |
| 9465 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9466 | tpAniSirGlobal pMac = pInfo->pMac; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9467 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pInfo->sessionId ); |
| 9468 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9469 | smsLog(pMac, LOGW, "WaitForKey timer expired in state=%d sub-state=%d", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9470 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9471 | pMac->roam.curSubState[pInfo->sessionId]); |
| 9472 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9473 | if( CSR_IS_WAIT_FOR_KEY( pMac, pInfo->sessionId ) ) |
| 9474 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9475 | #ifdef FEATURE_WLAN_LFR |
| 9476 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9477 | { |
| 9478 | /* |
| 9479 | * Enable heartbeat timer when hand-off is in progress |
| 9480 | * and Key Wait timer expired. |
| 9481 | */ |
| 9482 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey expiry" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9483 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9484 | pMac->roam.configParam.HeartbeatThresh24); |
| 9485 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 9486 | pMac->roam.configParam.HeartbeatThresh24, |
| 9487 | NULL, eANI_BOOLEAN_FALSE); |
| 9488 | } |
| 9489 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9490 | smsLog(pMac, LOGW, " SME pre-auth state timeout. "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9491 | //Change the substate so command queue is unblocked. |
| 9492 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, pInfo->sessionId); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9493 | if (pSession) |
| 9494 | { |
| 9495 | if( csrIsConnStateConnectedInfra(pMac, pInfo->sessionId) ) |
| 9496 | { |
| 9497 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 9498 | smeProcessPendingQueue(pMac); |
| 9499 | } |
| 9500 | else |
| 9501 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9502 | smsLog(pMac, LOGW, "%s: could not post link up", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9503 | __func__); |
| 9504 | } |
| 9505 | } |
| 9506 | else |
| 9507 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9508 | smsLog(pMac, LOGW, "%s: session not found", __func__); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9509 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9510 | } |
| 9511 | |
| 9512 | } |
| 9513 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9514 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval) |
| 9515 | { |
| 9516 | eHalStatus status; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9517 | #ifdef FEATURE_WLAN_LFR |
| 9518 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9519 | { |
| 9520 | /* Disable heartbeat timer when hand-off is in progress */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9521 | 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] | 9522 | __func__, |
| 9523 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9524 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId]); |
| 9525 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE); |
| 9526 | } |
| 9527 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9528 | smsLog(pMac, LOG1, " csrScanStartWaitForKeyTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9529 | status = palTimerStart(pMac->hHdd, pMac->roam.hTimerWaitForKey, interval, eANI_BOOLEAN_FALSE); |
| 9530 | |
| 9531 | return (status); |
| 9532 | } |
| 9533 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9534 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac) |
| 9535 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9536 | smsLog(pMac, LOG2, "WaitForKey timer stopped in state=%d sub-state=%d", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9537 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9538 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId]); |
| 9539 | #ifdef FEATURE_WLAN_LFR |
| 9540 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9541 | { |
| 9542 | /* |
| 9543 | * Enable heartbeat timer when hand-off is in progress |
| 9544 | * and Key Wait timer got stopped for some reason |
| 9545 | */ |
| 9546 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey stop" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9547 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9548 | pMac->roam.configParam.HeartbeatThresh24); |
| 9549 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 9550 | pMac->roam.configParam.HeartbeatThresh24, |
| 9551 | NULL, eANI_BOOLEAN_FALSE); |
| 9552 | } |
| 9553 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9554 | return (palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey)); |
| 9555 | } |
| 9556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9557 | void csrRoamIbssJoinTimerHandler(void *pv) |
| 9558 | { |
| 9559 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9560 | tpAniSirGlobal pMac = pInfo->pMac; |
| 9561 | eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE; |
| 9562 | tANI_U32 sessionId = pInfo->sessionId; |
| 9563 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9564 | |
| 9565 | if(!pSession) |
| 9566 | { |
| 9567 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9568 | return; |
| 9569 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9570 | |
| 9571 | pSession->ibss_join_pending = FALSE; |
| 9572 | // JEZ100225: As of main/latest "tip", we are no longer doing this. Check on this. |
| 9573 | //csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 9574 | // Send an IBSS stop request to PE |
| 9575 | csrRoamDisconnectInternal(pMac, sessionId, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9576 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9577 | eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 9578 | { |
| 9579 | eHalStatus status; |
| 9580 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9581 | |
| 9582 | if(!pSession) |
| 9583 | { |
| 9584 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9585 | return eHAL_STATUS_FAILURE; |
| 9586 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9587 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9588 | smsLog(pMac, LOG1, " csrRoamStartIbssJoinTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9589 | pSession->ibssJoinTimerInfo.sessionId = (tANI_U8)sessionId; |
| 9590 | status = palTimerStart(pMac->hHdd, pSession->hTimerIbssJoining, interval, eANI_BOOLEAN_FALSE); |
| 9591 | |
| 9592 | return (status); |
| 9593 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9594 | eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9595 | { |
| 9596 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerIbssJoining)); |
| 9597 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9598 | void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, |
| 9599 | eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess) |
| 9600 | { |
| 9601 | eRoamCmdStatus roamStatus = csrGetRoamCompleteStatus(pMac, sessionId); |
| 9602 | tANI_U32 roamId = 0; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9603 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 9604 | /* To silence the KW tool Null chaeck is added */ |
| 9605 | if(!pSession) |
| 9606 | { |
| 9607 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9608 | return; |
| 9609 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9610 | |
| 9611 | if(pCommand) |
| 9612 | { |
| 9613 | roamId = pCommand->u.roamCmd.roamId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9614 | VOS_ASSERT( sessionId == pCommand->sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9615 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9616 | if(eCSR_ROAM_ROAMING_COMPLETION == roamStatus) |
| 9617 | { |
| 9618 | //if success, force roaming completion |
| 9619 | csrRoamCompleteRoaming(pMac, sessionId, fSuccess, roamResult); |
| 9620 | } |
| 9621 | else |
| 9622 | { |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9623 | VOS_ASSERT(pSession->bRefAssocStartCnt == 0); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9624 | smsLog(pMac, LOGW, FL(" indicates association completion. roamResult = %d"), roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9625 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, roamId, roamStatus, roamResult); |
| 9626 | } |
| 9627 | } |
| 9628 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9629 | eHalStatus csrRoamLostLink( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 type, tSirSmeRsp *pSirMsg) |
| 9630 | { |
| 9631 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9632 | tSirSmeDeauthInd *pDeauthIndMsg = NULL; |
| 9633 | tSirSmeDisassocInd *pDisassocIndMsg = NULL; |
| 9634 | eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK; |
| 9635 | tCsrRoamInfo *pRoamInfo = NULL; |
| 9636 | tCsrRoamInfo roamInfo; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9637 | tANI_BOOLEAN fToRoam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9638 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9639 | /* To silence the KW tool Null chaeck is added */ |
| 9640 | if(!pSession) |
| 9641 | { |
| 9642 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9643 | return eHAL_STATUS_FAILURE; |
| 9644 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9645 | //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] | 9646 | fToRoam = CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9647 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
| 9648 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 9649 | { |
| 9650 | result = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 9651 | pDisassocIndMsg = (tSirSmeDisassocInd *)pSirMsg; |
| 9652 | pSession->roamingStatusCode = pDisassocIndMsg->statusCode; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 9653 | pSession->joinFailStatusCode.reasonCode = pDisassocIndMsg->reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9654 | } |
| 9655 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 9656 | { |
| 9657 | result = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 9658 | pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg; |
| 9659 | pSession->roamingStatusCode = pDeauthIndMsg->statusCode; |
Madan Mohan Koyyalamudi | 6a80893 | 2012-11-06 16:05:54 -0800 | [diff] [blame] | 9660 | /* Convert into proper reason code */ |
| 9661 | pSession->joinFailStatusCode.reasonCode = |
| 9662 | (pDeauthIndMsg->reasonCode == eSIR_BEACON_MISSED) ? |
Agarwal Ashish | 838f1f3 | 2013-03-11 20:54:52 +0530 | [diff] [blame] | 9663 | 0 : pDeauthIndMsg->reasonCode; |
| 9664 | /* cfg layer expects 0 as reason code if |
| 9665 | the driver dosent know the reason code |
| 9666 | eSIR_BEACON_MISSED is defined as locally */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9667 | } |
| 9668 | else |
| 9669 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9670 | smsLog(pMac, LOGW, FL("gets an unknown type (%d)"), type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9671 | result = eCSR_ROAM_RESULT_NONE; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 9672 | pSession->joinFailStatusCode.reasonCode = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9673 | } |
| 9674 | |
| 9675 | // call profile lost link routine here |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9676 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9677 | { |
| 9678 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_LOSTLINK_DETECTED, result); |
| 9679 | } |
| 9680 | |
| 9681 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 9682 | { |
| 9683 | status = csrSendMBDisassocCnfMsg(pMac, pDisassocIndMsg); |
| 9684 | } |
| 9685 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 9686 | { |
| 9687 | status = csrSendMBDeauthCnfMsg(pMac, pDeauthIndMsg); |
| 9688 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9689 | if(!HAL_STATUS_SUCCESS(status)) |
| 9690 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9691 | //If fail to send confirmation to PE, not to trigger roaming |
| 9692 | fToRoam = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9693 | } |
| 9694 | |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9695 | //prepare to tell HDD to disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9696 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 9697 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 9698 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9699 | if( eWNI_SME_DISASSOC_IND == type) |
| 9700 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9701 | //staMacAddr |
| 9702 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 9703 | roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId; |
| 9704 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9705 | else if( eWNI_SME_DEAUTH_IND == type ) |
| 9706 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9707 | //staMacAddr |
| 9708 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 9709 | roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId; |
| 9710 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9711 | smsLog(pMac, LOGW, FL("roamInfo.staId (%d)"), roamInfo.staId); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9712 | |
| 9713 | /* See if we can possibly roam. If so, start the roaming process and notify HDD |
| 9714 | that we are roaming. But if we cannot possibly roam, or if we are unable to |
| 9715 | currently roam, then notify HDD of the lost link */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9716 | if(fToRoam) |
| 9717 | { |
| 9718 | //Only remove the connected BSS in infrastructure mode |
| 9719 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 9720 | //Not to do anying for lostlink with WDS |
| 9721 | if( pMac->roam.configParam.nRoamingTime ) |
| 9722 | { |
| 9723 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac, sessionId, |
| 9724 | ( eWNI_SME_DEAUTH_IND == type ) ? |
| 9725 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc))) |
| 9726 | { |
| 9727 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 9728 | //For IBSS, we need to give some more info to HDD |
| 9729 | if(csrIsBssTypeIBSS(pSession->connectedProfile.BSSType)) |
| 9730 | { |
| 9731 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 9732 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 9733 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 9734 | } |
| 9735 | else |
| 9736 | { |
| 9737 | roamInfo.reasonCode = eCsrRoamReasonSmeIssuedForLostLink; |
| 9738 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9739 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9740 | pSession->roamingReason = ( eWNI_SME_DEAUTH_IND == type ) ? |
| 9741 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc; |
| 9742 | pSession->roamingStartTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 9743 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_LOSTLINK); |
| 9744 | } |
| 9745 | else |
| 9746 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9747 | smsLog(pMac, LOGW, " %s Fail to start roaming, status = %d", __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9748 | fToRoam = eANI_BOOLEAN_FALSE; |
| 9749 | } |
| 9750 | } |
| 9751 | else |
| 9752 | { |
| 9753 | //We are told not to roam, indicate lostlink |
| 9754 | fToRoam = eANI_BOOLEAN_FALSE; |
| 9755 | } |
| 9756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9757 | if(!fToRoam) |
| 9758 | { |
Madan Mohan Koyyalamudi | af854cf | 2012-10-30 17:56:25 -0700 | [diff] [blame] | 9759 | //Tell HDD about the lost link |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9760 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9761 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9762 | /* Don't call csrRoamCallCallback for GO/SoftAp case as this indication |
| 9763 | * was already given as part of eWNI_SME_DISASSOC_IND msg handling in |
| 9764 | * csrRoamCheckForLinkStatusChange API. |
| 9765 | */ |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9766 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result); |
| 9767 | } |
| 9768 | |
| 9769 | /*No need to start idle scan in case of IBSS/SAP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9770 | Still enable idle scan for polling in case concurrent sessions are running */ |
| 9771 | if(CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile)) |
| 9772 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9773 | csrScanStartIdleScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9774 | } |
| 9775 | } |
| 9776 | |
| 9777 | return (status); |
| 9778 | } |
| 9779 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9780 | eHalStatus csrRoamLostLinkAfterhandoffFailure( tpAniSirGlobal pMac,tANI_U32 sessionId) |
| 9781 | { |
| 9782 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9783 | tListElem *pEntry = NULL; |
| 9784 | tSmeCmd *pCommand = NULL; |
| 9785 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9786 | |
| 9787 | if(!pSession) |
| 9788 | { |
| 9789 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9790 | return eHAL_STATUS_FAILURE; |
| 9791 | } |
| 9792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9793 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9794 | //Only remove the connected BSS in infrastructure mode |
| 9795 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 9796 | if(pMac->roam.configParam.nRoamingTime) |
| 9797 | { |
| 9798 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac,sessionId, pSession->roamingReason))) |
| 9799 | { |
| 9800 | //before starting the lost link logic release the roam command for handoff |
| 9801 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 9802 | if(pEntry) |
| 9803 | { |
| 9804 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 9805 | } |
| 9806 | if(pCommand) |
| 9807 | { |
| 9808 | if (( eSmeCommandRoam == pCommand->command ) && |
| 9809 | ( eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)) |
| 9810 | { |
| 9811 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9812 | { |
| 9813 | csrReleaseCommandRoam( pMac, pCommand ); |
| 9814 | } |
| 9815 | } |
| 9816 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9817 | smsLog( pMac, LOGW, "Lost link roaming started ..."); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9818 | } |
| 9819 | } |
| 9820 | else |
| 9821 | { |
| 9822 | //We are told not to roam, indicate lostlink |
| 9823 | status = eHAL_STATUS_FAILURE; |
| 9824 | } |
| 9825 | |
| 9826 | return (status); |
| 9827 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9828 | void csrRoamWmStatusChangeComplete( tpAniSirGlobal pMac ) |
| 9829 | { |
| 9830 | tListElem *pEntry; |
| 9831 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9832 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9833 | if ( pEntry ) |
| 9834 | { |
| 9835 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9836 | if ( eSmeCommandWmStatusChange == pCommand->command ) |
| 9837 | { |
| 9838 | // Nothing to process in a Lost Link completion.... It just kicks off a |
| 9839 | // roaming sequence. |
| 9840 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9841 | { |
| 9842 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 9843 | } |
| 9844 | else |
| 9845 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9846 | smsLog( pMac, LOGE, " ******csrRoamWmStatusChangeComplete fail to release command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9847 | } |
| 9848 | |
| 9849 | } |
| 9850 | else |
| 9851 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9852 | 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] | 9853 | } |
| 9854 | } |
| 9855 | else |
| 9856 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9857 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9858 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9859 | smeProcessPendingQueue( pMac ); |
| 9860 | } |
| 9861 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9862 | void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 9863 | { |
| 9864 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 9865 | tSirSmeRsp *pSirSmeMsg; |
| 9866 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pCommand->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9867 | |
| 9868 | if(!pSession) |
| 9869 | { |
| 9870 | smsLog(pMac, LOGE, FL(" session %d not found "), pCommand->sessionId); |
| 9871 | return; |
| 9872 | } |
| 9873 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9874 | switch ( pCommand->u.wmStatusChangeCmd.Type ) |
| 9875 | { |
| 9876 | case eCsrDisassociated: |
| 9877 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg; |
| 9878 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DISASSOC_IND, pSirSmeMsg); |
| 9879 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9880 | case eCsrDeauthenticated: |
| 9881 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg; |
| 9882 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DEAUTH_IND, pSirSmeMsg); |
| 9883 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9884 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9885 | 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] | 9886 | break; |
| 9887 | } |
| 9888 | //For WDS, we want to stop BSS as well when it is indicated that it is disconnected. |
| 9889 | if( CSR_IS_CONN_WDS(&pSession->connectedProfile) ) |
| 9890 | { |
| 9891 | if( !HAL_STATUS_SUCCESS(csrRoamIssueStopBssCmd( pMac, pCommand->sessionId, eANI_BOOLEAN_TRUE )) ) |
| 9892 | { |
| 9893 | //This is not good |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9894 | smsLog(pMac, LOGE, FL(" failed to issue stopBSS command")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9895 | } |
| 9896 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9897 | // Lost Link just triggers a roaming sequence. We can complte the Lost Link |
| 9898 | // command here since there is nothing else to do. |
| 9899 | csrRoamWmStatusChangeComplete( pMac ); |
| 9900 | } |
| 9901 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9902 | //This function returns band and mode information. |
| 9903 | //The only tricky part is that if phyMode is set to 11abg, this function may return eCSR_CFG_DOT11_MODE_11B |
| 9904 | //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] | 9905 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 9906 | tANI_U8 operationChn, eCsrBand *pBand ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9907 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9908 | eCsrPhyMode phyModeIn = (eCsrPhyMode)pProfile->phyMode; |
| 9909 | eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pProfile, phyModeIn, |
| 9910 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9911 | eCsrBand eBand; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 9912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9913 | //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] | 9914 | if( ((!CSR_IS_INFRA_AP(pProfile )&& !CSR_IS_WDS(pProfile )) && |
| 9915 | ((eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) || |
| 9916 | (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode))) || |
| 9917 | (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9918 | { |
| 9919 | switch( pMac->roam.configParam.uCfgDot11Mode ) |
| 9920 | { |
| 9921 | case eCSR_CFG_DOT11_MODE_11A: |
| 9922 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 9923 | eBand = eCSR_BAND_5G; |
| 9924 | break; |
| 9925 | case eCSR_CFG_DOT11_MODE_11B: |
| 9926 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9927 | eBand = eCSR_BAND_24; |
| 9928 | break; |
| 9929 | case eCSR_CFG_DOT11_MODE_11G: |
| 9930 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 9931 | eBand = eCSR_BAND_24; |
| 9932 | break; |
| 9933 | case eCSR_CFG_DOT11_MODE_11N: |
| 9934 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 9935 | eBand = eCSR_BAND_24; |
| 9936 | break; |
| 9937 | //case eCSR_CFG_DOT11_MODE_BEST: |
| 9938 | // cfgDot11Mode = eCSR_CFG_DOT11_MODE_BEST; |
| 9939 | // eBand = eCSR_BAND_24; |
| 9940 | // break; |
| 9941 | default: |
| 9942 | // Global dot11 Mode setting is 11a/b/g. |
| 9943 | // use the channel number to determine the Mode setting. |
| 9944 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 9945 | { |
| 9946 | eBand = pMac->roam.configParam.eBand; |
| 9947 | if(eCSR_BAND_24 == eBand) |
| 9948 | { |
| 9949 | //See reason in else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) to pick 11B |
| 9950 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9951 | } |
| 9952 | else |
| 9953 | { |
| 9954 | //prefer 5GHz |
| 9955 | eBand = eCSR_BAND_5G; |
| 9956 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 9957 | } |
| 9958 | } |
| 9959 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 9960 | { |
| 9961 | // channel is a 2.4GHz channel. Set mode to 11g. |
| 9962 | // |
| 9963 | // !!LAC - WiFi tests require IBSS networks to start in 11b mode without any change to the |
| 9964 | // default parameter settings on the adapter. We use ACU to start an IBSS through creation |
| 9965 | // of a startIBSS profile. this startIBSS profile has Auto MACProtocol and the |
| 9966 | // adapter property setting for dot11Mode is also AUTO. So in this case, let's start |
| 9967 | // the IBSS network in 11b mode instead of 11g mode. |
| 9968 | // |
| 9969 | // so this is for Auto=profile->MacProtocol && Auto=Global.dot11Mode && profile->channel is < 14, |
| 9970 | // then start the IBSS in b mode. |
| 9971 | // |
| 9972 | // Note: we used to have this start as an 11g IBSS for best performance... now to specify that |
| 9973 | // the user will have to set the do11Mode in the property page to 11g to force it. |
| 9974 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9975 | eBand = eCSR_BAND_24; |
| 9976 | } |
| 9977 | else |
| 9978 | { |
| 9979 | // else, it's a 5.0GHz channel. Set mode to 11a. |
| 9980 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 9981 | eBand = eCSR_BAND_5G; |
| 9982 | } |
| 9983 | break; |
| 9984 | }//switch |
| 9985 | }//if( eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 9986 | else |
| 9987 | { |
| 9988 | //dot11 mode is set, lets pick the band |
| 9989 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 9990 | { |
| 9991 | // channel is Auto also. |
| 9992 | eBand = pMac->roam.configParam.eBand; |
| 9993 | if(eCSR_BAND_ALL == eBand) |
| 9994 | { |
| 9995 | //prefer 5GHz |
| 9996 | eBand = eCSR_BAND_5G; |
| 9997 | } |
| 9998 | } |
| 9999 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10000 | { |
| 10001 | eBand = eCSR_BAND_24; |
| 10002 | } |
| 10003 | else |
| 10004 | { |
| 10005 | eBand = eCSR_BAND_5G; |
| 10006 | } |
| 10007 | } |
| 10008 | if(pBand) |
| 10009 | { |
| 10010 | *pBand = eBand; |
| 10011 | } |
| 10012 | |
| 10013 | if (operationChn == 14){ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10014 | smsLog(pMac, LOGE, FL(" Switching to Dot11B mode ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10015 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10016 | } |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10017 | |
Madan Mohan Koyyalamudi | 5ec4b18 | 2012-11-28 16:15:17 -0800 | [diff] [blame] | 10018 | /* Incase of WEP Security encryption type is coming as part of add key. So while STart BSS dont have information */ |
| 10019 | 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] | 10020 | ((eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10021 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 10022 | (eCSR_CFG_DOT11_MODE_11AC == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10023 | #endif |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 10024 | (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode)) ) |
| 10025 | { |
| 10026 | //We cannot do 11n here |
| 10027 | if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10028 | { |
| 10029 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 10030 | } |
| 10031 | else |
| 10032 | { |
| 10033 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10034 | } |
| 10035 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10036 | return( cfgDot11Mode ); |
| 10037 | } |
| 10038 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10039 | eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 10040 | { |
| 10041 | eHalStatus status; |
| 10042 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10043 | |
| 10044 | if(!pSession) |
| 10045 | { |
| 10046 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10047 | return eHAL_STATUS_FAILURE; |
| 10048 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10049 | |
| 10050 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10051 | { |
| 10052 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10053 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 10054 | if(pIbssLog) |
| 10055 | { |
| 10056 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_REQ; |
| 10057 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 10058 | } |
| 10059 | } |
| 10060 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10061 | pSession->ibss_join_pending = FALSE; |
| 10062 | csrRoamStopIbssJoinTimer(pMac, sessionId ); |
| 10063 | // Set the roaming substate to 'stop Bss request'... |
| 10064 | csrRoamSubstateChange( pMac, NewSubstate, sessionId ); |
| 10065 | |
| 10066 | // attempt to stop the Bss (reason code is ignored...) |
| 10067 | status = csrSendMBStopBssReqMsg( pMac, sessionId ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 10068 | if(!HAL_STATUS_SUCCESS(status)) |
| 10069 | { |
| 10070 | smsLog(pMac, LOGW, FL("csrSendMBStopBssReqMsg failed with status %d"), status); |
| 10071 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10072 | return (status); |
| 10073 | } |
| 10074 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10075 | //pNumChan is a caller allocated space with the sizeof pChannels |
| 10076 | eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan) |
| 10077 | { |
| 10078 | |
| 10079 | return (ccmCfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 10080 | (tANI_U8 *)pChannels, |
| 10081 | pNumChan)); |
| 10082 | } |
| 10083 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 10084 | tPowerdBm csrGetCfgMaxTxPower (tpAniSirGlobal pMac, tANI_U8 channel) |
| 10085 | { |
| 10086 | tANI_U32 cfgLength = 0; |
| 10087 | tANI_U16 cfgId = 0; |
| 10088 | tPowerdBm maxTxPwr = 0; |
| 10089 | tANI_U8 *pCountryInfo = NULL; |
| 10090 | eHalStatus status; |
| 10091 | tANI_U8 count = 0; |
| 10092 | tANI_U8 firstChannel; |
| 10093 | tANI_U8 maxChannels; |
| 10094 | |
| 10095 | if (CSR_IS_CHANNEL_5GHZ(channel)) |
| 10096 | { |
| 10097 | cfgId = WNI_CFG_MAX_TX_POWER_5; |
| 10098 | cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN; |
| 10099 | } |
| 10100 | else if (CSR_IS_CHANNEL_24GHZ(channel)) |
| 10101 | { |
| 10102 | cfgId = WNI_CFG_MAX_TX_POWER_2_4; |
| 10103 | cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN; |
| 10104 | } |
| 10105 | else |
| 10106 | return maxTxPwr; |
| 10107 | |
| 10108 | status = palAllocateMemory(pMac->hHdd, (void **)&pCountryInfo, cfgLength); |
| 10109 | if (status != eHAL_STATUS_SUCCESS) |
| 10110 | { |
| 10111 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 10112 | FL("%s: palAllocateMemory() failed, status = %d"), |
| 10113 | __FUNCTION__, status); |
| 10114 | goto error; |
| 10115 | } |
| 10116 | status = ccmCfgGetStr(pMac, cfgId, (tANI_U8 *)pCountryInfo, &cfgLength); |
| 10117 | if (status != eHAL_STATUS_SUCCESS) |
| 10118 | { |
| 10119 | goto error; |
| 10120 | } |
| 10121 | /* Identify the channel and maxtxpower */ |
| 10122 | while (count <= (cfgLength - (sizeof(tSirMacChanInfo)))) |
| 10123 | { |
| 10124 | firstChannel = pCountryInfo[count++]; |
| 10125 | maxChannels = pCountryInfo[count++]; |
| 10126 | maxTxPwr = pCountryInfo[count++]; |
| 10127 | |
| 10128 | if ((channel >= firstChannel) && |
| 10129 | (channel < (firstChannel + maxChannels))) |
| 10130 | { |
| 10131 | break; |
| 10132 | } |
| 10133 | } |
| 10134 | |
| 10135 | error: |
| 10136 | if (NULL != pCountryInfo) |
| 10137 | palFreeMemory(pMac->hHdd, pCountryInfo); |
| 10138 | |
| 10139 | return maxTxPwr; |
| 10140 | } |
| 10141 | |
| 10142 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10143 | tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel ) |
| 10144 | { |
| 10145 | tANI_BOOLEAN fValid = FALSE; |
| 10146 | tANI_U32 idxValidChannels; |
| 10147 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10148 | |
| 10149 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len))) |
| 10150 | { |
| 10151 | for ( idxValidChannels = 0; ( idxValidChannels < len ); idxValidChannels++ ) |
| 10152 | { |
| 10153 | if ( channel == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10154 | { |
| 10155 | fValid = TRUE; |
| 10156 | break; |
| 10157 | } |
| 10158 | } |
| 10159 | } |
| 10160 | pMac->roam.numValidChannels = len; |
| 10161 | return fValid; |
| 10162 | } |
| 10163 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10164 | tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel) |
| 10165 | { |
| 10166 | tANI_BOOLEAN fValid = eANI_BOOLEAN_FALSE; |
| 10167 | tANI_U8 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10168 | for(i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++) |
| 10169 | { |
| 10170 | if(channel == pMac->scan.base40MHzChannels.channelList[i]) |
| 10171 | { |
| 10172 | fValid = eANI_BOOLEAN_TRUE; |
| 10173 | break; |
| 10174 | } |
| 10175 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10176 | return (fValid); |
| 10177 | } |
| 10178 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10179 | //This function check and validate whether the NIC can do CB (40MHz) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10180 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10181 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10182 | ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10183 | tANI_U8 centerChn; |
| 10184 | tANI_U32 ChannelBondingMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10185 | if(CSR_IS_CHANNEL_24GHZ(primaryChn)) |
| 10186 | { |
| 10187 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 10188 | } |
| 10189 | else |
| 10190 | { |
| 10191 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 10192 | } |
| 10193 | //Figure what the other side's CB mode |
| 10194 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 10195 | { |
| 10196 | if(pIes->HTCaps.present && (eHT_CHANNEL_WIDTH_40MHZ == pIes->HTCaps.supportedChannelWidthSet)) |
| 10197 | { |
| 10198 | if(pIes->HTInfo.present) |
| 10199 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10200 | /* This is called during INFRA STA/CLIENT and should use the merged value of |
| 10201 | * supported channel width and recommended tx width as per standard |
| 10202 | */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10203 | smsLog(pMac, LOG1, "scws %u rtws %u sco %u", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10204 | pIes->HTCaps.supportedChannelWidthSet, |
| 10205 | pIes->HTInfo.recommendedTxWidthSet, |
| 10206 | pIes->HTInfo.secondaryChannelOffset); |
| 10207 | |
| 10208 | if (pIes->HTInfo.recommendedTxWidthSet == eHT_CHANNEL_WIDTH_40MHZ) |
| 10209 | eRet = (ePhyChanBondState)pIes->HTInfo.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10210 | else |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10211 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 10212 | switch (eRet) { |
| 10213 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 10214 | centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET; |
| 10215 | break; |
| 10216 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 10217 | centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET; |
| 10218 | break; |
| 10219 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 10220 | default: |
| 10221 | centerChn = primaryChn; |
| 10222 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10223 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10224 | if((PHY_SINGLE_CHANNEL_CENTERED != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10225 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10226 | smsLog(pMac, LOGE, " Invalid center channel (%d), disable 40MHz mode", centerChn); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10227 | //eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10228 | } |
| 10229 | } |
| 10230 | } |
| 10231 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10232 | return eRet; |
| 10233 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10234 | tANI_BOOLEAN csrIsEncryptionInList( tpAniSirGlobal pMac, tCsrEncryptionList *pCipherList, eCsrEncryptionType encryptionType ) |
| 10235 | { |
| 10236 | tANI_BOOLEAN fFound = FALSE; |
| 10237 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10238 | for( idx = 0; idx < pCipherList->numEntries; idx++ ) |
| 10239 | { |
| 10240 | if( pCipherList->encryptionType[idx] == encryptionType ) |
| 10241 | { |
| 10242 | fFound = TRUE; |
| 10243 | break; |
| 10244 | } |
| 10245 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10246 | return fFound; |
| 10247 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10248 | tANI_BOOLEAN csrIsAuthInList( tpAniSirGlobal pMac, tCsrAuthList *pAuthList, eCsrAuthType authType ) |
| 10249 | { |
| 10250 | tANI_BOOLEAN fFound = FALSE; |
| 10251 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10252 | for( idx = 0; idx < pAuthList->numEntries; idx++ ) |
| 10253 | { |
| 10254 | if( pAuthList->authType[idx] == authType ) |
| 10255 | { |
| 10256 | fFound = TRUE; |
| 10257 | break; |
| 10258 | } |
| 10259 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10260 | return fFound; |
| 10261 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10262 | tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2) |
| 10263 | { |
| 10264 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 10265 | tCsrScanResultFilter *pScanFilter = NULL; |
| 10266 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10267 | |
| 10268 | if(pProfile1 && pProfile2) |
| 10269 | { |
| 10270 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 10271 | if(HAL_STATUS_SUCCESS(status)) |
| 10272 | { |
| 10273 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 10274 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile2, pScanFilter); |
| 10275 | if(HAL_STATUS_SUCCESS(status)) |
| 10276 | { |
| 10277 | fCheck = eANI_BOOLEAN_FALSE; |
| 10278 | do |
| 10279 | { |
| 10280 | tANI_U32 i; |
| 10281 | for(i = 0; i < pScanFilter->SSIDs.numOfSSIDs; i++) |
| 10282 | { |
| 10283 | fCheck = csrIsSsidMatch( pMac, pScanFilter->SSIDs.SSIDList[i].SSID.ssId, |
| 10284 | pScanFilter->SSIDs.SSIDList[i].SSID.length, |
| 10285 | pProfile1->SSID.ssId, pProfile1->SSID.length, eANI_BOOLEAN_FALSE ); |
| 10286 | if ( fCheck ) break; |
| 10287 | } |
| 10288 | if(!fCheck) |
| 10289 | { |
| 10290 | break; |
| 10291 | } |
| 10292 | if( !csrIsAuthInList( pMac, &pProfile2->AuthType, pProfile1->AuthType) |
| 10293 | || pProfile2->BSSType != pProfile1->BSSType |
| 10294 | || !csrIsEncryptionInList( pMac, &pProfile2->EncryptionType, pProfile1->EncryptionType ) |
| 10295 | ) |
| 10296 | { |
| 10297 | fCheck = eANI_BOOLEAN_FALSE; |
| 10298 | break; |
| 10299 | } |
| 10300 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10301 | if (pProfile1->MDID.mdiePresent || pProfile2->MDID.mdiePresent) |
| 10302 | { |
| 10303 | if (pProfile1->MDID.mobilityDomain != pProfile2->MDID.mobilityDomain) |
| 10304 | { |
| 10305 | fCheck = eANI_BOOLEAN_FALSE; |
| 10306 | break; |
| 10307 | } |
| 10308 | } |
| 10309 | #endif |
| 10310 | //Match found |
| 10311 | fCheck = eANI_BOOLEAN_TRUE; |
| 10312 | }while(0); |
| 10313 | csrFreeScanFilter(pMac, pScanFilter); |
| 10314 | } |
| 10315 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 10316 | } |
| 10317 | } |
| 10318 | |
| 10319 | return (fCheck); |
| 10320 | } |
| 10321 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10322 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2) |
| 10323 | { |
| 10324 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 10325 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10326 | do |
| 10327 | { |
| 10328 | //Only check for static WEP |
| 10329 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) && |
| 10330 | !csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) |
| 10331 | { |
| 10332 | fCheck = eANI_BOOLEAN_TRUE; |
| 10333 | break; |
| 10334 | } |
| 10335 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, pConnProfile->EncryptionType)) break; |
| 10336 | if(pConnProfile->Keys.defaultIndex != pProfile2->Keys.defaultIndex) break; |
| 10337 | for(i = 0; i < CSR_MAX_NUM_KEY; i++) |
| 10338 | { |
| 10339 | if(pConnProfile->Keys.KeyLength[i] != pProfile2->Keys.KeyLength[i]) break; |
| 10340 | if(!palEqualMemory(pMac->hHdd, &pConnProfile->Keys.KeyMaterial[i], |
| 10341 | &pProfile2->Keys.KeyMaterial[i], pProfile2->Keys.KeyLength[i])) |
| 10342 | { |
| 10343 | break; |
| 10344 | } |
| 10345 | } |
| 10346 | if( i == CSR_MAX_NUM_KEY) |
| 10347 | { |
| 10348 | fCheck = eANI_BOOLEAN_TRUE; |
| 10349 | } |
| 10350 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10351 | return (fCheck); |
| 10352 | } |
| 10353 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10354 | //IBSS |
| 10355 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10356 | tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac ) |
| 10357 | { |
| 10358 | tANI_U8 channel = 0; |
| 10359 | tANI_U32 idx; |
| 10360 | tANI_U32 idxValidChannels; |
| 10361 | tANI_BOOLEAN fFound = FALSE; |
| 10362 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10363 | |
| 10364 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel5G) |
| 10365 | { |
| 10366 | channel = pMac->roam.configParam.AdHocChannel5G; |
| 10367 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 10368 | { |
| 10369 | channel = 0; |
| 10370 | } |
| 10371 | } |
| 10372 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 10373 | { |
| 10374 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_50 ) && !fFound; idx++ ) |
| 10375 | { |
| 10376 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 10377 | { |
| 10378 | if ( csrStartIbssChannels50[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10379 | { |
| 10380 | fFound = TRUE; |
| 10381 | channel = csrStartIbssChannels50[ idx ]; |
| 10382 | } |
| 10383 | } |
| 10384 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10385 | // this is rare, but if it does happen, we find anyone in 11a bandwidth and return the first 11a channel found! |
| 10386 | if (!fFound) |
| 10387 | { |
| 10388 | for ( idxValidChannels = 0; idxValidChannels < len ; idxValidChannels++ ) |
| 10389 | { |
| 10390 | if ( CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ idx ]) ) // the max channel# in 11g is 14 |
| 10391 | { |
| 10392 | channel = csrStartIbssChannels50[ idx ]; |
| 10393 | break; |
| 10394 | } |
| 10395 | } |
| 10396 | } |
| 10397 | }//if |
| 10398 | |
| 10399 | return( channel ); |
| 10400 | } |
| 10401 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10402 | tANI_U8 csrRoamGetIbssStartChannelNumber24( tpAniSirGlobal pMac ) |
| 10403 | { |
| 10404 | tANI_U8 channel = 1; |
| 10405 | tANI_U32 idx; |
| 10406 | tANI_U32 idxValidChannels; |
| 10407 | tANI_BOOLEAN fFound = FALSE; |
| 10408 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10409 | |
| 10410 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel24) |
| 10411 | { |
| 10412 | channel = pMac->roam.configParam.AdHocChannel24; |
| 10413 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 10414 | { |
| 10415 | channel = 0; |
| 10416 | } |
| 10417 | } |
| 10418 | |
| 10419 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 10420 | { |
| 10421 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_24 ) && !fFound; idx++ ) |
| 10422 | { |
| 10423 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 10424 | { |
| 10425 | if ( csrStartIbssChannels24[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10426 | { |
| 10427 | fFound = TRUE; |
| 10428 | channel = csrStartIbssChannels24[ idx ]; |
| 10429 | } |
| 10430 | } |
| 10431 | } |
| 10432 | } |
| 10433 | |
| 10434 | return( channel ); |
| 10435 | } |
| 10436 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10437 | static void csrRoamGetBssStartParms( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 10438 | tCsrRoamStartBssParams *pParam ) |
| 10439 | { |
| 10440 | eCsrCfgDot11Mode cfgDot11Mode; |
| 10441 | eCsrBand eBand; |
| 10442 | tANI_U8 channel = 0; |
| 10443 | tSirNwType nwType; |
| 10444 | tANI_U8 operationChannel = 0; |
| 10445 | |
| 10446 | if(pProfile->ChannelInfo.numOfChannels && pProfile->ChannelInfo.ChannelList) |
| 10447 | { |
| 10448 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 10449 | } |
| 10450 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10451 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10452 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10453 | if( ( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 10454 | (pProfile->csrPersona == VOS_P2P_GO_MODE) ) |
| 10455 | && ( cfgDot11Mode == eCSR_CFG_DOT11_MODE_11B) |
| 10456 | ) |
| 10457 | { |
| 10458 | /* This should never happen */ |
| 10459 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10460 | FL("For P2PClient/P2P-GO (persona %d) cfgDot11Mode is 11B"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10461 | pProfile->csrPersona); |
| 10462 | VOS_ASSERT(0); |
| 10463 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10464 | switch( cfgDot11Mode ) |
| 10465 | { |
| 10466 | case eCSR_CFG_DOT11_MODE_11G: |
| 10467 | nwType = eSIR_11G_NW_TYPE; |
| 10468 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10469 | case eCSR_CFG_DOT11_MODE_11B: |
| 10470 | nwType = eSIR_11B_NW_TYPE; |
| 10471 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10472 | case eCSR_CFG_DOT11_MODE_11A: |
| 10473 | nwType = eSIR_11A_NW_TYPE; |
| 10474 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10475 | default: |
| 10476 | case eCSR_CFG_DOT11_MODE_11N: |
| 10477 | case eCSR_CFG_DOT11_MODE_TAURUS: |
| 10478 | //Because LIM only verifies it against 11a, 11b or 11g, set only 11g or 11a here |
| 10479 | if(eCSR_BAND_24 == eBand) |
| 10480 | { |
| 10481 | nwType = eSIR_11G_NW_TYPE; |
| 10482 | } |
| 10483 | else |
| 10484 | { |
| 10485 | nwType = eSIR_11A_NW_TYPE; |
| 10486 | } |
| 10487 | break; |
| 10488 | } |
| 10489 | |
| 10490 | pParam->extendedRateSet.numRates = 0; |
| 10491 | |
| 10492 | switch ( nwType ) |
| 10493 | { |
| 10494 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10495 | smsLog(pMac, LOGE, FL("sees an unknown pSirNwType (%d)"), nwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10496 | case eSIR_11A_NW_TYPE: |
| 10497 | |
| 10498 | pParam->operationalRateSet.numRates = 8; |
| 10499 | |
| 10500 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 10501 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10502 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 10503 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10504 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 10505 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10506 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10507 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10508 | |
| 10509 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10510 | { |
| 10511 | channel = csrRoamGetIbssStartChannelNumber50( pMac ); |
| 10512 | if( 0 == channel && |
| 10513 | CSR_IS_PHY_MODE_DUAL_BAND(pProfile->phyMode) && |
| 10514 | CSR_IS_PHY_MODE_DUAL_BAND(pMac->roam.configParam.phyMode) |
| 10515 | ) |
| 10516 | { |
| 10517 | //We could not find a 5G channel by auto pick, let's try 2.4G channels |
| 10518 | //We only do this here because csrRoamGetPhyModeBandForBss always picks 11a for AUTO |
| 10519 | nwType = eSIR_11B_NW_TYPE; |
| 10520 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10521 | pParam->operationalRateSet.numRates = 4; |
| 10522 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10523 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10524 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10525 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 10526 | } |
| 10527 | } |
| 10528 | else |
| 10529 | { |
| 10530 | channel = operationChannel; |
| 10531 | } |
| 10532 | break; |
| 10533 | |
| 10534 | case eSIR_11B_NW_TYPE: |
| 10535 | pParam->operationalRateSet.numRates = 4; |
| 10536 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10537 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10538 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10539 | 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] | 10540 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10541 | { |
| 10542 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10543 | } |
| 10544 | else |
| 10545 | { |
| 10546 | channel = operationChannel; |
| 10547 | } |
| 10548 | |
| 10549 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10550 | case eSIR_11G_NW_TYPE: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10551 | /* For P2P Client and P2P GO, disable 11b rates */ |
| 10552 | if( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 10553 | (pProfile->csrPersona == VOS_P2P_GO_MODE) |
| 10554 | ) |
| 10555 | { |
| 10556 | pParam->operationalRateSet.numRates = 8; |
| 10557 | |
| 10558 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 10559 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10560 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 10561 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10562 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 10563 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10564 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10565 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10566 | } |
| 10567 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10568 | { |
| 10569 | pParam->operationalRateSet.numRates = 4; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10570 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10571 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10572 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10573 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 10574 | |
| 10575 | pParam->extendedRateSet.numRates = 8; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10576 | pParam->extendedRateSet.rate[0] = SIR_MAC_RATE_6; |
| 10577 | pParam->extendedRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10578 | pParam->extendedRateSet.rate[2] = SIR_MAC_RATE_12; |
| 10579 | pParam->extendedRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10580 | pParam->extendedRateSet.rate[4] = SIR_MAC_RATE_24; |
| 10581 | pParam->extendedRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10582 | pParam->extendedRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10583 | pParam->extendedRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10584 | } |
| 10585 | |
| 10586 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10587 | { |
| 10588 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10589 | } |
| 10590 | else |
| 10591 | { |
| 10592 | channel = operationChannel; |
| 10593 | } |
| 10594 | |
| 10595 | break; |
| 10596 | } |
| 10597 | pParam->operationChn = channel; |
| 10598 | pParam->sirNwType = nwType; |
| 10599 | } |
| 10600 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10601 | static void csrRoamGetBssStartParmsFromBssDesc( tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, |
| 10602 | tDot11fBeaconIEs *pIes, tCsrRoamStartBssParams *pParam ) |
| 10603 | { |
| 10604 | |
| 10605 | if( pParam ) |
| 10606 | { |
| 10607 | pParam->sirNwType = pBssDesc->nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10608 | pParam->cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10609 | pParam->operationChn = pBssDesc->channelId; |
| 10610 | palCopyMemory( pMac->hHdd, &pParam->bssid, pBssDesc->bssId, sizeof(tCsrBssid) ); |
| 10611 | |
| 10612 | if( pIes ) |
| 10613 | { |
| 10614 | if(pIes->SuppRates.present) |
| 10615 | { |
| 10616 | pParam->operationalRateSet.numRates = pIes->SuppRates.num_rates; |
| 10617 | if(pIes->SuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) |
| 10618 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10619 | 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] | 10620 | pIes->SuppRates.num_rates); |
| 10621 | pIes->SuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
| 10622 | } |
| 10623 | palCopyMemory(pMac->hHdd, pParam->operationalRateSet.rate, pIes->SuppRates.rates, |
| 10624 | sizeof(*pIes->SuppRates.rates) * pIes->SuppRates.num_rates); |
| 10625 | } |
| 10626 | if( pIes->SSID.present ) |
| 10627 | { |
| 10628 | pParam->ssId.length = pIes->SSID.num_ssid; |
| 10629 | palCopyMemory(pMac->hHdd, pParam->ssId.ssId, pIes->SSID.ssid, pParam->ssId.length); |
| 10630 | } |
| 10631 | pParam->cbMode = csrGetCBModeFromIes(pMac, pParam->operationChn, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10632 | } |
| 10633 | else |
| 10634 | { |
| 10635 | pParam->ssId.length = 0; |
| 10636 | pParam->operationalRateSet.numRates = 0; |
| 10637 | } |
| 10638 | } |
| 10639 | } |
| 10640 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10641 | static void csrRoamDetermineMaxRateForAdHoc( tpAniSirGlobal pMac, tSirMacRateSet *pSirRateSet ) |
| 10642 | { |
| 10643 | tANI_U8 MaxRate = 0; |
| 10644 | tANI_U32 i; |
| 10645 | tANI_U8 *pRate; |
| 10646 | |
| 10647 | pRate = pSirRateSet->rate; |
| 10648 | for ( i = 0; i < pSirRateSet->numRates; i++ ) |
| 10649 | { |
| 10650 | MaxRate = CSR_MAX( MaxRate, ( pRate[ i ] & (~CSR_DOT11_BASIC_RATE_MASK) ) ); |
| 10651 | } |
| 10652 | |
| 10653 | // Save the max rate in the connected state information... |
| 10654 | |
| 10655 | // modify LastRates variable as well |
| 10656 | |
| 10657 | return; |
| 10658 | } |
| 10659 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10660 | //this function finds a valid secondary channel for channel bonding with "channel". |
| 10661 | //Param: channel -- primary channel, caller must validate it |
| 10662 | // cbChoice -- CB directory |
| 10663 | //Return: if 0, no secondary channel is found. Otherwise a valid secondary channel. |
| 10664 | static tANI_U8 csrRoamGetSecondaryChannel(tpAniSirGlobal pMac, tANI_U8 channel, eCsrCBChoice cbChoice) |
| 10665 | { |
| 10666 | tANI_U8 chnUp = 0, chnDown = 0, chnRet = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10667 | switch (cbChoice) |
| 10668 | { |
| 10669 | case eCSR_CB_OFF: |
| 10670 | chnUp = 0; |
| 10671 | chnDown = 0; |
| 10672 | break; |
| 10673 | case eCSR_CB_DOWN: |
| 10674 | chnUp = 0; |
| 10675 | chnDown = channel - CSR_CB_CHANNEL_GAP; |
| 10676 | break; |
| 10677 | case eCSR_CB_UP: |
| 10678 | chnUp = channel + CSR_CB_CHANNEL_GAP; |
| 10679 | chnDown = 0; |
| 10680 | break; |
| 10681 | case eCSR_CB_AUTO: |
| 10682 | //consider every other value means auto |
| 10683 | default: |
| 10684 | chnUp = channel + CSR_CB_CHANNEL_GAP; |
| 10685 | chnDown = channel - CSR_CB_CHANNEL_GAP; |
| 10686 | break; |
| 10687 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10688 | //if CB_UP or auto, try channel up first |
| 10689 | if(chnUp && CSR_IS_SAME_BAND_CHANNELS(chnUp, channel) && csrRoamIsChannelValid(pMac, chnUp)) |
| 10690 | { |
| 10691 | //found a valid up channel for channel bonding |
| 10692 | //check whether the center channel is valid |
| 10693 | if(csrRoamIsValid40MhzChannel(pMac, channel + CSR_CB_CENTER_CHANNEL_OFFSET)) |
| 10694 | { |
| 10695 | chnRet = chnUp; |
| 10696 | } |
| 10697 | } |
| 10698 | if(chnRet == 0 && chnDown && CSR_IS_SAME_BAND_CHANNELS(chnDown, channel) && csrRoamIsChannelValid(pMac, chnDown)) |
| 10699 | { |
| 10700 | //found a valid down channel for channel bonding |
| 10701 | if(csrRoamIsValid40MhzChannel(pMac, channel - CSR_CB_CENTER_CHANNEL_OFFSET)) |
| 10702 | { |
| 10703 | chnRet = chnDown; |
| 10704 | } |
| 10705 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10706 | return chnRet; |
| 10707 | } |
| 10708 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10709 | eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, |
| 10710 | tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId ) |
| 10711 | { |
| 10712 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10713 | eCsrBand eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10714 | // Set the roaming substate to 'Start BSS attempt'... |
| 10715 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10716 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10717 | //Need to figure out whether we need to log WDS??? |
| 10718 | if( CSR_IS_IBSS( pProfile ) ) |
| 10719 | { |
| 10720 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10721 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 10722 | if(pIbssLog) |
| 10723 | { |
| 10724 | if(pBssDesc) |
| 10725 | { |
| 10726 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_REQ; |
| 10727 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pBssDesc->bssId, 6); |
| 10728 | } |
| 10729 | else |
| 10730 | { |
| 10731 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_REQ; |
| 10732 | } |
| 10733 | palCopyMemory(pMac->hHdd, pIbssLog->ssid, pParam->ssId.ssId, |
| 10734 | pParam->ssId.length); |
| 10735 | if(pProfile->ChannelInfo.numOfChannels == 0) |
| 10736 | { |
| 10737 | pIbssLog->channelSetting = AUTO_PICK; |
| 10738 | } |
| 10739 | else |
| 10740 | { |
| 10741 | pIbssLog->channelSetting = SPECIFIED; |
| 10742 | } |
| 10743 | pIbssLog->operatingChannel = pParam->operationChn; |
| 10744 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 10745 | } |
| 10746 | } |
| 10747 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10748 | //Put RSN information in for Starting BSS |
| 10749 | pParam->nRSNIELength = (tANI_U16)pProfile->nRSNReqIELength; |
| 10750 | pParam->pRSNIE = pProfile->pRSNReqIE; |
| 10751 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10752 | pParam->privacy = pProfile->privacy; |
| 10753 | pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq; |
| 10754 | pParam->authType = pProfile->csr80211AuthType; |
| 10755 | pParam->beaconInterval = pProfile->beaconInterval; |
| 10756 | pParam->dtimPeriod = pProfile->dtimPeriod; |
| 10757 | pParam->ApUapsdEnable = pProfile->ApUapsdEnable; |
| 10758 | pParam->ssidHidden = pProfile->SSIDs.SSIDList[0].ssidHidden; |
| 10759 | if (CSR_IS_INFRA_AP(pProfile)&& (pParam->operationChn != 0)) |
| 10760 | { |
| 10761 | if (csrIsValidChannel(pMac, pParam->operationChn) != eHAL_STATUS_SUCCESS) |
| 10762 | { |
| 10763 | pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL; |
| 10764 | } |
| 10765 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10766 | pParam->protEnabled = pProfile->protEnabled; |
| 10767 | pParam->obssProtEnabled = pProfile->obssProtEnabled; |
| 10768 | pParam->ht_protection = pProfile->cfg_protection; |
| 10769 | pParam->wps_state = pProfile->wps_state; |
Jeff Johnson | 96fbeeb | 2013-02-26 21:23:00 -0800 | [diff] [blame] | 10770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10771 | pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, pParam->operationChn /* pProfile->operationChannel*/, |
| 10772 | &eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10773 | pParam->bssPersona = pProfile->csrPersona; |
| 10774 | // When starting an IBSS, start on the channel from the Profile. |
| 10775 | status = csrSendMBStartBssReqMsg( pMac, sessionId, pProfile->BSSType, pParam, pBssDesc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10776 | return (status); |
| 10777 | } |
| 10778 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10779 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10780 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10781 | { |
| 10782 | tANI_U8 Channel, SecondChn; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10783 | ePhyChanBondState cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10784 | eCsrCBChoice cbChoice; |
| 10785 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10786 | |
| 10787 | if(!pSession) |
| 10788 | { |
| 10789 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10790 | return; |
| 10791 | } |
| 10792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10793 | if( pBssDesc ) |
| 10794 | { |
| 10795 | csrRoamGetBssStartParmsFromBssDesc( pMac, pBssDesc, pIes, &pSession->bssParams ); |
| 10796 | //Since csrRoamGetBssStartParmsFromBssDesc fills in the bssid for pSession->bssParams |
| 10797 | //The following code has to be do after that. |
| 10798 | //For WDS station, use selfMac as the self BSSID |
| 10799 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 10800 | { |
| 10801 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid)); |
| 10802 | } |
| 10803 | } |
| 10804 | else |
| 10805 | { |
| 10806 | csrRoamGetBssStartParms(pMac, pProfile, &pSession->bssParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10807 | //Use the first SSID |
| 10808 | if(pProfile->SSIDs.numOfSSIDs) |
| 10809 | { |
| 10810 | palCopyMemory(pMac->hHdd, &pSession->bssParams.ssId, pProfile->SSIDs.SSIDList, sizeof(tSirMacSSid)); |
| 10811 | } |
| 10812 | //For WDS station, use selfMac as the self BSSID |
| 10813 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 10814 | { |
| 10815 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid)); |
| 10816 | } |
| 10817 | //Use the first BSSID |
| 10818 | else if( pProfile->BSSIDs.numOfBSSIDs ) |
| 10819 | { |
| 10820 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 10821 | } |
| 10822 | else |
| 10823 | { |
| 10824 | palZeroMemory( pMac->hHdd, &pSession->bssParams.bssid, sizeof(tCsrBssid) ); |
| 10825 | } |
| 10826 | } |
| 10827 | Channel = pSession->bssParams.operationChn; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10828 | //Set operating channel in pProfile which will be used |
| 10829 | //in csrRoamSetBssConfigCfg() to determine channel bonding |
| 10830 | //mode and will be configured in CFG later |
| 10831 | pProfile->operationChannel = Channel; |
| 10832 | |
| 10833 | if(Channel == 0) |
| 10834 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10835 | smsLog(pMac, LOGW, " CSR cannot find a channel to start IBSS"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10836 | } |
| 10837 | else |
| 10838 | { |
| 10839 | |
| 10840 | csrRoamDetermineMaxRateForAdHoc( pMac, &pSession->bssParams.operationalRateSet ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10841 | if (CSR_IS_INFRA_AP(pProfile)) |
| 10842 | { |
| 10843 | if(CSR_IS_CHANNEL_24GHZ(Channel)) |
| 10844 | { |
| 10845 | cbMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 10846 | } |
| 10847 | else |
| 10848 | { |
| 10849 | cbMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 10850 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10851 | smsLog(pMac, LOG1, "##softap cbMode %d", cbMode); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10852 | pBssConfig->cbMode = cbMode; |
| 10853 | pSession->bssParams.cbMode = cbMode; |
| 10854 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10855 | |
| 10856 | if( CSR_IS_START_IBSS( pProfile ) ) |
| 10857 | { |
| 10858 | //TBH: channel bonding is not supported for Libra |
| 10859 | if( pProfile->ChannelInfo.ChannelList && eCSR_OPERATING_CHANNEL_AUTO != pProfile->ChannelInfo.ChannelList[0] ) |
| 10860 | { |
| 10861 | Channel = pProfile->ChannelInfo.ChannelList[0]; |
| 10862 | cbChoice = pProfile->CBMode; |
| 10863 | } |
| 10864 | else { |
| 10865 | cbChoice = pMac->roam.configParam.cbChoice; |
| 10866 | } |
| 10867 | pSession->bssParams.operationChn = Channel; |
| 10868 | //make sure channel is valid |
| 10869 | if(!csrRoamIsChannelValid(pMac, Channel)) |
| 10870 | { |
| 10871 | //set Channel to 0 to let lim know this is invalid |
| 10872 | //We still send this request down to lim even though we know the channel is wrong because |
| 10873 | //lim will response with error and hdd's eWNI_SME_START_BSS_RSP handler will roam other profile (if any) |
| 10874 | Channel = 0; |
| 10875 | pSession->bssParams.operationChn = 0; |
| 10876 | } |
| 10877 | else { |
| 10878 | tANI_U32 ChannelBondingMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10879 | if(CSR_IS_CHANNEL_24GHZ(Channel)) |
| 10880 | { |
| 10881 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 10882 | } |
| 10883 | else |
| 10884 | { |
| 10885 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 10886 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10887 | //now we have a valid channel |
| 10888 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 10889 | { |
| 10890 | //let's pick a secondard channel |
| 10891 | SecondChn = csrRoamGetSecondaryChannel(pMac, Channel, cbChoice); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10892 | if(SecondChn > Channel) |
| 10893 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10894 | cbMode = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10895 | } |
| 10896 | else if(SecondChn && SecondChn < Channel) |
| 10897 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10898 | cbMode = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10899 | } |
| 10900 | else |
| 10901 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10902 | cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10903 | } |
| 10904 | pSession->bssParams.cbMode = cbMode; |
| 10905 | } |
| 10906 | else |
| 10907 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10908 | pSession->bssParams.cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10909 | } |
| 10910 | } |
| 10911 | } |
| 10912 | } |
| 10913 | } |
| 10914 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10915 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 10916 | tANI_BOOLEAN *pfSameIbss ) |
| 10917 | { |
| 10918 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10919 | tANI_BOOLEAN fSameIbss = FALSE; |
| 10920 | |
| 10921 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 10922 | { |
| 10923 | // Check if any profile parameter has changed ? If any profile parameter |
| 10924 | // has changed then stop old BSS and start a new one with new parameters |
| 10925 | if ( csrIsSameProfile( pMac, &pMac->roam.roamSession[sessionId].connectedProfile, pProfile ) ) |
| 10926 | { |
| 10927 | fSameIbss = TRUE; |
| 10928 | } |
| 10929 | else |
| 10930 | { |
| 10931 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 10932 | } |
| 10933 | } |
| 10934 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 10935 | { |
| 10936 | // Disassociate from the connected Infrastructure network... |
| 10937 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 10938 | } |
| 10939 | else |
| 10940 | { |
| 10941 | tBssConfigParam *pBssConfig; |
| 10942 | |
| 10943 | status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); |
| 10944 | if(HAL_STATUS_SUCCESS(status)) |
| 10945 | { |
| 10946 | palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam)); |
| 10947 | // there is no Bss description before we start an IBSS so we need to adopt |
| 10948 | // all Bss configuration parameters from the Profile. |
| 10949 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, pBssConfig, NULL); |
| 10950 | if(HAL_STATUS_SUCCESS(status)) |
| 10951 | { |
| 10952 | //save dotMode |
| 10953 | pMac->roam.roamSession[sessionId].bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
| 10954 | //Prepare some more parameters for this IBSS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10955 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10956 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
| 10957 | } |
| 10958 | |
| 10959 | palFreeMemory(pMac->hHdd, pBssConfig); |
| 10960 | }//Allocate memory |
| 10961 | } |
| 10962 | |
| 10963 | if(pfSameIbss) |
| 10964 | { |
| 10965 | *pfSameIbss = fSameIbss; |
| 10966 | } |
| 10967 | return( status ); |
| 10968 | } |
| 10969 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10970 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 10971 | tSirSmeNewBssInfo *pNewBss ) |
| 10972 | { |
| 10973 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10974 | |
| 10975 | if(!pSession) |
| 10976 | { |
| 10977 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10978 | return; |
| 10979 | } |
| 10980 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10981 | if( pNewBss ) |
| 10982 | { |
| 10983 | // Set the operating channel. |
| 10984 | pSession->connectedProfile.operationChannel = pNewBss->channelNumber; |
| 10985 | // move the BSSId from the BSS description into the connected state information. |
| 10986 | palCopyMemory( pMac->hHdd, &pSession->connectedProfile.bssid, |
| 10987 | &(pNewBss->bssId), sizeof( tCsrBssid ) ); |
| 10988 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10989 | return; |
| 10990 | } |
| 10991 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10992 | #ifdef FEATURE_WLAN_WAPI |
| 10993 | eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, |
| 10994 | tANI_U32 numItems ) |
| 10995 | { |
| 10996 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10997 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10998 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 10999 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11000 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11001 | return status; |
| 11002 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11003 | smsLog(pMac, LOGW, "csrRoamSetBKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11004 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11005 | if(numItems <= CSR_MAX_BKID_ALLOWED) |
| 11006 | { |
| 11007 | status = eHAL_STATUS_SUCCESS; |
| 11008 | //numItems may be 0 to clear the cache |
| 11009 | pSession->NumBkidCache = (tANI_U16)numItems; |
| 11010 | if(numItems && pBKIDCache) |
| 11011 | { |
| 11012 | status = palCopyMemory( pMac->hHdd, pSession->BkidCacheInfo, pBKIDCache, |
| 11013 | sizeof(tBkidCacheInfo) * numItems ); |
| 11014 | } |
| 11015 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11016 | return (status); |
| 11017 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11018 | eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, |
| 11019 | tBkidCacheInfo *pBkidCache) |
| 11020 | { |
| 11021 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11022 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11023 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11024 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11025 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11026 | return status; |
| 11027 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11028 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11029 | if(pNum && pBkidCache) |
| 11030 | { |
| 11031 | if(pSession->NumBkidCache == 0) |
| 11032 | { |
| 11033 | *pNum = 0; |
| 11034 | status = eHAL_STATUS_SUCCESS; |
| 11035 | } |
| 11036 | else if(*pNum >= pSession->NumBkidCache) |
| 11037 | { |
| 11038 | if(pSession->NumBkidCache > CSR_MAX_PMKID_ALLOWED) |
| 11039 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11040 | 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] | 11041 | pSession->NumBkidCache); |
| 11042 | pSession->NumBkidCache = CSR_MAX_PMKID_ALLOWED; |
| 11043 | } |
| 11044 | palCopyMemory( pMac->hHdd, pBkidCache, pSession->BkidCacheInfo, |
| 11045 | sizeof(tBkidCacheInfo) * pSession->NumBkidCache ); |
| 11046 | *pNum = pSession->NumBkidCache; |
| 11047 | status = eHAL_STATUS_SUCCESS; |
| 11048 | } |
| 11049 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11050 | return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11051 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11052 | tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11053 | { |
| 11054 | return (pMac->roam.roamSession[sessionId].NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11055 | } |
| 11056 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11057 | eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11058 | tPmkidCacheInfo *pPMKIDCache, tANI_U32 numItems ) |
| 11059 | { |
| 11060 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11061 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11062 | |
| 11063 | if(!pSession) |
| 11064 | { |
| 11065 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11066 | return eHAL_STATUS_FAILURE; |
| 11067 | } |
| 11068 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11069 | smsLog(pMac, LOGW, "csrRoamSetPMKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11070 | if(numItems <= CSR_MAX_PMKID_ALLOWED) |
| 11071 | { |
| 11072 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11073 | { |
| 11074 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
| 11075 | palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 11076 | secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_UPDATE; |
| 11077 | secEvent.encryptionModeMulticast = |
| 11078 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 11079 | secEvent.encryptionModeUnicast = |
| 11080 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 11081 | palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 11082 | secEvent.authMode = |
| 11083 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 11084 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 11085 | } |
| 11086 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11087 | status = eHAL_STATUS_SUCCESS; |
| 11088 | //numItems may be 0 to clear the cache |
| 11089 | pSession->NumPmkidCache = (tANI_U16)numItems; |
| 11090 | if(numItems && pPMKIDCache) |
| 11091 | { |
| 11092 | status = palCopyMemory( pMac->hHdd, pSession->PmkidCacheInfo, pPMKIDCache, |
| 11093 | sizeof(tPmkidCacheInfo) * numItems ); |
| 11094 | } |
| 11095 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11096 | return (status); |
| 11097 | } |
| 11098 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11099 | tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11100 | { |
| 11101 | return (pMac->roam.roamSession[sessionId].NumPmkidCache); |
| 11102 | } |
| 11103 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11104 | eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache) |
| 11105 | { |
| 11106 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11107 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11108 | |
| 11109 | if(!pSession) |
| 11110 | { |
| 11111 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11112 | return eHAL_STATUS_FAILURE; |
| 11113 | } |
| 11114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11115 | if(pNum && pPmkidCache) |
| 11116 | { |
| 11117 | if(pSession->NumPmkidCache == 0) |
| 11118 | { |
| 11119 | *pNum = 0; |
| 11120 | status = eHAL_STATUS_SUCCESS; |
| 11121 | } |
| 11122 | else if(*pNum >= pSession->NumPmkidCache) |
| 11123 | { |
| 11124 | if(pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED) |
| 11125 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11126 | 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] | 11127 | pSession->NumPmkidCache); |
| 11128 | pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED; |
| 11129 | } |
| 11130 | palCopyMemory( pMac->hHdd, pPmkidCache, pSession->PmkidCacheInfo, |
| 11131 | sizeof(tPmkidCacheInfo) * pSession->NumPmkidCache ); |
| 11132 | *pNum = pSession->NumPmkidCache; |
| 11133 | status = eHAL_STATUS_SUCCESS; |
| 11134 | } |
| 11135 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11136 | return (status); |
| 11137 | } |
| 11138 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11139 | eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11140 | { |
| 11141 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11142 | tANI_U32 len; |
| 11143 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11144 | |
| 11145 | if(!pSession) |
| 11146 | { |
| 11147 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11148 | return eHAL_STATUS_FAILURE; |
| 11149 | } |
| 11150 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11151 | if(pLen) |
| 11152 | { |
| 11153 | len = *pLen; |
| 11154 | *pLen = pSession->nWpaRsnReqIeLength; |
| 11155 | if(pBuf) |
| 11156 | { |
| 11157 | if(len >= pSession->nWpaRsnReqIeLength) |
| 11158 | { |
| 11159 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnReqIE, pSession->nWpaRsnReqIeLength); |
| 11160 | } |
| 11161 | } |
| 11162 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11163 | return (status); |
| 11164 | } |
| 11165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11166 | eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11167 | { |
| 11168 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11169 | tANI_U32 len; |
| 11170 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11171 | |
| 11172 | if(!pSession) |
| 11173 | { |
| 11174 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11175 | return eHAL_STATUS_FAILURE; |
| 11176 | } |
| 11177 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11178 | if(pLen) |
| 11179 | { |
| 11180 | len = *pLen; |
| 11181 | *pLen = pSession->nWpaRsnRspIeLength; |
| 11182 | if(pBuf) |
| 11183 | { |
| 11184 | if(len >= pSession->nWpaRsnRspIeLength) |
| 11185 | { |
| 11186 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnRspIE, pSession->nWpaRsnRspIeLength); |
| 11187 | } |
| 11188 | } |
| 11189 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11190 | return (status); |
| 11191 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11192 | #ifdef FEATURE_WLAN_WAPI |
| 11193 | eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11194 | { |
| 11195 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11196 | tANI_U32 len; |
| 11197 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11198 | |
| 11199 | if(!pSession) |
| 11200 | { |
| 11201 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11202 | return eHAL_STATUS_FAILURE; |
| 11203 | } |
| 11204 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11205 | if(pLen) |
| 11206 | { |
| 11207 | len = *pLen; |
| 11208 | *pLen = pSession->nWapiReqIeLength; |
| 11209 | if(pBuf) |
| 11210 | { |
| 11211 | if(len >= pSession->nWapiReqIeLength) |
| 11212 | { |
| 11213 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiReqIE, pSession->nWapiReqIeLength); |
| 11214 | } |
| 11215 | } |
| 11216 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11217 | return (status); |
| 11218 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11219 | eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11220 | { |
| 11221 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11222 | tANI_U32 len; |
| 11223 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11224 | |
| 11225 | if(!pSession) |
| 11226 | { |
| 11227 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11228 | return eHAL_STATUS_FAILURE; |
| 11229 | } |
| 11230 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11231 | if(pLen) |
| 11232 | { |
| 11233 | len = *pLen; |
| 11234 | *pLen = pSession->nWapiRspIeLength; |
| 11235 | if(pBuf) |
| 11236 | { |
| 11237 | if(len >= pSession->nWapiRspIeLength) |
| 11238 | { |
| 11239 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiRspIE, pSession->nWapiRspIeLength); |
| 11240 | } |
| 11241 | } |
| 11242 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11243 | return (status); |
| 11244 | } |
| 11245 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11246 | eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11247 | { |
| 11248 | eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION; |
| 11249 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11250 | |
| 11251 | if(!pSession) |
| 11252 | { |
| 11253 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11254 | return (retStatus); |
| 11255 | } |
| 11256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11257 | if(CSR_IS_ROAMING(pSession)) |
| 11258 | { |
| 11259 | retStatus = eCSR_ROAM_ROAMING_COMPLETION; |
| 11260 | pSession->fRoaming = eANI_BOOLEAN_FALSE; |
| 11261 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11262 | return (retStatus); |
| 11263 | } |
| 11264 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11265 | //This function remove the connected BSS from te cached scan result |
| 11266 | eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac, |
| 11267 | tCsrRoamConnectedProfile *pConnProfile) |
| 11268 | { |
| 11269 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 11270 | tCsrScanResultFilter *pScanFilter = NULL; |
| 11271 | tListElem *pEntry; |
| 11272 | tCsrScanResult *pResult; |
| 11273 | tDot11fBeaconIEs *pIes; |
| 11274 | tANI_BOOLEAN fMatch; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11275 | if(!(csrIsMacAddressZero(pMac, &pConnProfile->bssid) || |
| 11276 | csrIsMacAddressBroadcast(pMac, &pConnProfile->bssid))) |
| 11277 | { |
| 11278 | do |
| 11279 | { |
| 11280 | //Prepare the filter. Only fill in the necessary fields. Not all fields are needed |
| 11281 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 11282 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11283 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 11284 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 11285 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11286 | palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, &pConnProfile->bssid, sizeof(tCsrBssid)); |
| 11287 | pScanFilter->BSSIDs.numOfBSSIDs = 1; |
| 11288 | if(!csrIsNULLSSID(pConnProfile->SSID.ssId, pConnProfile->SSID.length)) |
| 11289 | { |
| 11290 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, sizeof(tCsrSSIDInfo)); |
| 11291 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11292 | palCopyMemory(pMac->hHdd, &pScanFilter->SSIDs.SSIDList[0].SSID, &pConnProfile->SSID, sizeof(tSirMacSSid)); |
| 11293 | } |
| 11294 | pScanFilter->authType.numEntries = 1; |
| 11295 | pScanFilter->authType.authType[0] = pConnProfile->AuthType; |
| 11296 | pScanFilter->BSSType = pConnProfile->BSSType; |
| 11297 | pScanFilter->EncryptionType.numEntries = 1; |
| 11298 | pScanFilter->EncryptionType.encryptionType[0] = pConnProfile->EncryptionType; |
| 11299 | pScanFilter->mcEncryptionType.numEntries = 1; |
| 11300 | pScanFilter->mcEncryptionType.encryptionType[0] = pConnProfile->mcEncryptionType; |
| 11301 | //We ignore the channel for now, BSSID should be enough |
| 11302 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 11303 | //Also ignore the following fields |
| 11304 | pScanFilter->uapsd_mask = 0; |
| 11305 | pScanFilter->bWPSAssociation = eANI_BOOLEAN_FALSE; |
| 11306 | pScanFilter->countryCode[0] = 0; |
| 11307 | pScanFilter->phyMode = eCSR_DOT11_MODE_TAURUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11308 | csrLLLock(&pMac->scan.scanResultList); |
| 11309 | pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK ); |
| 11310 | while( pEntry ) |
| 11311 | { |
| 11312 | pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link ); |
| 11313 | pIes = (tDot11fBeaconIEs *)( pResult->Result.pvIes ); |
| 11314 | fMatch = csrMatchBSS(pMac, &pResult->Result.BssDescriptor, |
| 11315 | pScanFilter, NULL, NULL, NULL, &pIes); |
| 11316 | //Release the IEs allocated by csrMatchBSS is needed |
| 11317 | if( !pResult->Result.pvIes ) |
| 11318 | { |
| 11319 | //need to free the IEs since it is allocated by csrMatchBSS |
| 11320 | palFreeMemory(pMac->hHdd, pIes); |
| 11321 | } |
| 11322 | if(fMatch) |
| 11323 | { |
| 11324 | //We found the one |
| 11325 | if( csrLLRemoveEntry(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK) ) |
| 11326 | { |
| 11327 | //Free the memory |
| 11328 | csrFreeScanResultEntry( pMac, pResult ); |
| 11329 | } |
| 11330 | break; |
| 11331 | } |
| 11332 | pEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK); |
| 11333 | }//while |
| 11334 | csrLLUnlock(&pMac->scan.scanResultList); |
| 11335 | }while(0); |
| 11336 | if(pScanFilter) |
| 11337 | { |
| 11338 | csrFreeScanFilter(pMac, pScanFilter); |
| 11339 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 11340 | } |
| 11341 | } |
| 11342 | return (status); |
| 11343 | } |
| 11344 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11345 | //BT-AMP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11346 | eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId ) |
| 11347 | { |
| 11348 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11349 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11350 | for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 11351 | { |
| 11352 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 11353 | { |
| 11354 | if( csrIsConnStateIbss( pMac, sessionId ) || csrIsBTAMP( pMac, sessionId ) ) |
| 11355 | { |
| 11356 | //co-exist with IBSS or BT-AMP is not supported |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11357 | 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] | 11358 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 11359 | break; |
| 11360 | } |
| 11361 | if( csrIsConnStateInfra( pMac, sessionId ) ) |
| 11362 | { |
| 11363 | if( chnId && |
| 11364 | ( (tANI_U8)chnId != pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ) ) |
| 11365 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11366 | 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] | 11367 | chnId, pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ); |
| 11368 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 11369 | break; |
| 11370 | } |
| 11371 | } |
| 11372 | } |
| 11373 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11374 | return ( status ); |
| 11375 | } |
| 11376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11377 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ) |
| 11378 | { |
| 11379 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11380 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11381 | tBssConfigParam bssConfig; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11382 | |
| 11383 | if(!pSession) |
| 11384 | { |
| 11385 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11386 | return eHAL_STATUS_FAILURE; |
| 11387 | } |
| 11388 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11389 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 11390 | { |
| 11391 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 11392 | } |
| 11393 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 11394 | { |
| 11395 | // Disassociate from the connected Infrastructure network... |
| 11396 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 11397 | } |
| 11398 | else |
| 11399 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11400 | //We don't expect Bt-AMP HDD not to disconnect the last connection first at this time. |
| 11401 | //Otherwise we need to add code to handle the |
| 11402 | //situation just like IBSS. Though for WDS station, we need to send disassoc to PE first then |
| 11403 | //send stop_bss to PE, before we can continue. |
| 11404 | VOS_ASSERT( !csrIsConnStateWds( pMac, sessionId ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11405 | palZeroMemory(pMac->hHdd, &bssConfig, sizeof(tBssConfigParam)); |
| 11406 | /* Assume HDD provide bssid in profile */ |
| 11407 | palCopyMemory( pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid[0], sizeof(tCsrBssid) ); |
| 11408 | // there is no Bss description before we start an WDS so we need |
| 11409 | // to adopt all Bss configuration parameters from the Profile. |
| 11410 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, &bssConfig, pBssDesc); |
| 11411 | if(HAL_STATUS_SUCCESS(status)) |
| 11412 | { |
| 11413 | //Save profile for late use |
| 11414 | csrFreeRoamProfile( pMac, sessionId ); |
| 11415 | if (HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 11416 | (void **)&pSession->pCurRoamProfile, |
| 11417 | sizeof(tCsrRoamProfile)))) |
| 11418 | { |
| 11419 | palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 11420 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile); |
| 11421 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11422 | //Prepare some more parameters for this WDS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11423 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11424 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
| 11425 | } |
| 11426 | } |
| 11427 | |
| 11428 | return( status ); |
| 11429 | } |
| 11430 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11431 | ////////////////////Mail box |
| 11432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11433 | //pBuf is caller allocated memory point to &(tSirSmeJoinReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 11434 | //or &(tSirSmeReassocReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 11435 | static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, |
| 11436 | tSirBssDescription *pBssDescription, |
| 11437 | tANI_U8 *pBuf, tANI_U8 uapsdMask) |
| 11438 | { |
| 11439 | tCsrChannelSet channelGroup; |
| 11440 | tSirMacCapabilityInfo *pAP_capabilityInfo; |
| 11441 | tAniBool fTmp; |
| 11442 | tANI_BOOLEAN found = FALSE; |
| 11443 | tANI_U32 size = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11444 | tANI_S8 pwrLimit = 0; |
| 11445 | tANI_U16 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11446 | // plug in neighborhood occupancy info (i.e. BSSes on primary or secondary channels) |
| 11447 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundPri |
| 11448 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecDown |
| 11449 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecUp |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11450 | // 802.11h |
| 11451 | //We can do this because it is in HOST CPU order for now. |
| 11452 | pAP_capabilityInfo = (tSirMacCapabilityInfo *)&pBssDescription->capabilityInfo; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11453 | //tell the target AP my 11H capability only if both AP and STA support 11H and the channel being used is 11a |
| 11454 | if ( csrIs11hSupported( pMac ) && pAP_capabilityInfo->spectrumMgt && eSIR_11A_NW_TYPE == pBssDescription->nwType ) |
| 11455 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11456 | fTmp = (tAniBool)pal_cpu_to_be32(1); |
| 11457 | } |
| 11458 | else |
| 11459 | fTmp = (tAniBool)0; |
| 11460 | |
| 11461 | // corresponds to --- pMsg->spectrumMgtIndicator = ON; |
| 11462 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&fTmp, sizeof(tAniBool) ); |
| 11463 | pBuf += sizeof(tAniBool); |
| 11464 | *pBuf++ = MIN_STA_PWR_CAP_DBM; // it is for pMsg->powerCap.minTxPower = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11465 | found = csrSearchChannelListForTxPower(pMac, pBssDescription, &channelGroup); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11466 | // This is required for 11k test VoWiFi Ent: Test 2. |
| 11467 | // We need the power capabilities for Assoc Req. |
| 11468 | // This macro is provided by the halPhyCfg.h. We pick our |
| 11469 | // max and min capability by the halPhy provided macros |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11470 | pwrLimit = csrGetCfgMaxTxPower (pMac, pBssDescription->channelId); |
| 11471 | if (0 != pwrLimit) |
| 11472 | { |
| 11473 | *pBuf++ = pwrLimit; |
| 11474 | } |
| 11475 | else |
| 11476 | { |
| 11477 | *pBuf++ = MAX_STA_PWR_CAP_DBM; |
| 11478 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11479 | size = sizeof(pMac->roam.validChannelList); |
| 11480 | if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size))) |
| 11481 | { |
| 11482 | *pBuf++ = (tANI_U8)size; //tSirSupChnl->numChnl |
| 11483 | for ( i = 0; i < size; i++) |
| 11484 | { |
| 11485 | *pBuf++ = pMac->roam.validChannelList[ i ]; //tSirSupChnl->channelList[ i ] |
| 11486 | |
| 11487 | } |
| 11488 | } |
| 11489 | else |
| 11490 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11491 | smsLog(pMac, LOGE, FL("can not find any valid channel")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11492 | *pBuf++ = 0; //tSirSupChnl->numChnl |
| 11493 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11494 | //Check whether it is ok to enter UAPSD |
| 11495 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 11496 | if( btcIsReadyForUapsd(pMac) ) |
| 11497 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 11498 | { |
| 11499 | *pBuf++ = uapsdMask; |
| 11500 | } |
| 11501 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 11502 | else |
| 11503 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11504 | 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] | 11505 | *pBuf++ = 0; |
| 11506 | } |
| 11507 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 11508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11509 | // move the entire BssDescription into the join request. |
| 11510 | palCopyMemory( pMac->hHdd, pBuf, pBssDescription, |
| 11511 | pBssDescription->length + sizeof( pBssDescription->length ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11512 | pBuf += pBssDescription->length + sizeof( pBssDescription->length ); // update to new location |
| 11513 | } |
| 11514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11515 | /* |
| 11516 | * The communication between HDD and LIM is thru mailbox (MB). |
| 11517 | * Both sides will access the data structure "tSirSmeJoinReq". |
| 11518 | * The rule is, while the components of "tSirSmeJoinReq" can be accessed in the regular way like tSirSmeJoinReq.assocType, this guideline |
| 11519 | * stops at component tSirRSNie; any acces to the components after tSirRSNie is forbidden because the space from tSirRSNie is quueezed |
| 11520 | * with the component "tSirBssDescription". And since the size of actual 'tSirBssDescription' varies, the receiving side (which is the routine |
| 11521 | * limJoinReqSerDes() of limSerDesUtils.cc) should keep in mind not to access the components DIRECTLY after tSirRSNie. |
| 11522 | */ |
| 11523 | eHalStatus csrSendJoinReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11524 | tCsrRoamProfile *pProfile, tDot11fBeaconIEs *pIes, tANI_U16 messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11525 | { |
| 11526 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11527 | tSirSmeJoinReq *pMsg; |
| 11528 | tANI_U8 *pBuf; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11529 | v_U8_t acm_mask = 0, uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11530 | tANI_U16 msgLen, wTmp, ieLen; |
| 11531 | tSirMacRateSet OpRateSet; |
| 11532 | tSirMacRateSet ExRateSet; |
| 11533 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11534 | tANI_U32 dwTmp; |
| 11535 | tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN]; //RSN MAX is bigger than WPA MAX |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11536 | |
| 11537 | if(!pSession) |
| 11538 | { |
| 11539 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11540 | return eHAL_STATUS_FAILURE; |
| 11541 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11542 | /* To satisfy klockworks */ |
| 11543 | if (NULL == pBssDescription) |
| 11544 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11545 | smsLog(pMac, LOGE, FL(" pBssDescription is NULL")); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11546 | return eHAL_STATUS_FAILURE; |
| 11547 | } |
| 11548 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11549 | do { |
| 11550 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 11551 | pSession->joinFailStatusCode.reasonCode = 0; |
| 11552 | // There are a number of variable length fields to consider. First, the tSirSmeJoinReq |
| 11553 | // includes a single bssDescription. bssDescription includes a single tANI_U32 for the |
| 11554 | // IE fields, but the length field in the bssDescription needs to be interpreted to |
| 11555 | // determine length of the IE fields. |
| 11556 | // |
| 11557 | // So, take the size of the JoinReq, subtract the size of the bssDescription and |
| 11558 | // add in the length from the bssDescription (then add the size of the 'length' field |
| 11559 | // itself because that is NOT included in the length field). |
| 11560 | msgLen = sizeof( tSirSmeJoinReq ) - sizeof( *pBssDescription ) + |
| 11561 | pBssDescription->length + sizeof( pBssDescription->length ) + |
| 11562 | 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] | 11563 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 11564 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11565 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11566 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)messageType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11567 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 11568 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11569 | // sessionId |
| 11570 | *pBuf = (tANI_U8)sessionId; |
| 11571 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11572 | // transactionId |
| 11573 | *pBuf = 0; |
| 11574 | *( pBuf + 1 ) = 0; |
| 11575 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11576 | // ssId |
| 11577 | if( pIes->SSID.present && pIes->SSID.num_ssid ) |
| 11578 | { |
| 11579 | // ssId len |
| 11580 | *pBuf = pIes->SSID.num_ssid; |
| 11581 | pBuf++; |
| 11582 | palCopyMemory( pMac->hHdd, pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid ); |
| 11583 | pBuf += pIes->SSID.num_ssid; |
| 11584 | } |
| 11585 | else |
| 11586 | { |
| 11587 | *pBuf = 0; |
| 11588 | pBuf++; |
| 11589 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11590 | // selfMacAddr |
| 11591 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 11592 | pBuf += sizeof(tSirMacAddr); |
| 11593 | // bsstype |
| 11594 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) ); |
| 11595 | if (dwTmp == eSIR_BTAMP_STA_MODE) dwTmp = eSIR_BTAMP_AP_MODE; // Override BssType for BTAMP |
| 11596 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 11597 | pBuf += sizeof(tSirBssType); |
| 11598 | // dot11mode |
| 11599 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode ); |
| 11600 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11601 | //Persona |
| 11602 | *pBuf = (tANI_U8)pProfile->csrPersona; |
| 11603 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11604 | //CBMode |
| 11605 | *pBuf = (tANI_U8)pSession->bssParams.cbMode; |
| 11606 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11607 | |
| 11608 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11609 | FL("CSR PERSONA=%d CSR CbMode %d"), pProfile->csrPersona, pSession->bssParams.cbMode); |
| 11610 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11611 | // uapsdPerAcBitmask |
| 11612 | *pBuf = pProfile->uapsd_mask; |
| 11613 | pBuf++; |
| 11614 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11615 | |
| 11616 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11617 | status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11618 | if (HAL_STATUS_SUCCESS(status) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11619 | { |
| 11620 | // OperationalRateSet |
| 11621 | if (OpRateSet.numRates) { |
| 11622 | *pBuf++ = OpRateSet.numRates; |
| 11623 | palCopyMemory(pMac->hHdd, pBuf, OpRateSet.rate, OpRateSet.numRates); |
| 11624 | pBuf += OpRateSet.numRates; |
| 11625 | } else *pBuf++ = 0; |
| 11626 | // ExtendedRateSet |
| 11627 | if (ExRateSet.numRates) { |
| 11628 | *pBuf++ = ExRateSet.numRates; |
| 11629 | palCopyMemory(pMac->hHdd, pBuf, ExRateSet.rate, ExRateSet.numRates); |
| 11630 | pBuf += ExRateSet.numRates; |
| 11631 | } else *pBuf++ = 0; |
| 11632 | } |
| 11633 | else |
| 11634 | { |
| 11635 | *pBuf++ = 0; |
| 11636 | *pBuf++ = 0; |
| 11637 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11638 | // rsnIE |
| 11639 | if ( csrIsProfileWpa( pProfile ) ) |
| 11640 | { |
| 11641 | // Insert the Wpa IE into the join request |
| 11642 | ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes, |
| 11643 | (tCsrWpaIe *)( wpaRsnIE ) ); |
| 11644 | } |
| 11645 | else if( csrIsProfileRSN( pProfile ) ) |
| 11646 | { |
| 11647 | // Insert the RSN IE into the join request |
| 11648 | ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 11649 | (tCsrRSNIe *)( wpaRsnIE ) ); |
| 11650 | } |
| 11651 | #ifdef FEATURE_WLAN_WAPI |
| 11652 | else if( csrIsProfileWapi( pProfile ) ) |
| 11653 | { |
| 11654 | // Insert the WAPI IE into the join request |
| 11655 | ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 11656 | (tCsrWapiIe *)( wpaRsnIE ) ); |
| 11657 | } |
| 11658 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11659 | else |
| 11660 | { |
| 11661 | ieLen = 0; |
| 11662 | } |
| 11663 | //remember the IE for future use |
| 11664 | if( ieLen ) |
| 11665 | { |
| 11666 | if(ieLen > DOT11F_IE_RSN_MAX_LEN) |
| 11667 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11668 | 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] | 11669 | ieLen = DOT11F_IE_RSN_MAX_LEN; |
| 11670 | } |
| 11671 | #ifdef FEATURE_WLAN_WAPI |
| 11672 | if( csrIsProfileWapi( pProfile ) ) |
| 11673 | { |
| 11674 | //Check whether we need to allocate more memory |
| 11675 | if(ieLen > pSession->nWapiReqIeLength) |
| 11676 | { |
| 11677 | if(pSession->pWapiReqIE && pSession->nWapiReqIeLength) |
| 11678 | { |
| 11679 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 11680 | } |
| 11681 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiReqIE, ieLen); |
| 11682 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11683 | } |
| 11684 | pSession->nWapiReqIeLength = ieLen; |
| 11685 | palCopyMemory(pMac->hHdd, pSession->pWapiReqIE, wpaRsnIE, ieLen); |
| 11686 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11687 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11688 | pBuf += sizeof(tANI_U16); |
| 11689 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11690 | pBuf += ieLen; |
| 11691 | } |
| 11692 | else//should be WPA/WPA2 otherwise |
| 11693 | #endif /* FEATURE_WLAN_WAPI */ |
| 11694 | { |
| 11695 | //Check whether we need to allocate more memory |
| 11696 | if(ieLen > pSession->nWpaRsnReqIeLength) |
| 11697 | { |
| 11698 | if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength) |
| 11699 | { |
| 11700 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 11701 | } |
| 11702 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnReqIE, ieLen); |
| 11703 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11704 | } |
| 11705 | pSession->nWpaRsnReqIeLength = ieLen; |
| 11706 | palCopyMemory(pMac->hHdd, pSession->pWpaRsnReqIE, wpaRsnIE, ieLen); |
| 11707 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11708 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11709 | pBuf += sizeof(tANI_U16); |
| 11710 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11711 | pBuf += ieLen; |
| 11712 | } |
| 11713 | } |
| 11714 | else |
| 11715 | { |
| 11716 | //free whatever old info |
| 11717 | pSession->nWpaRsnReqIeLength = 0; |
| 11718 | if(pSession->pWpaRsnReqIE) |
| 11719 | { |
| 11720 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 11721 | pSession->pWpaRsnReqIE = NULL; |
| 11722 | } |
| 11723 | #ifdef FEATURE_WLAN_WAPI |
| 11724 | pSession->nWapiReqIeLength = 0; |
| 11725 | if(pSession->pWapiReqIE) |
| 11726 | { |
| 11727 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 11728 | pSession->pWapiReqIE = NULL; |
| 11729 | } |
| 11730 | #endif /* FEATURE_WLAN_WAPI */ |
| 11731 | //length is two bytes |
| 11732 | *pBuf = 0; |
| 11733 | *(pBuf + 1) = 0; |
| 11734 | pBuf += 2; |
| 11735 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11736 | #ifdef FEATURE_WLAN_CCX |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11737 | if( eWNI_SME_JOIN_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11738 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11739 | // Never include the cckmIE in an Join Request |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11740 | //length is two bytes |
| 11741 | *pBuf = 0; |
| 11742 | *(pBuf + 1) = 0; |
| 11743 | pBuf += 2; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11744 | } |
| 11745 | else if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11746 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11747 | // cckmIE |
| 11748 | if( csrIsProfileCCX( pProfile ) ) |
| 11749 | { |
| 11750 | // Insert the CCKM IE into the join request |
| 11751 | ieLen = csrConstructCcxCckmIe( pMac, |
| 11752 | pSession, |
| 11753 | pProfile, |
| 11754 | pBssDescription, |
| 11755 | pSession->pWpaRsnReqIE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11756 | pSession->nWpaRsnReqIeLength, |
| 11757 | (void *)( wpaRsnIE ) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11758 | } |
| 11759 | else |
| 11760 | { |
| 11761 | ieLen = 0; |
| 11762 | } |
| 11763 | //If present, copy the IE into the eWNI_SME_REASSOC_REQ message buffer |
| 11764 | if( ieLen ) |
| 11765 | { |
| 11766 | //Copy the CCKM IE over from the temp buffer (wpaRsnIE) |
| 11767 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11768 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11769 | pBuf += sizeof(tANI_U16); |
| 11770 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11771 | pBuf += ieLen; |
| 11772 | } |
| 11773 | else |
| 11774 | { |
| 11775 | //Indicate you have no CCKM IE |
| 11776 | //length is two bytes |
| 11777 | *pBuf = 0; |
| 11778 | *(pBuf + 1) = 0; |
| 11779 | pBuf += 2; |
| 11780 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11781 | } |
| 11782 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11783 | // addIEScan |
| 11784 | if(pProfile->nAddIEScanLength && pProfile->pAddIEScan) |
| 11785 | { |
| 11786 | ieLen = pProfile->nAddIEScanLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11787 | if(ieLen > pSession->nAddIEScanLength) |
| 11788 | { |
| 11789 | if(pSession->pAddIEScan && pSession->nAddIEScanLength) |
| 11790 | { |
| 11791 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 11792 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11793 | status = palAllocateMemory(pMac->hHdd, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11794 | (void **)&pSession->pAddIEScan, ieLen); |
| 11795 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11796 | } |
| 11797 | pSession->nAddIEScanLength = ieLen; |
| 11798 | palCopyMemory(pMac->hHdd, pSession->pAddIEScan, |
| 11799 | pProfile->pAddIEScan, ieLen); |
| 11800 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11801 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11802 | pBuf += sizeof(tANI_U16); |
| 11803 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEScan, ieLen ); |
| 11804 | pBuf += ieLen; |
| 11805 | } |
| 11806 | else |
| 11807 | { |
| 11808 | pSession->nAddIEScanLength = 0; |
| 11809 | if(pSession->pAddIEScan) |
| 11810 | { |
| 11811 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 11812 | pSession->pAddIEScan = NULL; |
| 11813 | } |
| 11814 | *pBuf = 0; |
| 11815 | *(pBuf + 1) = 0; |
| 11816 | pBuf += 2; |
| 11817 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11818 | // addIEAssoc |
| 11819 | if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc) |
| 11820 | { |
| 11821 | ieLen = pProfile->nAddIEAssocLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11822 | if(ieLen > pSession->nAddIEAssocLength) |
| 11823 | { |
| 11824 | if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength) |
| 11825 | { |
| 11826 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 11827 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11828 | status = palAllocateMemory(pMac->hHdd, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11829 | (void **)&pSession->pAddIEAssoc, ieLen); |
| 11830 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11831 | } |
| 11832 | pSession->nAddIEAssocLength = ieLen; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11833 | palCopyMemory(pMac->hHdd, pSession->pAddIEAssoc, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11834 | pProfile->pAddIEAssoc, ieLen); |
| 11835 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11836 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11837 | pBuf += sizeof(tANI_U16); |
| 11838 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEAssoc, ieLen ); |
| 11839 | pBuf += ieLen; |
| 11840 | } |
| 11841 | else |
| 11842 | { |
| 11843 | pSession->nAddIEAssocLength = 0; |
| 11844 | if(pSession->pAddIEAssoc) |
| 11845 | { |
| 11846 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 11847 | pSession->pAddIEAssoc = NULL; |
| 11848 | } |
| 11849 | *pBuf = 0; |
| 11850 | *(pBuf + 1) = 0; |
| 11851 | pBuf += 2; |
| 11852 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11853 | |
| 11854 | if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11855 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11856 | //Unmask any AC in reassoc that is ACM-set |
| 11857 | uapsd_mask = (v_U8_t)pProfile->uapsd_mask; |
| 11858 | if( uapsd_mask && ( NULL != pBssDescription ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11859 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11860 | if( CSR_IS_QOS_BSS(pIes) && CSR_IS_UAPSD_BSS(pIes) ) |
| 11861 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11862 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11863 | acm_mask = sme_QosGetACMMask(pMac, pBssDescription, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11864 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11865 | uapsd_mask &= ~(acm_mask); |
| 11866 | } |
| 11867 | else |
| 11868 | { |
| 11869 | uapsd_mask = 0; |
| 11870 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11871 | } |
| 11872 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11873 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11874 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) ); |
| 11875 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11876 | pBuf += sizeof(tANI_U32); |
| 11877 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11878 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) ); |
| 11879 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11880 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11881 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11882 | pProfile->MDID.mdiePresent = pBssDescription->mdiePresent; |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 11883 | if (csrIsProfile11r( pProfile ) |
| 11884 | #ifdef FEATURE_WLAN_CCX |
| 11885 | && !((pIes->CCXVersion.present) && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
| 11886 | #endif |
| 11887 | ) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11888 | { |
| 11889 | // is11Rconnection; |
| 11890 | dwTmp = pal_cpu_to_be32(TRUE); |
| 11891 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11892 | pBuf += sizeof(tAniBool); |
| 11893 | } |
| 11894 | else |
| 11895 | { |
| 11896 | // is11Rconnection; |
| 11897 | dwTmp = pal_cpu_to_be32(FALSE); |
| 11898 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11899 | pBuf += sizeof(tAniBool); |
| 11900 | } |
| 11901 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11902 | #ifdef FEATURE_WLAN_CCX |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11903 | /* A profile can not be both CCX and 11R. But an 802.11R AP |
| 11904 | * may be advertising support for CCX as well. So if we are |
| 11905 | * associating Open or explicitly CCX then we will get CCX. |
| 11906 | * If we are associating explictly 11R only then we will get |
| 11907 | * 11R. |
| 11908 | */ |
| 11909 | if ((csrIsProfileCCX(pProfile) || |
| 11910 | ((pIes->CCXVersion.present) |
| 11911 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11912 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 11913 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 11914 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11915 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11916 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
| 11917 | { |
| 11918 | // isCCXconnection; |
| 11919 | dwTmp = pal_cpu_to_be32(TRUE); |
| 11920 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11921 | pBuf += sizeof(tAniBool); |
| 11922 | } |
| 11923 | else |
| 11924 | { |
| 11925 | //isCCXconnection; |
| 11926 | dwTmp = pal_cpu_to_be32(FALSE); |
| 11927 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11928 | pBuf += sizeof(tAniBool); |
| 11929 | } |
| 11930 | |
| 11931 | if (eWNI_SME_JOIN_REQ == messageType) |
| 11932 | { |
| 11933 | tCCXTspecInfo ccxTspec; |
| 11934 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 11935 | // so nullify the TSPEC parameters |
| 11936 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11937 | palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11938 | pBuf += sizeof(tCCXTspecInfo); |
| 11939 | } |
| 11940 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 11941 | { |
| 11942 | if ((csrIsProfileCCX(pProfile) || |
| 11943 | ((pIes->CCXVersion.present) |
| 11944 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11945 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 11946 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 11947 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11948 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11949 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11950 | { |
| 11951 | tCCXTspecInfo ccxTspec; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11952 | // CCX Tspec information |
| 11953 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11954 | ccxTspec.numTspecs = sme_QosCCxRetrieveTspecInfo(pMac, sessionId, (tTspecInfo *) &ccxTspec.tspec[0]); |
| 11955 | *pBuf = ccxTspec.numTspecs; |
| 11956 | pBuf += sizeof(tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11957 | // Copy the TSPEC information only if present |
| 11958 | if (ccxTspec.numTspecs) { |
| 11959 | palCopyMemory(pMac->hHdd, pBuf, (void*)&ccxTspec.tspec[0], (ccxTspec.numTspecs*sizeof(tTspecInfo))); |
| 11960 | } |
| 11961 | pBuf += sizeof(ccxTspec.tspec); |
| 11962 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11963 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11964 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11965 | tCCXTspecInfo ccxTspec; |
| 11966 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 11967 | // so nullify the TSPEC parameters |
| 11968 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11969 | palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11970 | pBuf += sizeof(tCCXTspecInfo); |
| 11971 | } |
| 11972 | } |
| 11973 | #endif // FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11974 | #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] | 11975 | // Fill in isFastTransitionEnabled |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11976 | if (pMac->roam.configParam.isFastTransitionEnabled |
| 11977 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 11978 | || csrRoamIsFastRoamEnabled(pMac, sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11979 | #endif |
| 11980 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11981 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11982 | dwTmp = pal_cpu_to_be32(TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11983 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11984 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11985 | } |
| 11986 | else |
| 11987 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11988 | dwTmp = pal_cpu_to_be32(FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11989 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11990 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11991 | } |
| 11992 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 11993 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 11994 | if(csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 11995 | { |
| 11996 | //legacy fast roaming enabled |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11997 | dwTmp = pal_cpu_to_be32(TRUE); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 11998 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11999 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12000 | } |
| 12001 | else |
| 12002 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12003 | dwTmp = pal_cpu_to_be32(FALSE); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12004 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12005 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12006 | } |
| 12007 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12008 | |
| 12009 | // txLdpcIniFeatureEnabled |
| 12010 | *pBuf = (tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 12011 | pBuf++; |
| 12012 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12013 | if ((csrIs11hSupported (pMac)) && (CSR_IS_CHANNEL_5GHZ(pBssDescription->channelId)) && |
| 12014 | (pIes->Country.present) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)) |
| 12015 | { |
| 12016 | csrSaveToChannelPower2G_5G( pMac, pIes->Country.num_triplets * sizeof(tSirMacChanInfo), |
| 12017 | (tSirMacChanInfo *)(&pIes->Country.triplets[0]) ); |
| 12018 | csrApplyPower2Current(pMac); |
| 12019 | } |
| 12020 | |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 12021 | #ifdef WLAN_FEATURE_11AC |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12022 | // txBFIniFeatureEnabled |
| 12023 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFEnable; |
| 12024 | pBuf++; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 12025 | |
| 12026 | // txBFCsnValue |
| 12027 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFCsnValue; |
| 12028 | pBuf++; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 12029 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12030 | //BssDesc |
| 12031 | csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, |
| 12032 | (tANI_U8)pProfile->uapsd_mask); |
| 12033 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 12034 | if(!HAL_STATUS_SUCCESS(status)) |
| 12035 | { |
| 12036 | break; |
| 12037 | } |
| 12038 | else |
| 12039 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12040 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12041 | if (eWNI_SME_JOIN_REQ == messageType) |
| 12042 | { |
| 12043 | //Tush-QoS: notify QoS module that join happening |
| 12044 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_JOIN_REQ, NULL); |
| 12045 | } |
| 12046 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 12047 | { |
| 12048 | //Tush-QoS: notify QoS module that reassoc happening |
| 12049 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_REASSOC_REQ, NULL); |
| 12050 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12051 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12052 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12053 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12054 | return( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12055 | } |
| 12056 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12057 | // |
| 12058 | eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 12059 | { |
| 12060 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12061 | tSirSmeDisassocReq *pMsg; |
| 12062 | tANI_U8 *pBuf; |
| 12063 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12064 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12065 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 12066 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12067 | do { |
| 12068 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocReq )); |
| 12069 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12070 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocReq )); |
| 12071 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_REQ); |
| 12072 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12073 | pBuf = &pMsg->sessionId; |
| 12074 | // sessionId |
| 12075 | *pBuf++ = (tANI_U8)sessionId; |
| 12076 | // transactionId |
| 12077 | *pBuf = 0; |
| 12078 | *( pBuf + 1 ) = 0; |
| 12079 | pBuf += sizeof(tANI_U16); |
| 12080 | |
Gopichand Nakkala | 06a7b3f | 2013-03-05 17:56:50 +0530 | [diff] [blame] | 12081 | if ( (pSession->pCurRoamProfile != NULL) && |
| 12082 | ((CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
| 12083 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile))) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12084 | { |
| 12085 | // Set the bssid address before sending the message to LIM |
| 12086 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( tSirMacAddr ) ); |
| 12087 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12088 | // Set the peer MAC address before sending the message to LIM |
| 12089 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); //perMacAddr is passed as bssId for softAP |
| 12090 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 12091 | } |
| 12092 | else |
| 12093 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12094 | // Set the peer MAC address before sending the message to LIM |
| 12095 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); |
| 12096 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12097 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->bssId ) ); |
| 12098 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12099 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12100 | if(!HAL_STATUS_SUCCESS(status)) |
| 12101 | { |
| 12102 | palFreeMemory(pMac->hHdd, pMsg); |
| 12103 | break; |
| 12104 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12105 | // reasonCode |
| 12106 | wTmp = pal_cpu_to_be16(reasonCode); |
| 12107 | status = palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12108 | if(!HAL_STATUS_SUCCESS(status)) |
| 12109 | { |
| 12110 | palFreeMemory(pMac->hHdd, pMsg); |
| 12111 | break; |
| 12112 | } |
| 12113 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12114 | /* The state will be DISASSOC_HANDOFF only when we are doing handoff. |
| 12115 | Here we should not send the disassoc over the air to the AP */ |
| 12116 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId) |
| 12117 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 12118 | && csrRoamIs11rAssoc(pMac) |
| 12119 | #endif |
| 12120 | ) |
| 12121 | { |
| 12122 | *pBuf = CSR_DONT_SEND_DISASSOC_OVER_THE_AIR; /* Set DoNotSendOverTheAir flag to 1 only for handoff case */ |
| 12123 | } |
| 12124 | pBuf += sizeof(tANI_U8); |
| 12125 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12126 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12127 | return( status ); |
| 12128 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12129 | eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable, tSirMacAddr bssId ) |
| 12130 | { |
| 12131 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12132 | tSirSmeTkipCntrMeasReq *pMsg; |
| 12133 | tANI_U8 *pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12134 | do |
| 12135 | { |
| 12136 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeTkipCntrMeasReq )); |
| 12137 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12138 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeTkipCntrMeasReq )); |
| 12139 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_TKIP_CNTR_MEAS_REQ); |
| 12140 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeTkipCntrMeasReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12141 | pBuf = &pMsg->sessionId; |
| 12142 | // sessionId |
| 12143 | *pBuf++ = (tANI_U8)sessionId; |
| 12144 | // transactionId |
| 12145 | *pBuf = 0; |
| 12146 | *( pBuf + 1 ) = 0; |
| 12147 | pBuf += sizeof(tANI_U16); |
| 12148 | // bssid |
| 12149 | status = palCopyMemory( pMac->hHdd, pMsg->bssId, bssId, sizeof( tSirMacAddr ) ); |
| 12150 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 12151 | // bEnable |
| 12152 | *pBuf = (tANI_BOOLEAN)bEnable; |
| 12153 | if(!HAL_STATUS_SUCCESS(status)) |
| 12154 | { |
| 12155 | palFreeMemory(pMac->hHdd, pMsg); |
| 12156 | break; |
| 12157 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12158 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12159 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12160 | return( status ); |
| 12161 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12162 | eHalStatus |
| 12163 | csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12164 | VOS_MODULE_ID modId, tSirMacAddr bssId, |
| 12165 | void *pUsrContext, void *pfnSapEventCallback, |
| 12166 | tANI_U8 *pAssocStasBuf ) |
| 12167 | { |
| 12168 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12169 | tSirSmeGetAssocSTAsReq *pMsg; |
| 12170 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 12171 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12172 | do |
| 12173 | { |
| 12174 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeGetAssocSTAsReq ) ); |
| 12175 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12176 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetAssocSTAsReq ) ); |
| 12177 | 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] | 12178 | pBuf = (tANI_U8 *)&pMsg->bssId; |
| 12179 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12180 | // bssId |
| 12181 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) ); |
| 12182 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12183 | // modId |
| 12184 | dwTmp = pal_cpu_to_be16((tANI_U16)modId); |
| 12185 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U16)); |
| 12186 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12187 | // pUsrContext |
| 12188 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
| 12189 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12190 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12191 | // pfnSapEventCallback |
| 12192 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
| 12193 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12194 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12195 | // pAssocStasBuf |
| 12196 | dwTmp = pal_cpu_to_be32((tANI_U32)pAssocStasBuf); |
| 12197 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12198 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12199 | 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] | 12200 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12201 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12202 | return( status ); |
| 12203 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12204 | eHalStatus |
| 12205 | csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12206 | tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac) |
| 12207 | { |
| 12208 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12209 | tSirSmeGetWPSPBCSessionsReq *pMsg; |
| 12210 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 12211 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12212 | do |
| 12213 | { |
| 12214 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirSmeGetWPSPBCSessionsReq) ); |
| 12215 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12216 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetWPSPBCSessionsReq ) ); |
| 12217 | 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] | 12218 | pBuf = (tANI_U8 *)&pMsg->pUsrContext; |
| 12219 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12220 | // pUsrContext |
| 12221 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
| 12222 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12223 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12224 | // pSapEventCallback |
| 12225 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
| 12226 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12227 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12228 | // bssId |
| 12229 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) ); |
| 12230 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12231 | // MAC Address of STA in WPS session |
| 12232 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pRemoveMac.bytes, sizeof(v_MACADDR_t)); |
| 12233 | pBuf += sizeof(v_MACADDR_t); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12234 | 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] | 12235 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12236 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12237 | return( status ); |
| 12238 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 12239 | |
| 12240 | eHalStatus |
| 12241 | csrSendChngMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12242 | { |
| 12243 | tpSirChangeBIParams pMsg; |
| 12244 | tANI_U16 len = 0; |
| 12245 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12246 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12247 | |
| 12248 | if(!pSession) |
| 12249 | { |
| 12250 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12251 | return eHAL_STATUS_FAILURE; |
| 12252 | } |
| 12253 | |
| 12254 | //NO need to update the Beacon Params if update beacon parameter flag is not set |
| 12255 | if(!pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval ) |
| 12256 | return eHAL_STATUS_SUCCESS; |
| 12257 | |
| 12258 | pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE; |
| 12259 | |
| 12260 | /* Create the message and send to lim */ |
| 12261 | len = sizeof(tSirChangeBIParams); |
| 12262 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len ); |
| 12263 | if(HAL_STATUS_SUCCESS(status)) |
| 12264 | { |
| 12265 | palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirChangeBIParams) ); |
| 12266 | pMsg->messageType = eWNI_SME_CHNG_MCC_BEACON_INTERVAL; |
| 12267 | pMsg->length = len; |
| 12268 | |
| 12269 | // bssId |
| 12270 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12271 | 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] | 12272 | pMsg->bssId[ 0 ], pMsg->bssId[ 1 ], pMsg->bssId[ 2 ], |
| 12273 | pMsg->bssId[ 3 ], pMsg->bssId[ 4 ], pMsg->bssId[ 5 ] ); |
| 12274 | pMsg->sessionId = sessionId; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12275 | 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] | 12276 | pMsg->beaconInterval = pMac->roam.roamSession[sessionId].bssParams.beaconInterval; |
| 12277 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 12278 | } |
| 12279 | return status; |
| 12280 | } |
| 12281 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12282 | eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 12283 | { |
| 12284 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12285 | tSirSmeDeauthReq *pMsg; |
| 12286 | tANI_U8 *pBuf; |
| 12287 | tANI_U16 wTmp; |
| 12288 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12289 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 12290 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12291 | do { |
| 12292 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthReq )); |
| 12293 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12294 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthReq )); |
| 12295 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_REQ); |
| 12296 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthReq )); |
| 12297 | //sessionId |
| 12298 | pBuf = &pMsg->sessionId; |
| 12299 | *pBuf++ = (tANI_U8)sessionId; |
| 12300 | |
| 12301 | //tansactionId |
| 12302 | *pBuf = 0; |
| 12303 | *(pBuf + 1 ) = 0; |
| 12304 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12305 | if ((pSession->pCurRoamProfile != NULL) && ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12306 | (CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12307 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))){ |
| 12308 | // Set the BSSID before sending the message to LIM |
| 12309 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( pMsg->peerMacAddr ) ); |
| 12310 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 12311 | } |
| 12312 | else |
| 12313 | { |
| 12314 | // Set the BSSID before sending the message to LIM |
| 12315 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 12316 | pBuf = pBuf + sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12317 | } |
| 12318 | if(!HAL_STATUS_SUCCESS(status)) |
| 12319 | { |
| 12320 | palFreeMemory(pMac->hHdd, pMsg); |
| 12321 | break; |
| 12322 | } |
| 12323 | // Set the peer MAC address before sending the message to LIM |
| 12324 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *) pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 12325 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 12326 | if(!HAL_STATUS_SUCCESS(status)) |
| 12327 | { |
| 12328 | palFreeMemory(pMac->hHdd, pMsg); |
| 12329 | break; |
| 12330 | } |
| 12331 | wTmp = pal_cpu_to_be16(reasonCode); |
| 12332 | status = palCopyMemory( pMac->hHdd, pBuf, &wTmp,sizeof( tANI_U16 ) ); |
| 12333 | if(!HAL_STATUS_SUCCESS(status)) |
| 12334 | { |
| 12335 | palFreeMemory(pMac->hHdd, pMsg); |
| 12336 | break; |
| 12337 | } |
| 12338 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12339 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12340 | return( status ); |
| 12341 | } |
| 12342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12343 | eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd ) |
| 12344 | { |
| 12345 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12346 | tSirSmeDisassocCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12347 | do { |
| 12348 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocCnf )); |
| 12349 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12350 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocCnf )); |
| 12351 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_CNF); |
| 12352 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12353 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocCnf )); |
| 12354 | status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDisassocInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); |
| 12355 | if(!HAL_STATUS_SUCCESS(status)) |
| 12356 | { |
| 12357 | palFreeMemory(pMac->hHdd, pMsg); |
| 12358 | break; |
| 12359 | } |
| 12360 | //To test reconn |
| 12361 | status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDisassocInd->bssId, sizeof(pMsg->peerMacAddr)); |
| 12362 | if(!HAL_STATUS_SUCCESS(status)) |
| 12363 | { |
| 12364 | palFreeMemory(pMac->hHdd, pMsg); |
| 12365 | break; |
| 12366 | } |
| 12367 | //To test reconn ends |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12368 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12369 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12370 | return( status ); |
| 12371 | } |
| 12372 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12373 | eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd ) |
| 12374 | { |
| 12375 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12376 | tSirSmeDeauthCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12377 | do { |
| 12378 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthCnf )); |
| 12379 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12380 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthCnf )); |
| 12381 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_CNF); |
| 12382 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12383 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthCnf )); |
| 12384 | status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDeauthInd->bssId, sizeof(pMsg->bssId)); |
| 12385 | if(!HAL_STATUS_SUCCESS(status)) |
| 12386 | { |
| 12387 | palFreeMemory(pMac->hHdd, pMsg); |
| 12388 | break; |
| 12389 | } |
| 12390 | status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDeauthInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); |
| 12391 | if(!HAL_STATUS_SUCCESS(status)) |
| 12392 | { |
| 12393 | palFreeMemory(pMac->hHdd, pMsg); |
| 12394 | break; |
| 12395 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12396 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12397 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12398 | return( status ); |
| 12399 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12400 | eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus ) |
| 12401 | { |
| 12402 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12403 | tSirSmeAssocCnf *pMsg; |
| 12404 | tANI_U8 *pBuf; |
| 12405 | tSirResultCodes statusCode; |
| 12406 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12407 | do { |
| 12408 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocCnf )); |
| 12409 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12410 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocCnf )); |
| 12411 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ASSOC_CNF); |
| 12412 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocCnf )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12413 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 12414 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 12415 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12416 | else |
| 12417 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
| 12418 | palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) ); |
| 12419 | pBuf += sizeof(tSirResultCodes); |
| 12420 | // bssId |
| 12421 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12422 | pBuf += sizeof (tSirMacAddr); |
| 12423 | // peerMacAddr |
| 12424 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 12425 | pBuf += sizeof (tSirMacAddr); |
| 12426 | // aid |
| 12427 | wTmp = pal_cpu_to_be16(pAssocInd->aid); |
| 12428 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12429 | pBuf += sizeof (tANI_U16); |
| 12430 | // alternateBssId |
| 12431 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12432 | pBuf += sizeof (tSirMacAddr); |
| 12433 | // alternateChannelId |
| 12434 | *pBuf = 11; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12435 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12436 | if(!HAL_STATUS_SUCCESS(status)) |
| 12437 | { |
| 12438 | //pMsg is freed by palSendMBMessage |
| 12439 | break; |
| 12440 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12441 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12442 | return( status ); |
| 12443 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12444 | eHalStatus csrSendAssocIndToUpperLayerCnfMsg( tpAniSirGlobal pMac, |
| 12445 | tpSirSmeAssocInd pAssocInd, |
| 12446 | eHalStatus Halstatus, |
| 12447 | tANI_U8 sessionId) |
| 12448 | { |
| 12449 | tSirMsgQ msgQ; |
| 12450 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12451 | tSirSmeAssocIndToUpperLayerCnf *pMsg; |
| 12452 | tANI_U8 *pBuf; |
| 12453 | tSirResultCodes statusCode; |
| 12454 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12455 | do { |
| 12456 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 12457 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12458 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12460 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPPER_LAYER_ASSOC_CNF); |
| 12461 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 12462 | |
| 12463 | pMsg->sessionId = sessionId; |
| 12464 | |
| 12465 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 12466 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 12467 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12468 | else |
| 12469 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
| 12470 | palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) ); |
| 12471 | pBuf += sizeof(tSirResultCodes); |
| 12472 | // bssId |
| 12473 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12474 | pBuf += sizeof (tSirMacAddr); |
| 12475 | // peerMacAddr |
| 12476 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 12477 | pBuf += sizeof (tSirMacAddr); |
| 12478 | // StaId |
| 12479 | wTmp = pal_cpu_to_be16(pAssocInd->staId); |
| 12480 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12481 | pBuf += sizeof (tANI_U16); |
| 12482 | // alternateBssId |
| 12483 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12484 | pBuf += sizeof (tSirMacAddr); |
| 12485 | // alternateChannelId |
| 12486 | *pBuf = 11; |
| 12487 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12488 | // Instead of copying roam Info, we just copy only WmmEnabled , RsnIE information |
| 12489 | //Wmm |
| 12490 | *pBuf = pAssocInd->wmmEnabledSta; |
| 12491 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12492 | //RSN IE |
| 12493 | status = palCopyMemory(pMac->hHdd, (tSirRSNie *)pBuf, &pAssocInd->rsnIE, sizeof(tSirRSNie)); |
| 12494 | pBuf += sizeof (tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12495 | //Additional IE |
| 12496 | status = palCopyMemory(pMac->hHdd, (void *)pBuf, &pAssocInd->addIE, sizeof(tSirAddie)); |
| 12497 | pBuf += sizeof (tSirAddie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12498 | //reassocReq |
| 12499 | *pBuf = pAssocInd->reassocReq; |
| 12500 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12501 | msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF; |
| 12502 | msgQ.bodyptr = pMsg; |
| 12503 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12504 | SysProcessMmhMsg(pMac, &msgQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12505 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12506 | return( status ); |
| 12507 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12509 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId , |
| 12510 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 12511 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 12512 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 12513 | tANI_U8 *pKeyRsc ) |
| 12514 | { |
| 12515 | tSirSmeSetContextReq *pMsg; |
| 12516 | tANI_U16 msgLen; |
| 12517 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12518 | tAniEdType tmpEdType; |
| 12519 | tAniKeyDirection tmpDirection; |
| 12520 | tANI_U8 *pBuf; |
| 12521 | tANI_U8 *p; |
| 12522 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12523 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12524 | if( ( 1 != numKeys ) && ( 0 != numKeys ) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12525 | // all of these fields appear in every SET_CONTEXT message. Below we'll add in the size for each |
| 12526 | // key set. Since we only support upto one key, we always allocate memory for 1 key |
| 12527 | msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) + |
| 12528 | sizeof( tSirMacAddr ) + 1 + sizeof(tANI_U16) + |
| 12529 | sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + |
| 12530 | ( sizeof( pMsg->keyMaterial.key ) ); |
| 12531 | |
| 12532 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12533 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12534 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 12535 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SETCONTEXT_REQ); |
| 12536 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12537 | //sessionId |
| 12538 | pBuf = &pMsg->sessionId; |
| 12539 | *pBuf = (tANI_U8)sessionId; |
| 12540 | pBuf++; |
| 12541 | // transactionId |
| 12542 | *pBuf = 0; |
| 12543 | *(pBuf + 1) = 0; |
| 12544 | pBuf += sizeof(tANI_U16); |
| 12545 | // peerMacAddr |
| 12546 | palCopyMemory( pMac->hHdd, pBuf, |
| 12547 | (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr) ); |
| 12548 | |
| 12549 | pBuf += sizeof(tSirMacAddr); |
| 12550 | |
| 12551 | // bssId |
| 12552 | palCopyMemory( pMac->hHdd, pBuf, |
| 12553 | (tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 12554 | |
| 12555 | pBuf += sizeof(tSirMacAddr); |
| 12556 | |
| 12557 | p = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12558 | // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field |
| 12559 | // in the tSirKeyMaterial keyMaterial; field). |
| 12560 | // |
| 12561 | // !!NOTE: This keyMaterial.length contains the length of a MAX size key, though the keyLength can be |
| 12562 | // shorter than this max size. Is LIM interpreting this ok ? |
| 12563 | 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] | 12564 | // set pMsg->keyMaterial.edType |
| 12565 | tmpEdType = (tAniEdType)pal_cpu_to_be32(edType); |
| 12566 | palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType) ); |
| 12567 | p += sizeof( pMsg->keyMaterial.edType ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12568 | // set the pMsg->keyMaterial.numKeys field |
| 12569 | *p = numKeys; |
| 12570 | p += sizeof( pMsg->keyMaterial.numKeys ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12571 | // set pSirKey->keyId = keyId; |
| 12572 | *p = keyId; |
| 12573 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12574 | // set pSirKey->unicast = (tANI_U8)fUnicast; |
| 12575 | *p = (tANI_U8)fUnicast; |
| 12576 | p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12577 | // set pSirKey->keyDirection = aniKeyDirection; |
| 12578 | tmpDirection = (tAniKeyDirection)pal_cpu_to_be32(aniKeyDirection); |
| 12579 | palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection) ); |
| 12580 | p += sizeof(tAniKeyDirection); |
| 12581 | // pSirKey->keyRsc = ;; |
| 12582 | palCopyMemory( pMac->hHdd, p, pKeyRsc, CSR_MAX_RSC_LEN ); |
| 12583 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12584 | // set pSirKey->paeRole |
| 12585 | *p = paeRole; // 0 is Supplicant |
| 12586 | p++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12587 | // set pSirKey->keyLength = keyLength; |
| 12588 | p = pal_set_U16( p, pal_cpu_to_be16(keyLength) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12589 | if ( keyLength && pKey ) |
| 12590 | { |
| 12591 | palCopyMemory( pMac->hHdd, p, pKey, keyLength ); |
| 12592 | if(keyLength == 16) |
| 12593 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12594 | 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] | 12595 | keyId, edType, pKey[0], pKey[1], pKey[2], pKey[3], pKey[4], |
| 12596 | pKey[5], pKey[6], pKey[7], pKey[8], |
| 12597 | pKey[9], pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], pKey[15]); |
| 12598 | } |
| 12599 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12600 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12601 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12602 | return( status ); |
| 12603 | } |
| 12604 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12605 | eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, |
| 12606 | tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc ) |
| 12607 | { |
| 12608 | eHalStatus status; |
| 12609 | tSirSmeStartBssReq *pMsg; |
| 12610 | tANI_U8 *pBuf = NULL; |
| 12611 | tANI_U8 *wTmpBuf = NULL; |
| 12612 | tANI_U16 msgLen, wTmp; |
| 12613 | tANI_U32 dwTmp; |
| 12614 | tSirNwType nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12615 | ePhyChanBondState cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12616 | tANI_U32 authType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12617 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12618 | |
| 12619 | if(!pSession) |
| 12620 | { |
| 12621 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12622 | return eHAL_STATUS_FAILURE; |
| 12623 | } |
| 12624 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12625 | do { |
| 12626 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 12627 | pSession->joinFailStatusCode.reasonCode = 0; |
| 12628 | msgLen = sizeof(tSirSmeStartBssReq); |
| 12629 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12630 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12631 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 12632 | 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] | 12633 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12634 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12635 | //sessionId |
| 12636 | *pBuf = (tANI_U8)sessionId; |
| 12637 | pBuf++; |
| 12638 | // transactionId |
| 12639 | *pBuf = 0; |
| 12640 | *(pBuf + 1) = 0; |
| 12641 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12642 | // bssid |
| 12643 | palCopyMemory( pMac->hHdd, pBuf, pParam->bssid, sizeof(tSirMacAddr) ); |
| 12644 | pBuf += sizeof(tSirMacAddr); |
| 12645 | // selfMacAddr |
| 12646 | palCopyMemory( pMac->hHdd, pBuf, pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 12647 | pBuf += sizeof(tSirMacAddr); |
| 12648 | // beaconInterval |
| 12649 | if( pBssDesc && pBssDesc->beaconInterval ) |
| 12650 | { |
| 12651 | wTmp = pal_cpu_to_be16( pBssDesc->beaconInterval ); |
| 12652 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12653 | else if(pParam->beaconInterval) |
| 12654 | { |
| 12655 | wTmp = pal_cpu_to_be16( pParam->beaconInterval ); |
| 12656 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12657 | else |
| 12658 | { |
| 12659 | wTmp = pal_cpu_to_be16( WNI_CFG_BEACON_INTERVAL_STADEF ); |
| 12660 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12661 | if(csrIsconcurrentsessionValid (pMac, sessionId, |
| 12662 | pParam->bssPersona) |
| 12663 | == eHAL_STATUS_SUCCESS ) |
| 12664 | { |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 12665 | csrValidateMCCBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12666 | pParam->bssPersona); |
| 12667 | //Update the beacon Interval |
| 12668 | pParam->beaconInterval = wTmp; |
| 12669 | } |
| 12670 | else |
| 12671 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12672 | smsLog( pMac,LOGE, FL("****Start BSS failed persona already exists***")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12673 | status = eHAL_STATUS_FAILURE; |
| 12674 | return status; |
| 12675 | } |
| 12676 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12677 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); |
| 12678 | pBuf += sizeof(tANI_U16); |
| 12679 | // dot11mode |
| 12680 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pParam->uCfgDot11Mode ); |
| 12681 | pBuf += 1; |
| 12682 | // bssType |
| 12683 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( bssType ) ); |
| 12684 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 12685 | pBuf += sizeof(tSirBssType); |
| 12686 | // ssId |
| 12687 | if( pParam->ssId.length ) |
| 12688 | { |
| 12689 | // ssId len |
| 12690 | *pBuf = pParam->ssId.length; |
| 12691 | pBuf++; |
| 12692 | palCopyMemory( pMac->hHdd, pBuf, pParam->ssId.ssId, pParam->ssId.length ); |
| 12693 | pBuf += pParam->ssId.length; |
| 12694 | } |
| 12695 | else |
| 12696 | { |
| 12697 | *pBuf = 0; |
| 12698 | pBuf++; |
| 12699 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12700 | // set the channel Id |
| 12701 | *pBuf = pParam->operationChn; |
| 12702 | pBuf++; |
| 12703 | //What should we really do for the cbmode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12704 | cbMode = (ePhyChanBondState)pal_cpu_to_be32(pParam->cbMode); |
| 12705 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState) ); |
| 12706 | pBuf += sizeof(ePhyChanBondState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12708 | // Set privacy |
| 12709 | *pBuf = pParam->privacy; |
| 12710 | pBuf++; |
| 12711 | |
| 12712 | //Set Uapsd |
| 12713 | *pBuf = pParam->ApUapsdEnable; |
| 12714 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12715 | //Set SSID hidden |
| 12716 | *pBuf = pParam->ssidHidden; |
| 12717 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12718 | *pBuf = (tANI_U8)pParam->fwdWPSPBCProbeReq; |
| 12719 | pBuf++; |
| 12720 | |
| 12721 | //Ht protection Enable/Disable |
| 12722 | *pBuf = (tANI_U8)pParam->protEnabled; |
| 12723 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12724 | //Enable Beacons to Receive for OBSS protection Enable/Disable |
| 12725 | *pBuf = (tANI_U8)pParam->obssProtEnabled; |
| 12726 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12727 | //set cfg related to protection |
| 12728 | wTmp = pal_cpu_to_be16( pParam->ht_protection ); |
| 12729 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); |
| 12730 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12731 | // Set Auth type |
| 12732 | authType = pal_cpu_to_be32(pParam->authType); |
| 12733 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&authType, sizeof(tANI_U32)); |
| 12734 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12735 | // Set DTIM |
| 12736 | dwTmp = pal_cpu_to_be32(pParam->dtimPeriod); |
| 12737 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12738 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12739 | // Set wps_state |
| 12740 | *pBuf = pParam->wps_state; |
| 12741 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12742 | //Persona |
| 12743 | *pBuf = (tANI_U8)pParam->bssPersona; |
| 12744 | pBuf++; |
| 12745 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 12746 | //txLdpcIniFeatureEnabled |
| 12747 | *pBuf = (tANI_U8)(tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 12748 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12749 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12750 | |
| 12751 | // set RSN IE |
| 12752 | if( pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata) ) |
| 12753 | { |
| 12754 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 12755 | palFreeMemory( pMac->hHdd, pMsg ); |
| 12756 | break; |
| 12757 | } |
| 12758 | wTmp = pal_cpu_to_be16( pParam->nRSNIELength ); |
| 12759 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12760 | pBuf += sizeof(tANI_U16); |
| 12761 | if( wTmp ) |
| 12762 | { |
| 12763 | wTmp = pParam->nRSNIELength; |
| 12764 | palCopyMemory( pMac->hHdd, pBuf, pParam->pRSNIE, wTmp ); |
| 12765 | pBuf += wTmp; |
| 12766 | } |
| 12767 | nwType = (tSirNwType)pal_cpu_to_be32(pParam->sirNwType); |
| 12768 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType) ); |
| 12769 | pBuf += sizeof(tSirNwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12770 | *pBuf = pParam->operationalRateSet.numRates; //tSirMacRateSet->numRates |
| 12771 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12772 | palCopyMemory( pMac->hHdd, pBuf, pParam->operationalRateSet.rate, pParam->operationalRateSet.numRates ); |
| 12773 | pBuf += pParam->operationalRateSet.numRates ; |
| 12774 | *pBuf++ = pParam->extendedRateSet.numRates; |
| 12775 | if(0 != pParam->extendedRateSet.numRates) |
| 12776 | { |
| 12777 | palCopyMemory( pMac->hHdd, pBuf, pParam->extendedRateSet.rate, pParam->extendedRateSet.numRates ); |
| 12778 | pBuf += pParam->extendedRateSet.numRates; |
| 12779 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12780 | msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg |
| 12781 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 12782 | |
| 12783 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12784 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12785 | return( status ); |
| 12786 | } |
| 12787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12788 | eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 12789 | { |
| 12790 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12791 | tSirSmeStopBssReq *pMsg; |
| 12792 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12793 | tANI_U8 *pBuf; |
| 12794 | tANI_U16 msgLen; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12795 | |
| 12796 | if(!pSession) |
| 12797 | { |
| 12798 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12799 | return eHAL_STATUS_FAILURE; |
| 12800 | } |
| 12801 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12802 | do { |
| 12803 | status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq)); |
| 12804 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12805 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq )); |
| 12806 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 12807 | pBuf = &pMsg->sessionId; |
| 12808 | //sessionId |
| 12809 | *pBuf = (tANI_U8)sessionId; |
| 12810 | pBuf++; |
| 12811 | // transactionId |
| 12812 | *pBuf = 0; |
| 12813 | pBuf += sizeof(tANI_U16); |
| 12814 | //reason code |
| 12815 | *pBuf = 0; |
| 12816 | pBuf += sizeof(tSirResultCodes); |
| 12817 | // bssid |
| 12818 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 12819 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 12820 | { |
| 12821 | palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 12822 | } |
| 12823 | else |
| 12824 | { |
| 12825 | palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 12826 | } |
| 12827 | pBuf += sizeof(tSirMacAddr); |
| 12828 | msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr); |
| 12829 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12830 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12831 | #if 0 |
| 12832 | status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq)); |
| 12833 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12834 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq )); |
| 12835 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 12836 | pMsg->reasonCode = 0; |
| 12837 | // bssid |
| 12838 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 12839 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 12840 | { |
| 12841 | pbBssid = (tANI_U8 *)&pSession->selfMacAddr; |
| 12842 | } |
| 12843 | else |
| 12844 | { |
| 12845 | pbBssid = (tANI_U8 *)&pSession->connectedProfile.bssid; |
| 12846 | } |
| 12847 | palCopyMemory( pMac->hHdd, &pMsg->bssId, pbBssid, sizeof(tSirMacAddr) ); |
| 12848 | pMsg->transactionId = 0; |
| 12849 | pMsg->sessionId = (tANI_U8)sessionId; |
| 12850 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeStopBssReq )); |
| 12851 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12852 | #endif |
| 12853 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12854 | return( status ); |
| 12855 | } |
| 12856 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12857 | eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12858 | tCsrRoamModifyProfileFields *pModProfileFields, |
| 12859 | tANI_U32 *pRoamId, v_BOOL_t fForce) |
| 12860 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12861 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12862 | tANI_U32 roamId = 0; |
| 12863 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12864 | if((csrIsConnStateConnected(pMac, sessionId)) && |
| 12865 | (fForce || (!palEqualMemory(pMac->hHdd, &pModProfileFields, |
| 12866 | &pSession->connectedProfile.modifyProfileFields, |
| 12867 | sizeof(tCsrRoamModifyProfileFields)))) ) |
| 12868 | { |
| 12869 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 12870 | if(pRoamId) |
| 12871 | { |
| 12872 | *pRoamId = roamId; |
| 12873 | } |
| 12874 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12875 | status = csrRoamIssueReassoc(pMac, sessionId, NULL, pModProfileFields, |
| 12876 | eCsrSmeIssuedReassocToSameAP, roamId, |
| 12877 | eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12878 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12879 | return status; |
| 12880 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12881 | static eHalStatus csrRoamSessionOpened(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12882 | { |
| 12883 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12884 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12885 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 12886 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 12887 | eCSR_ROAM_SESSION_OPENED, eCSR_ROAM_RESULT_NONE); |
| 12888 | return (status); |
| 12889 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12890 | eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 12891 | { |
| 12892 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12893 | tListElem *pEntry = NULL; |
| 12894 | tSmeCmd *pCommand = NULL; |
| 12895 | tSirSmeAddStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12896 | do |
| 12897 | { |
| 12898 | if(pMsg == NULL) |
| 12899 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12900 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12901 | status = eHAL_STATUS_FAILURE; |
| 12902 | break; |
| 12903 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12904 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 12905 | if(pEntry) |
| 12906 | { |
| 12907 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 12908 | if(eSmeCommandAddStaSession == pCommand->command) |
| 12909 | { |
| 12910 | pRsp = (tSirSmeAddStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12911 | smsLog( pMac, LOG1, "Add Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12912 | //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] | 12913 | csrRoamSessionOpened(pMac, pCommand->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12914 | //Remove this command out of the active list |
| 12915 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 12916 | { |
| 12917 | //Now put this command back on the avilable command list |
| 12918 | csrReleaseCommand(pMac, pCommand); |
| 12919 | } |
| 12920 | smeProcessPendingQueue( pMac ); |
| 12921 | } |
| 12922 | else |
| 12923 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12924 | 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] | 12925 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12926 | status = eHAL_STATUS_FAILURE; |
| 12927 | break; |
| 12928 | } |
| 12929 | } |
| 12930 | else |
| 12931 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12932 | 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] | 12933 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12934 | status = eHAL_STATUS_FAILURE; |
| 12935 | break; |
| 12936 | } |
| 12937 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12938 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12939 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12940 | eHalStatus csrSendMBAddSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 12941 | { |
| 12942 | tSirSmeAddStaSelfReq *pMsg; |
| 12943 | tANI_U16 msgLen; |
| 12944 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12945 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12946 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 12947 | sizeof( tSirBssType )*/; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12948 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12949 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12950 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12951 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ADD_STA_SELF_REQ); |
| 12952 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12953 | // self station address |
| 12954 | palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12955 | smsLog( pMac, LOG1, FL("selfMac=%02x, %02x, %02x, %02x, %02x, %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12956 | pMsg->selfMacAddr[0], |
| 12957 | pMsg->selfMacAddr[1], |
| 12958 | pMsg->selfMacAddr[2], |
| 12959 | pMsg->selfMacAddr[3], |
| 12960 | pMsg->selfMacAddr[4], |
| 12961 | pMsg->selfMacAddr[5]); |
| 12962 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12963 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12964 | return( status ); |
| 12965 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12966 | eHalStatus csrIssueAddStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr sessionMacAddr) |
| 12967 | { |
| 12968 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12969 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12970 | pCommand = csrGetCommandBuffer(pMac); |
| 12971 | if(NULL == pCommand) |
| 12972 | { |
| 12973 | status = eHAL_STATUS_RESOURCES; |
| 12974 | } |
| 12975 | else |
| 12976 | { |
| 12977 | pCommand->command = eSmeCommandAddStaSession; |
| 12978 | pCommand->sessionId = (tANI_U8)sessionId; |
| 12979 | palCopyMemory( pMac->hHdd, pCommand->u.addStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12980 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 12981 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 12982 | { |
| 12983 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12984 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12985 | } |
| 12986 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12987 | return (status); |
| 12988 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12989 | eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 12990 | { |
| 12991 | return csrSendMBAddSelfStaReqMsg( pMac, |
| 12992 | pCommand->u.addStaSessionCmd.selfMacAddr ); |
| 12993 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12994 | eHalStatus csrRoamOpenSession( tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext, |
| 12995 | tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId ) |
| 12996 | { |
| 12997 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12998 | tANI_U32 i; |
| 12999 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13000 | *pbSessionId = CSR_SESSION_ID_INVALID; |
| 13001 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13002 | { |
| 13003 | if( !CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13004 | { |
| 13005 | pSession = CSR_GET_SESSION( pMac, i ); |
| 13006 | status = eHAL_STATUS_SUCCESS; |
| 13007 | pSession->sessionActive = eANI_BOOLEAN_TRUE; |
| 13008 | pSession->sessionId = (tANI_U8)i; |
| 13009 | pSession->callback = callback; |
| 13010 | pSession->pContext = pContext; |
| 13011 | palCopyMemory( pMac->hHdd, &pSession->selfMacAddr, pSelfMacAddr, sizeof(tCsrBssid) ); |
| 13012 | *pbSessionId = (tANI_U8)i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13013 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerRoaming, csrRoamRoamingTimerHandler, |
| 13014 | &pSession->roamingTimerInfo); |
| 13015 | if(!HAL_STATUS_SUCCESS(status)) |
| 13016 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13017 | smsLog(pMac, LOGE, FL("cannot allocate memory for Roaming timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13018 | break; |
| 13019 | } |
| 13020 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 13021 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerJoinRetry, csrRoamJoinRetryTimerHandler, |
| 13022 | &pSession->joinRetryTimerInfo); |
| 13023 | if(!HAL_STATUS_SUCCESS(status)) |
| 13024 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13025 | smsLog(pMac, LOGE, FL("cannot allocate memory for joinretry timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13026 | break; |
| 13027 | } |
| 13028 | #endif |
| 13029 | pSession->ibssJoinTimerInfo.pMac = pMac; |
| 13030 | pSession->ibssJoinTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13031 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerIbssJoining, csrRoamIbssJoinTimerHandler, |
| 13032 | &pSession->ibssJoinTimerInfo); |
| 13033 | if(!HAL_STATUS_SUCCESS(status)) |
| 13034 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13035 | smsLog(pMac, LOGE, FL("cannot allocate memory for IbssJoining timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13036 | break; |
| 13037 | } |
| 13038 | status = csrIssueAddStaForSessionReq ( pMac, i, pSelfMacAddr ); |
| 13039 | break; |
| 13040 | } |
| 13041 | } |
| 13042 | if( CSR_ROAM_SESSION_MAX == i ) |
| 13043 | { |
| 13044 | //No session is available |
| 13045 | status = eHAL_STATUS_RESOURCES; |
| 13046 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13047 | return ( status ); |
| 13048 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13049 | eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 13050 | { |
| 13051 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13052 | tListElem *pEntry = NULL; |
| 13053 | tSmeCmd *pCommand = NULL; |
| 13054 | tSirSmeDelStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13055 | do |
| 13056 | { |
| 13057 | if(pMsg == NULL) |
| 13058 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13059 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13060 | status = eHAL_STATUS_FAILURE; |
| 13061 | break; |
| 13062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13063 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 13064 | if(pEntry) |
| 13065 | { |
| 13066 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13067 | if(eSmeCommandDelStaSession == pCommand->command) |
| 13068 | { |
| 13069 | tANI_U8 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13070 | pRsp = (tSirSmeDelStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13071 | smsLog( pMac, LOG1, "Del Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13072 | //This session is done. |
| 13073 | csrCleanupSession(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13074 | if(pCommand->u.delStaSessionCmd.callback) |
| 13075 | { |
| 13076 | |
| 13077 | status = sme_ReleaseGlobalLock( &pMac->sme ); |
| 13078 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 13079 | { |
| 13080 | pCommand->u.delStaSessionCmd.callback( |
| 13081 | pCommand->u.delStaSessionCmd.pContext); |
| 13082 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 13083 | if (! HAL_STATUS_SUCCESS( status ) ) |
| 13084 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13085 | smsLog(pMac, LOGP, "%s: Failed to Acquire Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13086 | return status; |
| 13087 | } |
| 13088 | } |
| 13089 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13090 | smsLog(pMac, LOGE, "%s: Failed to Release Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13091 | } |
| 13092 | } |
| 13093 | |
| 13094 | //Remove this command out of the active list |
| 13095 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 13096 | { |
| 13097 | //Now put this command back on the avilable command list |
| 13098 | csrReleaseCommand(pMac, pCommand); |
| 13099 | } |
| 13100 | smeProcessPendingQueue( pMac ); |
| 13101 | } |
| 13102 | else |
| 13103 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13104 | 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] | 13105 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13106 | status = eHAL_STATUS_FAILURE; |
| 13107 | break; |
| 13108 | } |
| 13109 | } |
| 13110 | else |
| 13111 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13112 | 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] | 13113 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13114 | status = eHAL_STATUS_FAILURE; |
| 13115 | break; |
| 13116 | } |
| 13117 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13118 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13119 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13120 | eHalStatus csrSendMBDelSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 13121 | { |
| 13122 | tSirSmeDelStaSelfReq *pMsg; |
| 13123 | tANI_U16 msgLen; |
| 13124 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13125 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13126 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 13127 | sizeof( tSirBssType )*/; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13128 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 13129 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 13130 | |
| 13131 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13132 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_STA_SELF_REQ); |
| 13133 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13134 | // self station address |
| 13135 | palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13136 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13137 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13138 | return( status ); |
| 13139 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13140 | eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13141 | tSirMacAddr sessionMacAddr, |
| 13142 | csrRoamSessionCloseCallback callback, |
| 13143 | void *pContext) |
| 13144 | { |
| 13145 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13146 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13147 | pCommand = csrGetCommandBuffer(pMac); |
| 13148 | if(NULL == pCommand) |
| 13149 | { |
| 13150 | status = eHAL_STATUS_RESOURCES; |
| 13151 | } |
| 13152 | else |
| 13153 | { |
| 13154 | pCommand->command = eSmeCommandDelStaSession; |
| 13155 | pCommand->sessionId = (tANI_U8)sessionId; |
| 13156 | pCommand->u.delStaSessionCmd.callback = callback; |
| 13157 | pCommand->u.delStaSessionCmd.pContext = pContext; |
| 13158 | palCopyMemory( pMac->hHdd, pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13159 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 13160 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 13161 | { |
| 13162 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13163 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13164 | } |
| 13165 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13166 | return (status); |
| 13167 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13168 | eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 13169 | { |
| 13170 | return csrSendMBDelSelfStaReqMsg( pMac, |
| 13171 | pCommand->u.delStaSessionCmd.selfMacAddr ); |
| 13172 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13173 | static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13174 | { |
| 13175 | tDblLinkList *pList = &pMac->roam.roamCmdPendingList; |
| 13176 | tListElem *pEntry, *pNext; |
| 13177 | tSmeCmd *pCommand; |
| 13178 | tDblLinkList localList; |
| 13179 | |
| 13180 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 13181 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 13182 | { |
| 13183 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 13184 | return; |
| 13185 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13186 | csrLLLock(pList); |
| 13187 | pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK); |
| 13188 | while(pEntry != NULL) |
| 13189 | { |
| 13190 | pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK); |
| 13191 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13192 | if(pCommand->sessionId == sessionId) |
| 13193 | { |
| 13194 | if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK)) |
| 13195 | { |
| 13196 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 13197 | } |
| 13198 | } |
| 13199 | pEntry = pNext; |
| 13200 | } |
| 13201 | csrLLUnlock(pList); |
| 13202 | |
| 13203 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 13204 | { |
| 13205 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13206 | csrAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 13207 | } |
| 13208 | csrLLClose(&localList); |
| 13209 | } |
| 13210 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13211 | void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13212 | { |
| 13213 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 13214 | { |
| 13215 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13216 | csrRoamStop(pMac, sessionId); |
| 13217 | csrFreeConnectBssDesc(pMac, sessionId); |
| 13218 | csrRoamFreeConnectProfile( pMac, &pSession->connectedProfile ); |
| 13219 | csrRoamFreeConnectedInfo ( pMac, &pSession->connectedInfo); |
| 13220 | palTimerFree(pMac->hHdd, pSession->hTimerRoaming); |
| 13221 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 13222 | palTimerFree(pMac->hHdd, pSession->hTimerJoinRetry); |
| 13223 | #endif |
| 13224 | palTimerFree(pMac->hHdd, pSession->hTimerIbssJoining); |
| 13225 | purgeSmeSessionCmdList(pMac, sessionId); |
| 13226 | purgeCsrSessionCmdList(pMac, sessionId); |
| 13227 | csrInitSession(pMac, sessionId); |
| 13228 | } |
| 13229 | } |
| 13230 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13231 | eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13232 | tANI_BOOLEAN fSync, |
| 13233 | csrRoamSessionCloseCallback callback, |
| 13234 | void *pContext ) |
| 13235 | { |
| 13236 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13237 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 13238 | { |
| 13239 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13240 | if(fSync) |
| 13241 | { |
| 13242 | csrCleanupSession(pMac, sessionId); |
| 13243 | } |
| 13244 | else |
| 13245 | { |
| 13246 | purgeSmeSessionCmdList(pMac, sessionId); |
| 13247 | purgeCsrSessionCmdList(pMac, sessionId); |
| 13248 | status = csrIssueDelStaForSessionReq( pMac, sessionId, |
| 13249 | pSession->selfMacAddr, callback, pContext); |
| 13250 | } |
| 13251 | } |
| 13252 | else |
| 13253 | { |
| 13254 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 13255 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13256 | return ( status ); |
| 13257 | } |
| 13258 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13259 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 13260 | { |
| 13261 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13262 | |
| 13263 | if(!pSession) |
| 13264 | { |
| 13265 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13266 | return; |
| 13267 | } |
| 13268 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13269 | pSession->sessionActive = eANI_BOOLEAN_FALSE; |
| 13270 | pSession->sessionId = CSR_SESSION_ID_INVALID; |
| 13271 | pSession->callback = NULL; |
| 13272 | pSession->pContext = NULL; |
| 13273 | pSession->ibss_join_pending = FALSE; |
| 13274 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 13275 | // TODO : Confirm pMac->roam.fReadyForPowerSave = eANI_BOOLEAN_FALSE; |
| 13276 | csrFreeRoamProfile( pMac, sessionId ); |
| 13277 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 13278 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 13279 | csrFreeConnectBssDesc(pMac, sessionId); |
| 13280 | csrScanEnable(pMac); |
| 13281 | palZeroMemory( pMac->hHdd, &pSession->selfMacAddr, sizeof(tCsrBssid) ); |
| 13282 | if(pSession->pWpaRsnReqIE) |
| 13283 | { |
| 13284 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 13285 | pSession->pWpaRsnReqIE = NULL; |
| 13286 | } |
| 13287 | pSession->nWpaRsnReqIeLength = 0; |
| 13288 | if(pSession->pWpaRsnRspIE) |
| 13289 | { |
| 13290 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE); |
| 13291 | pSession->pWpaRsnRspIE = NULL; |
| 13292 | } |
| 13293 | pSession->nWpaRsnRspIeLength = 0; |
| 13294 | #ifdef FEATURE_WLAN_WAPI |
| 13295 | if(pSession->pWapiReqIE) |
| 13296 | { |
| 13297 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 13298 | pSession->pWapiReqIE = NULL; |
| 13299 | } |
| 13300 | pSession->nWapiReqIeLength = 0; |
| 13301 | if(pSession->pWapiRspIE) |
| 13302 | { |
| 13303 | palFreeMemory(pMac->hHdd, pSession->pWapiRspIE); |
| 13304 | pSession->pWapiRspIE = NULL; |
| 13305 | } |
| 13306 | pSession->nWapiRspIeLength = 0; |
| 13307 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13308 | if(pSession->pAddIEScan) |
| 13309 | { |
| 13310 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 13311 | pSession->pAddIEScan = NULL; |
| 13312 | } |
| 13313 | pSession->nAddIEScanLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13314 | if(pSession->pAddIEAssoc) |
| 13315 | { |
| 13316 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 13317 | pSession->pAddIEAssoc = NULL; |
| 13318 | } |
| 13319 | pSession->nAddIEAssocLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13320 | } |
| 13321 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13322 | eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId ) |
| 13323 | { |
| 13324 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13325 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13326 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13327 | { |
| 13328 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13329 | { |
| 13330 | if( csrIsMacAddressEqual( pMac, bssid, &pMac->roam.roamSession[i].connectedProfile.bssid ) ) |
| 13331 | { |
| 13332 | //Found it |
| 13333 | status = eHAL_STATUS_SUCCESS; |
| 13334 | *pSessionId = i; |
| 13335 | break; |
| 13336 | } |
| 13337 | } |
| 13338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13339 | return( status ); |
| 13340 | } |
| 13341 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13342 | //This function assumes that we only support one IBSS session. We cannot use BSSID to identify |
| 13343 | //session because for IBSS, the bssid changes. |
| 13344 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ) |
| 13345 | { |
| 13346 | tANI_U32 i, nRet = CSR_SESSION_ID_INVALID; |
| 13347 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13348 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13349 | { |
| 13350 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13351 | { |
| 13352 | pSession = CSR_GET_SESSION( pMac, i ); |
| 13353 | if( pSession->pCurRoamProfile && ( csrIsBssTypeIBSS( pSession->connectedProfile.BSSType ) ) ) |
| 13354 | { |
| 13355 | //Found it |
| 13356 | nRet = i; |
| 13357 | break; |
| 13358 | } |
| 13359 | } |
| 13360 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13361 | return (nRet); |
| 13362 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13363 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid) |
| 13364 | { |
| 13365 | /* Update the current BSS info in ho control block based on connected |
| 13366 | profile info from pmac global structure */ |
| 13367 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13368 | 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] | 13369 | bssid[ 0 ], bssid[ 1 ], bssid[ 2 ], |
| 13370 | bssid[ 3 ], bssid[ 4 ], bssid[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13371 | /* Check for user misconfig of RSSI trigger threshold */ |
| 13372 | pMac->roam.configParam.vccRssiThreshold = |
| 13373 | ( 0 == pMac->roam.configParam.vccRssiThreshold ) ? |
| 13374 | CSR_VCC_RSSI_THRESHOLD : pMac->roam.configParam.vccRssiThreshold; |
| 13375 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13376 | /* Check for user misconfig of UL MAC Loss trigger threshold */ |
| 13377 | pMac->roam.configParam.vccUlMacLossThreshold = |
| 13378 | ( 0 == pMac->roam.configParam.vccUlMacLossThreshold ) ? |
| 13379 | CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13380 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 13381 | { |
| 13382 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13383 | /* Indicate the neighbor roal algorithm about the connect indication */ |
| 13384 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId); |
| 13385 | csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS); |
| 13386 | } |
| 13387 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13388 | } |
| 13389 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13390 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13391 | { |
| 13392 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13393 | |
| 13394 | if(!pSession) |
| 13395 | { |
| 13396 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13397 | return; |
| 13398 | } |
| 13399 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13400 | //Only to handle the case for Handover on infra link |
| 13401 | if( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 13402 | { |
| 13403 | return; |
| 13404 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13405 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 13406 | csrRoamDeregStatisticsReq(pMac); |
| 13407 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 13408 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 13409 | /* Indicate the neighbor roal algorithm about the disconnect indication */ |
| 13410 | csrNeighborRoamIndicateDisconnect(pMac, sessionId); |
| 13411 | #endif |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 13412 | |
| 13413 | //Remove this code once SLM_Sessionization is supported |
| 13414 | //BMPS_WORKAROUND_NOT_NEEDED |
| 13415 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 13416 | csrIsInfraApStarted( pMac ) && |
| 13417 | pMac->roam.configParam.doBMPSWorkaround) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13418 | { |
| 13419 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 13420 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13421 | } |
| 13422 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13423 | void csrRoamTlStatsTimerHandler(void *pv) |
| 13424 | { |
| 13425 | tpAniSirGlobal pMac = PMAC_STRUCT( pv ); |
| 13426 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13427 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 13428 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13429 | smsLog(pMac, LOG1, FL(" TL stat timer is no-op. It needs to support multiple stations")); |
| 13430 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13431 | #if 0 |
| 13432 | // TODO Persession .??? |
| 13433 | //req TL for stats |
| 13434 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId)) |
| 13435 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13436 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:couldn't get the stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13437 | } |
| 13438 | else |
| 13439 | { |
| 13440 | //save in SME |
| 13441 | csrRoamSaveStatsFromTl(pMac, tlStats); |
| 13442 | } |
| 13443 | #endif |
| 13444 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 13445 | { |
| 13446 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 13447 | { |
| 13448 | //start timer |
| 13449 | status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 13450 | pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE); |
| 13451 | if(!HAL_STATUS_SUCCESS(status)) |
| 13452 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13453 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13454 | return; |
| 13455 | } |
| 13456 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 13457 | } |
| 13458 | } |
| 13459 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13460 | void csrRoamPeStatsTimerHandler(void *pv) |
| 13461 | { |
| 13462 | tCsrPeStatsReqInfo *pPeStatsReqListEntry = (tCsrPeStatsReqInfo *)pv; |
| 13463 | eHalStatus status; |
| 13464 | tpAniSirGlobal pMac = pPeStatsReqListEntry->pMac; |
| 13465 | VOS_STATUS vosStatus; |
| 13466 | tPmcPowerState powerState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13467 | pPeStatsReqListEntry->timerRunning = FALSE; |
| 13468 | if( pPeStatsReqListEntry->timerStopFailed == TRUE ) |
| 13469 | { |
| 13470 | // If we entered here, meaning the timer could not be successfully |
| 13471 | // stopped in csrRoamRemoveEntryFromPeStatsReqList(). So do it here. |
| 13472 | |
| 13473 | /* Destroy the timer */ |
| 13474 | vosStatus = vos_timer_destroy( &pPeStatsReqListEntry->hPeStatsTimer ); |
| 13475 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13476 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13477 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13478 | } |
| 13479 | |
| 13480 | // Free the entry |
| 13481 | palFreeMemory(pMac->hHdd, pPeStatsReqListEntry); |
| 13482 | pPeStatsReqListEntry = NULL; |
| 13483 | } |
| 13484 | else |
| 13485 | { |
| 13486 | if(!pPeStatsReqListEntry->rspPending) |
| 13487 | { |
| 13488 | status = csrSendMBStatsReqMsg(pMac, pPeStatsReqListEntry->statsMask & ~(1 << eCsrGlobalClassDStats), |
| 13489 | pPeStatsReqListEntry->staId); |
| 13490 | if(!HAL_STATUS_SUCCESS(status)) |
| 13491 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13492 | 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] | 13493 | } |
| 13494 | else |
| 13495 | { |
| 13496 | pPeStatsReqListEntry->rspPending = TRUE; |
| 13497 | } |
| 13498 | } |
| 13499 | |
| 13500 | //send down a req |
| 13501 | if(pPeStatsReqListEntry->periodicity && |
| 13502 | (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pPeStatsReqListEntry->hPeStatsTimer))) |
| 13503 | { |
| 13504 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 13505 | if(ePMC_FULL_POWER == powerState) |
| 13506 | { |
| 13507 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 13508 | { |
| 13509 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 13510 | } |
| 13511 | } |
| 13512 | else |
| 13513 | { |
| 13514 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 13515 | { |
| 13516 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 13517 | } |
| 13518 | } |
| 13519 | //start timer |
| 13520 | vosStatus = vos_timer_start( &pPeStatsReqListEntry->hPeStatsTimer, pPeStatsReqListEntry->periodicity ); |
| 13521 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13522 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13523 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13524 | return; |
| 13525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13526 | pPeStatsReqListEntry->timerRunning = TRUE; |
| 13527 | |
| 13528 | } |
| 13529 | |
| 13530 | } |
| 13531 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13532 | void csrRoamStatsClientTimerHandler(void *pv) |
| 13533 | { |
| 13534 | tCsrStatsClientReqInfo *pStaEntry = (tCsrStatsClientReqInfo *)pv; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13535 | if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pStaEntry->timer)) |
| 13536 | { |
| 13537 | #if 0 |
| 13538 | // TODO Stats fix for multisession |
| 13539 | //start the timer |
| 13540 | vosStatus = vos_timer_start( &pStaEntry->timer, pStaEntry->periodicity ); |
| 13541 | |
| 13542 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13543 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13544 | smsLog(pStaEntry->pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13545 | } |
| 13546 | #endif |
| 13547 | } |
| 13548 | #if 0 |
| 13549 | //send up the stats report |
| 13550 | csrRoamReportStatistics(pStaEntry->pMac, pStaEntry->statsMask, pStaEntry->callback, |
| 13551 | pStaEntry->staId, pStaEntry->pContext); |
| 13552 | #endif |
| 13553 | } |
| 13554 | |
| 13555 | |
| 13556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13557 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId) |
| 13558 | { |
| 13559 | tAniGetPEStatsReq *pMsg; |
| 13560 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13561 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetPEStatsReq)); |
| 13562 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 13563 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13564 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to allocate mem for stats req "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13565 | return status; |
| 13566 | } |
| 13567 | // need to initiate a stats request to PE |
| 13568 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_STATISTICS_REQ); |
| 13569 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq); |
| 13570 | pMsg->staId = staId; |
| 13571 | pMsg->statsMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13572 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13573 | if(!HAL_STATUS_SUCCESS(status)) |
| 13574 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13575 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to send down the stats req "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13576 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13577 | return status; |
| 13578 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13579 | void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg) |
| 13580 | { |
| 13581 | tAniGetPEStatsRsp *pSmeStatsRsp; |
| 13582 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13583 | tListElem *pEntry = NULL; |
| 13584 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 13585 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 13586 | tANI_U32 tempMask = 0; |
| 13587 | tANI_U8 counter = 0; |
| 13588 | tANI_U8 *pStats = NULL; |
| 13589 | tANI_U32 length = 0; |
| 13590 | v_PVOID_t pvosGCtx; |
| 13591 | v_S7_t rssi = 0; |
| 13592 | tANI_U32 *pRssi = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13593 | pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg; |
| 13594 | if(pSmeStatsRsp->rc) |
| 13595 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13596 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:stats rsp from PE shows failure")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13597 | goto post_update; |
| 13598 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13599 | tempMask = pSmeStatsRsp->statsMask; |
| 13600 | pStats = ((tANI_U8 *)&pSmeStatsRsp->statsMask) + sizeof(pSmeStatsRsp->statsMask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13601 | /* subtract all statistics from this length, and after processing the entire |
| 13602 | * 'stat' part of the message, if the length is not zero, then rssi is piggy packed |
| 13603 | * in this 'stats' message. |
| 13604 | */ |
| 13605 | length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13606 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 13607 | while(tempMask) |
| 13608 | { |
| 13609 | if(tempMask & 1) |
| 13610 | { |
| 13611 | switch(counter) |
| 13612 | { |
| 13613 | case eCsrSummaryStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13614 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13615 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 13616 | pStats, sizeof(tCsrSummaryStatsInfo)); |
| 13617 | if(!HAL_STATUS_SUCCESS(status)) |
| 13618 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13619 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13620 | } |
| 13621 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 13622 | length -= sizeof(tCsrSummaryStatsInfo); |
| 13623 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13624 | case eCsrGlobalClassAStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13625 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13626 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 13627 | pStats, sizeof(tCsrGlobalClassAStatsInfo)); |
| 13628 | if(!HAL_STATUS_SUCCESS(status)) |
| 13629 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13630 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13631 | } |
| 13632 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
| 13633 | length -= sizeof(tCsrGlobalClassAStatsInfo); |
| 13634 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13635 | case eCsrGlobalClassBStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13636 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13637 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 13638 | pStats, sizeof(tCsrGlobalClassBStatsInfo)); |
| 13639 | if(!HAL_STATUS_SUCCESS(status)) |
| 13640 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13641 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13642 | } |
| 13643 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
| 13644 | length -= sizeof(tCsrGlobalClassBStatsInfo); |
| 13645 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13646 | case eCsrGlobalClassCStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13647 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13648 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 13649 | pStats, sizeof(tCsrGlobalClassCStatsInfo)); |
| 13650 | if(!HAL_STATUS_SUCCESS(status)) |
| 13651 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13652 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13653 | } |
| 13654 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
| 13655 | length -= sizeof(tCsrGlobalClassCStatsInfo); |
| 13656 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13657 | case eCsrPerStaStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13658 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13659 | if( CSR_MAX_STA > pSmeStatsRsp->staId ) |
| 13660 | { |
| 13661 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId], |
| 13662 | pStats, sizeof(tCsrPerStaStatsInfo)); |
| 13663 | } |
| 13664 | else |
| 13665 | { |
| 13666 | status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13667 | smsLog( pMac, LOGE, FL("csrRoamStatsRspProcessor:out bound staId:%d"), pSmeStatsRsp->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13668 | VOS_ASSERT( 0 ); |
| 13669 | } |
| 13670 | if(!HAL_STATUS_SUCCESS(status)) |
| 13671 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13672 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13673 | } |
| 13674 | pStats += sizeof(tCsrPerStaStatsInfo); |
| 13675 | length -= sizeof(tCsrPerStaStatsInfo); |
| 13676 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13677 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13678 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13679 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13680 | } |
| 13681 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13682 | tempMask >>=1; |
| 13683 | counter++; |
| 13684 | } |
| 13685 | pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 13686 | if (length != 0) |
| 13687 | { |
| 13688 | pRssi = (tANI_U32*)pStats; |
| 13689 | rssi = (v_S7_t)*pRssi; |
| 13690 | } |
| 13691 | else |
| 13692 | { |
| 13693 | /* If riva is not sending rssi, continue to use the hack */ |
| 13694 | rssi = RSSI_HACK_BMPS; |
| 13695 | } |
| 13696 | WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13697 | post_update: |
| 13698 | //make sure to update the pe stats req list |
| 13699 | pEntry = csrRoamFindInPeStatsReqList(pMac, pSmeStatsRsp->statsMask); |
| 13700 | if(pEntry) |
| 13701 | { |
| 13702 | pPeStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
| 13703 | pPeStaEntry->rspPending = FALSE; |
| 13704 | |
| 13705 | } |
| 13706 | //check the one timer cases |
| 13707 | pEntry = csrRoamCheckClientReqList(pMac, pSmeStatsRsp->statsMask); |
| 13708 | if(pEntry) |
| 13709 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13710 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13711 | if(pTempStaEntry->timerExpired) |
| 13712 | { |
| 13713 | //send up the stats report |
| 13714 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 13715 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 13716 | //also remove from the client list |
| 13717 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 13718 | pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13719 | } |
| 13720 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13721 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13722 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 13723 | { |
| 13724 | tListElem *pEntry = NULL; |
| 13725 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13726 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13727 | if(!pEntry) |
| 13728 | { |
| 13729 | //list empty |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13730 | smsLog(pMac, LOG2, "csrRoamFindInPeStatsReqList: List empty, no request to PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13731 | return NULL; |
| 13732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13733 | while( pEntry ) |
| 13734 | { |
| 13735 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13736 | if(pTempStaEntry->statsMask == statsMask) |
| 13737 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13738 | smsLog(pMac, LOG3, "csrRoamFindInPeStatsReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13739 | break; |
| 13740 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13741 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13742 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13743 | return pEntry; |
| 13744 | } |
| 13745 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13746 | tListElem * csrRoamChecknUpdateClientReqList(tpAniSirGlobal pMac, tCsrStatsClientReqInfo *pStaEntry, |
| 13747 | tANI_BOOLEAN update) |
| 13748 | { |
| 13749 | tListElem *pEntry; |
| 13750 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13751 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13752 | if(!pEntry) |
| 13753 | { |
| 13754 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13755 | smsLog(pMac, LOG2, "csrRoamChecknUpdateClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13756 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13757 | return NULL; |
| 13758 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13759 | while( pEntry ) |
| 13760 | { |
| 13761 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13762 | if((pTempStaEntry->requesterId == pStaEntry->requesterId) && |
| 13763 | (pTempStaEntry->statsMask == pStaEntry->statsMask)) |
| 13764 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13765 | smsLog(pMac, LOG3, "csrRoamChecknUpdateClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13766 | if(update) |
| 13767 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13768 | pTempStaEntry->periodicity = pStaEntry->periodicity; |
| 13769 | pTempStaEntry->callback = pStaEntry->callback; |
| 13770 | pTempStaEntry->pContext = pStaEntry->pContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13771 | } |
| 13772 | break; |
| 13773 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13774 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13775 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13776 | return pEntry; |
| 13777 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13778 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 13779 | { |
| 13780 | tListElem *pEntry; |
| 13781 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13782 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13783 | if(!pEntry) |
| 13784 | { |
| 13785 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13786 | smsLog(pMac, LOG2, "csrRoamCheckClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13787 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13788 | return NULL; |
| 13789 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13790 | while( pEntry ) |
| 13791 | { |
| 13792 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13793 | if((pTempStaEntry->statsMask & ~(1 << eCsrGlobalClassDStats)) == statsMask) |
| 13794 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13795 | smsLog(pMac, LOG3, "csrRoamCheckClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13796 | break; |
| 13797 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13798 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13799 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13800 | return pEntry; |
| 13801 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13802 | eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac, |
| 13803 | csrRoamLinkQualityIndCallback callback, |
| 13804 | void *pContext) |
| 13805 | { |
| 13806 | pMac->roam.linkQualityIndInfo.callback = callback; |
| 13807 | pMac->roam.linkQualityIndInfo.context = pContext; |
| 13808 | if( NULL == callback ) |
| 13809 | { |
| 13810 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being deregistered"); |
| 13811 | } |
| 13812 | else |
| 13813 | { |
| 13814 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being registered"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13815 | /* do we need to invoke the callback to notify client of initial value ?? */ |
| 13816 | } |
| 13817 | return eHAL_STATUS_SUCCESS; |
| 13818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13819 | void csrRoamVccTrigger(tpAniSirGlobal pMac) |
| 13820 | { |
| 13821 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 13822 | tANI_U32 ul_mac_loss = 0; |
| 13823 | tANI_U32 ul_mac_loss_trigger_threshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13824 | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 13825 | /*------------------------------------------------------------------------- |
| 13826 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13827 | Check for a change in link quality and notify client if necessary |
| 13828 | -------------------------------------------------------------------------*/ |
| 13829 | ul_mac_loss_trigger_threshold = |
| 13830 | pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13831 | VOS_ASSERT( ul_mac_loss_trigger_threshold != 0 ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13832 | smsLog(pMac, LOGW, "csrRoamVccTrigger: UL_MAC_LOSS_THRESHOLD is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13833 | ul_mac_loss_trigger_threshold ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13834 | if(ul_mac_loss_trigger_threshold < ul_mac_loss) |
| 13835 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13836 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is POOR "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13837 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 13838 | } |
| 13839 | else |
| 13840 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13841 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is GOOD"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13842 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 13843 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13844 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link qual : *** UL_MAC_LOSS %d *** ", |
| 13845 | ul_mac_loss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13846 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 13847 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13848 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13849 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 13850 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13851 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13852 | newVccLinkQuality ); |
| 13853 | |
| 13854 | /* we now invoke the callback once to notify client of initial value */ |
| 13855 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 13856 | pMac->roam.linkQualityIndInfo.context ); |
| 13857 | //event: EVENT_WLAN_VCC |
| 13858 | } |
| 13859 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13860 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
| 13861 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13862 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13863 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 13864 | v_U8_t rssiNotification, |
| 13865 | void * context) |
| 13866 | { |
| 13867 | tpAniSirGlobal pMac = PMAC_STRUCT( context ); |
| 13868 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 13869 | // TODO : Session info unavailable |
| 13870 | tANI_U32 sessionId = 0; |
| 13871 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 13872 | /*------------------------------------------------------------------------- |
| 13873 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13874 | Check for a change in link quality and notify client if necessary |
| 13875 | -------------------------------------------------------------------------*/ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13876 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: RSSI trigger threshold is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13877 | pMac->roam.configParam.vccRssiThreshold); |
| 13878 | if(!csrIsConnStateConnectedInfra(pMac, sessionId)) |
| 13879 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13880 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: ignoring the indication as we are not connected"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13881 | return VOS_STATUS_SUCCESS; |
| 13882 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13883 | if(WLANTL_HO_THRESHOLD_DOWN == rssiNotification) |
| 13884 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13885 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is POOR"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13886 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 13887 | } |
| 13888 | else if(WLANTL_HO_THRESHOLD_UP == rssiNotification) |
| 13889 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13890 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is GOOD "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13891 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 13892 | } |
| 13893 | else |
| 13894 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13895 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: unknown rssi notification %d", rssiNotification); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13896 | //Set to this so the code below won't do anything |
| 13897 | newVccLinkQuality = pMac->roam.vccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13898 | VOS_ASSERT(0); |
| 13899 | } |
| 13900 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13901 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 13902 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13903 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13904 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 13905 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13906 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13907 | newVccLinkQuality); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13908 | /* we now invoke the callback once to notify client of initial value */ |
| 13909 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 13910 | pMac->roam.linkQualityIndInfo.context ); |
| 13911 | //event: EVENT_WLAN_VCC |
| 13912 | } |
| 13913 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13914 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13915 | return status; |
| 13916 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13917 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 13918 | tDblLinkList *pStaList, |
| 13919 | tCsrStatsClientReqInfo *pStaEntry) |
| 13920 | { |
| 13921 | tCsrStatsClientReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13922 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13923 | //if same entity requested for same set of stats with different periodicity & |
| 13924 | // callback update it |
| 13925 | if(NULL == csrRoamChecknUpdateClientReqList(pMac, pStaEntry, TRUE)) |
| 13926 | { |
| 13927 | |
| 13928 | status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrStatsClientReqInfo)); |
| 13929 | if (!HAL_STATUS_SUCCESS(status)) |
| 13930 | { |
| 13931 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13932 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13933 | return NULL; |
| 13934 | } |
| 13935 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13936 | pNewStaEntry->callback = pStaEntry->callback; |
| 13937 | pNewStaEntry->pContext = pStaEntry->pContext; |
| 13938 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 13939 | pNewStaEntry->requesterId = pStaEntry->requesterId; |
| 13940 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 13941 | pNewStaEntry->pPeStaEntry = pStaEntry->pPeStaEntry; |
| 13942 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 13943 | pNewStaEntry->staId = pStaEntry->staId; |
| 13944 | pNewStaEntry->timerExpired = pStaEntry->timerExpired; |
| 13945 | |
| 13946 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
| 13947 | } |
| 13948 | return pNewStaEntry; |
| 13949 | } |
| 13950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13951 | tCsrPeStatsReqInfo * csrRoamInsertEntryIntoPeStatsReqList( tpAniSirGlobal pMac, |
| 13952 | tDblLinkList *pStaList, |
| 13953 | tCsrPeStatsReqInfo *pStaEntry) |
| 13954 | { |
| 13955 | tCsrPeStatsReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13956 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13957 | status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrPeStatsReqInfo)); |
| 13958 | if (!HAL_STATUS_SUCCESS(status)) |
| 13959 | { |
| 13960 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoPeStatsReqList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13961 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13962 | return NULL; |
| 13963 | } |
| 13964 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13965 | pNewStaEntry->hPeStatsTimer = pStaEntry->hPeStatsTimer; |
| 13966 | pNewStaEntry->numClient = pStaEntry->numClient; |
| 13967 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 13968 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 13969 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 13970 | pNewStaEntry->staId = pStaEntry->staId; |
| 13971 | pNewStaEntry->timerRunning = pStaEntry->timerRunning; |
| 13972 | pNewStaEntry->rspPending = pStaEntry->rspPending; |
| 13973 | |
| 13974 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13975 | return pNewStaEntry; |
| 13976 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13977 | eHalStatus csrGetRssi(tpAniSirGlobal pMac, |
| 13978 | tCsrRssiCallback callback, |
| 13979 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 13980 | { |
| 13981 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13982 | vos_msg_t msg; |
| 13983 | tANI_U32 sessionId; |
| 13984 | |
| 13985 | tAniGetRssiReq *pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13986 | smsLog(pMac, LOG2, FL("called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13987 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetRssiReq)); |
| 13988 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 13989 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13990 | smsLog(pMac, LOGE, " csrGetRssi: failed to allocate mem for req "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13991 | return status; |
| 13992 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13993 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 13994 | |
| 13995 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_RSSI_REQ); |
| 13996 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 13997 | pMsg->sessionId = sessionId; |
| 13998 | pMsg->staId = staId; |
| 13999 | pMsg->rssiCallback = callback; |
| 14000 | pMsg->pDevContext = pContext; |
| 14001 | pMsg->pVosContext = pVosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14002 | msg.type = eWNI_SME_GET_RSSI_REQ; |
| 14003 | msg.bodyptr = pMsg; |
| 14004 | msg.reserved = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14005 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 14006 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14007 | smsLog(pMac, LOGE, " csrGetRssi failed to post msg to self "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14008 | palFreeMemory(pMac->hHdd, (void *)pMsg); |
| 14009 | status = eHAL_STATUS_FAILURE; |
| 14010 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14011 | smsLog(pMac, LOG2, FL("returned")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14012 | return status; |
| 14013 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 14014 | |
| 14015 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 14016 | eHalStatus csrGetRoamRssi(tpAniSirGlobal pMac, |
| 14017 | tCsrRssiCallback callback, |
| 14018 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 14019 | { |
| 14020 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14021 | tAniGetRssiReq *pMsg; |
| 14022 | |
| 14023 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetRssiReq)); |
| 14024 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 14025 | { |
| 14026 | smsLog(pMac, LOGE, " csrGetRoamRssi: failed to allocate mem for req"); |
| 14027 | return status; |
| 14028 | } |
| 14029 | // need to initiate a stats request to PE |
| 14030 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_ROAM_RSSI_REQ); |
| 14031 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 14032 | pMsg->staId = staId; |
| 14033 | pMsg->rssiCallback = callback; |
| 14034 | pMsg->pDevContext = pContext; |
| 14035 | pMsg->pVosContext = pVosContext; |
| 14036 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 14037 | if(!HAL_STATUS_SUCCESS(status)) |
| 14038 | { |
| 14039 | smsLog(pMac, LOG1, " csrGetRoamRssi: failed to send down the stats req"); |
| 14040 | palFreeMemory(pMac->hHdd, (void *)pMsg); |
| 14041 | status = eHAL_STATUS_FAILURE; |
| 14042 | } |
| 14043 | return status; |
| 14044 | } |
| 14045 | #endif |
| 14046 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14047 | eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, |
| 14048 | tANI_U32 statsMask, |
| 14049 | tCsrStatsCallback callback, |
| 14050 | tANI_U32 periodicity, tANI_BOOLEAN cache, |
| 14051 | tANI_U8 staId, void *pContext) |
| 14052 | { |
| 14053 | tCsrStatsClientReqInfo staEntry; |
| 14054 | tCsrStatsClientReqInfo *pStaEntry = NULL; |
| 14055 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 14056 | tListElem *pEntry = NULL; |
| 14057 | tANI_BOOLEAN found = FALSE; |
| 14058 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14059 | tANI_BOOLEAN insertInClientList = FALSE; |
| 14060 | VOS_STATUS vosStatus; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14061 | WLANTL_TRANSFER_STA_TYPE *pTlStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14062 | |
| 14063 | if( csrIsAllSessionDisconnected(pMac) ) |
| 14064 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14065 | //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] | 14066 | return eHAL_STATUS_FAILURE; |
| 14067 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14068 | if((!statsMask) && (!callback)) |
| 14069 | { |
| 14070 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14071 | smsLog(pMac, LOGW, "csrGetStatistics: statsMask & callback empty in the request"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14072 | return eHAL_STATUS_FAILURE; |
| 14073 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14074 | //for the search list method for deregister |
| 14075 | staEntry.requesterId = requesterId; |
| 14076 | staEntry.statsMask = statsMask; |
| 14077 | //requester wants to deregister or just an error |
| 14078 | if((statsMask) && (!callback)) |
| 14079 | { |
| 14080 | pEntry = csrRoamChecknUpdateClientReqList(pMac, &staEntry, FALSE); |
| 14081 | if(!pEntry) |
| 14082 | { |
| 14083 | //msg |
| 14084 | 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] | 14085 | "find any existing request in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14086 | return eHAL_STATUS_FAILURE; |
| 14087 | } |
| 14088 | else |
| 14089 | { |
| 14090 | //clean up & return |
| 14091 | pStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 14092 | if(NULL != pStaEntry->pPeStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14093 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14094 | pStaEntry->pPeStaEntry->numClient--; |
| 14095 | //check if we need to delete the entry from peStatsReqList too |
| 14096 | if(!pStaEntry->pPeStaEntry->numClient) |
| 14097 | { |
| 14098 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pStaEntry->pPeStaEntry); |
| 14099 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14100 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 14101 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14102 | //check if we need to stop the tl stats timer too |
| 14103 | pMac->roam.tlStatsReqInfo.numClient--; |
| 14104 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 14105 | { |
| 14106 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 14107 | { |
| 14108 | status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 14109 | if(!HAL_STATUS_SUCCESS(status)) |
| 14110 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14111 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14112 | return eHAL_STATUS_FAILURE; |
| 14113 | } |
| 14114 | } |
| 14115 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 14116 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 14117 | } |
| 14118 | vos_timer_stop( &pStaEntry->timer ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14119 | // Destroy the vos timer... |
| 14120 | vosStatus = vos_timer_destroy( &pStaEntry->timer ); |
| 14121 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14122 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14123 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14124 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14125 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 14126 | pStaEntry = NULL; |
| 14127 | return eHAL_STATUS_SUCCESS; |
| 14128 | } |
| 14129 | } |
| 14130 | |
| 14131 | if(cache && !periodicity) |
| 14132 | { |
| 14133 | //return the cached stats |
| 14134 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 14135 | } |
| 14136 | else |
| 14137 | { |
| 14138 | //add the request in the client req list |
| 14139 | staEntry.callback = callback; |
| 14140 | staEntry.pContext = pContext; |
| 14141 | staEntry.periodicity = periodicity; |
| 14142 | staEntry.pPeStaEntry = NULL; |
| 14143 | staEntry.staId = staId; |
| 14144 | staEntry.pMac = pMac; |
| 14145 | staEntry.timerExpired = FALSE; |
| 14146 | |
| 14147 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14148 | //if periodic report requested with non cached result from PE/TL |
| 14149 | if(periodicity) |
| 14150 | { |
| 14151 | |
| 14152 | //if looking for stats from PE |
| 14153 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 14154 | { |
| 14155 | |
| 14156 | //check if same request made already & waiting for rsp |
| 14157 | pPeStaEntry = csrRoamCheckPeStatsReqList(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), |
| 14158 | periodicity, &found, staId); |
| 14159 | if(!pPeStaEntry) |
| 14160 | { |
| 14161 | //bail out, maxed out on number of req for PE |
| 14162 | return eHAL_STATUS_FAILURE; |
| 14163 | } |
| 14164 | else |
| 14165 | { |
| 14166 | staEntry.pPeStaEntry = pPeStaEntry; |
| 14167 | } |
| 14168 | |
| 14169 | } |
| 14170 | //request stats from TL rightaway if requested by client, update tlStatsReqInfo if needed |
| 14171 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 14172 | { |
| 14173 | if(cache && pMac->roam.tlStatsReqInfo.numClient) |
| 14174 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14175 | smsLog(pMac, LOGE, FL("csrGetStatistics:Looking for cached stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14176 | } |
| 14177 | else |
| 14178 | { |
| 14179 | |
| 14180 | //update periodicity |
| 14181 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 14182 | { |
| 14183 | pMac->roam.tlStatsReqInfo.periodicity = |
| 14184 | CSR_ROAM_MIN(periodicity, pMac->roam.tlStatsReqInfo.periodicity); |
| 14185 | } |
| 14186 | else |
| 14187 | { |
| 14188 | pMac->roam.tlStatsReqInfo.periodicity = periodicity; |
| 14189 | } |
| 14190 | if(pMac->roam.tlStatsReqInfo.periodicity < CSR_MIN_TL_STAT_QUERY_PERIOD) |
| 14191 | { |
| 14192 | pMac->roam.tlStatsReqInfo.periodicity = CSR_MIN_TL_STAT_QUERY_PERIOD; |
| 14193 | } |
| 14194 | |
| 14195 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 14196 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14197 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 14198 | if(NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14199 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14200 | //req TL for class D stats |
| 14201 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId)) |
| 14202 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14203 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14204 | } |
| 14205 | else |
| 14206 | { |
| 14207 | //save in SME |
| 14208 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 14209 | } |
| 14210 | vos_mem_free(pTlStats); |
| 14211 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14212 | } |
| 14213 | else |
| 14214 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14215 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14216 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14217 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14218 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 14219 | { |
| 14220 | //start timer |
| 14221 | status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 14222 | pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE); |
| 14223 | if(!HAL_STATUS_SUCCESS(status)) |
| 14224 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14225 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14226 | return eHAL_STATUS_FAILURE; |
| 14227 | } |
| 14228 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 14229 | } |
| 14230 | } |
| 14231 | } |
| 14232 | pMac->roam.tlStatsReqInfo.numClient++; |
| 14233 | } |
| 14234 | |
| 14235 | insertInClientList = TRUE; |
| 14236 | } |
| 14237 | //if one time report requested with non cached result from PE/TL |
| 14238 | else if(!cache && !periodicity) |
| 14239 | { |
| 14240 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 14241 | { |
| 14242 | //send down a req |
| 14243 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 14244 | if(!HAL_STATUS_SUCCESS(status)) |
| 14245 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14246 | 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] | 14247 | } |
| 14248 | //so that when the stats rsp comes back from PE we respond to upper layer |
| 14249 | //right away |
| 14250 | staEntry.timerExpired = TRUE; |
| 14251 | insertInClientList = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14252 | } |
| 14253 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 14254 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14255 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 14256 | if(NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14257 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14258 | //req TL for class D stats |
| 14259 | if(!VOS_IS_STATUS_SUCCESS(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId))) |
| 14260 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14261 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14262 | } |
| 14263 | else |
| 14264 | { |
| 14265 | //save in SME |
| 14266 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 14267 | } |
| 14268 | vos_mem_free(pTlStats); |
| 14269 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14270 | } |
| 14271 | else |
| 14272 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14273 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14274 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14275 | |
| 14276 | } |
| 14277 | //if looking for stats from TL only |
| 14278 | if(!insertInClientList) |
| 14279 | { |
| 14280 | //return the stats |
| 14281 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 14282 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14283 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14284 | if(insertInClientList) |
| 14285 | { |
| 14286 | pStaEntry = csrRoamInsertEntryIntoList(pMac, &pMac->roam.statsClientReqList, &staEntry); |
| 14287 | if(!pStaEntry) |
| 14288 | { |
| 14289 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14290 | smsLog(pMac, LOGW, "csrGetStatistics: Failed to insert req in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14291 | return eHAL_STATUS_FAILURE; |
| 14292 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14293 | pStaEntry->periodicity = periodicity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14294 | //Init & start timer if needed |
| 14295 | if(periodicity) |
| 14296 | { |
| 14297 | vosStatus = vos_timer_init( &pStaEntry->timer, VOS_TIMER_TYPE_SW, |
| 14298 | csrRoamStatsClientTimerHandler, pStaEntry ); |
| 14299 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14300 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14301 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot init StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14302 | return eHAL_STATUS_FAILURE; |
| 14303 | } |
| 14304 | vosStatus = vos_timer_start( &pStaEntry->timer, periodicity ); |
| 14305 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14306 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14307 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14308 | return eHAL_STATUS_FAILURE; |
| 14309 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14310 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14311 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14312 | } |
| 14313 | return eHAL_STATUS_SUCCESS; |
| 14314 | } |
| 14315 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14316 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 14317 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId) |
| 14318 | { |
| 14319 | tANI_BOOLEAN found = FALSE; |
| 14320 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14321 | tCsrPeStatsReqInfo staEntry; |
| 14322 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
| 14323 | tListElem *pStaEntry = NULL; |
| 14324 | VOS_STATUS vosStatus; |
| 14325 | tPmcPowerState powerState; |
| 14326 | *pFound = FALSE; |
| 14327 | |
| 14328 | pStaEntry = csrRoamFindInPeStatsReqList(pMac, statsMask); |
| 14329 | if(pStaEntry) |
| 14330 | { |
| 14331 | pTempStaEntry = GET_BASE_ADDR( pStaEntry, tCsrPeStatsReqInfo, link ); |
| 14332 | if(pTempStaEntry->periodicity) |
| 14333 | { |
| 14334 | pTempStaEntry->periodicity = |
| 14335 | CSR_ROAM_MIN(periodicity, pTempStaEntry->periodicity); |
| 14336 | } |
| 14337 | else |
| 14338 | { |
| 14339 | pTempStaEntry->periodicity = periodicity; |
| 14340 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14341 | pTempStaEntry->numClient++; |
| 14342 | found = TRUE; |
| 14343 | } |
| 14344 | else |
| 14345 | { |
| 14346 | palZeroMemory(pMac->hHdd, &staEntry, sizeof(tCsrPeStatsReqInfo)); |
| 14347 | staEntry.numClient = 1; |
| 14348 | staEntry.periodicity = periodicity; |
| 14349 | staEntry.pMac = pMac; |
| 14350 | staEntry.rspPending = FALSE; |
| 14351 | staEntry.staId = staId; |
| 14352 | staEntry.statsMask = statsMask; |
| 14353 | staEntry.timerRunning = FALSE; |
| 14354 | pTempStaEntry = csrRoamInsertEntryIntoPeStatsReqList(pMac, &pMac->roam.peStatsReqList, &staEntry); |
| 14355 | if(!pTempStaEntry) |
| 14356 | { |
| 14357 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14358 | smsLog(pMac, LOGW, "csrRoamCheckPeStatsReqList: Failed to insert req in peStatsReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14359 | return NULL; |
| 14360 | } |
| 14361 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14362 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 14363 | if(ePMC_FULL_POWER == powerState) |
| 14364 | { |
| 14365 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 14366 | { |
| 14367 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 14368 | } |
| 14369 | } |
| 14370 | else |
| 14371 | { |
| 14372 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 14373 | { |
| 14374 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 14375 | } |
| 14376 | } |
| 14377 | if(!pTempStaEntry->timerRunning) |
| 14378 | { |
| 14379 | //send down a req in case of one time req, for periodic ones wait for timer to expire |
| 14380 | if(!pTempStaEntry->rspPending && |
| 14381 | !pTempStaEntry->periodicity) |
| 14382 | { |
| 14383 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 14384 | if(!HAL_STATUS_SUCCESS(status)) |
| 14385 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14386 | 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] | 14387 | } |
| 14388 | else |
| 14389 | { |
| 14390 | pTempStaEntry->rspPending = TRUE; |
| 14391 | } |
| 14392 | } |
| 14393 | if(pTempStaEntry->periodicity) |
| 14394 | { |
| 14395 | if(!found) |
| 14396 | { |
| 14397 | |
| 14398 | vosStatus = vos_timer_init( &pTempStaEntry->hPeStatsTimer, VOS_TIMER_TYPE_SW, |
| 14399 | csrRoamPeStatsTimerHandler, pTempStaEntry ); |
| 14400 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14401 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14402 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot init hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14403 | return NULL; |
| 14404 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14405 | } |
| 14406 | //start timer |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14407 | smsLog(pMac, LOG1, "csrRoamCheckPeStatsReqList:peStatsTimer period %d", pTempStaEntry->periodicity); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14408 | vosStatus = vos_timer_start( &pTempStaEntry->hPeStatsTimer, pTempStaEntry->periodicity ); |
| 14409 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14410 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14411 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14412 | return NULL; |
| 14413 | } |
| 14414 | pTempStaEntry->timerRunning = TRUE; |
| 14415 | } |
| 14416 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14417 | *pFound = found; |
| 14418 | return pTempStaEntry; |
| 14419 | } |
| 14420 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14421 | /* |
| 14422 | pStaEntry is no longer invalid upon the return of this function. |
| 14423 | */ |
| 14424 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry) |
| 14425 | { |
| 14426 | if(pEntry) |
| 14427 | { |
| 14428 | if(csrLLRemoveEntry(&pMac->roam.statsClientReqList, pEntry, LL_ACCESS_LOCK)) |
| 14429 | { |
| 14430 | palFreeMemory(pMac->hHdd, GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14431 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14432 | } |
| 14433 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14434 | |
| 14435 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry) |
| 14436 | { |
| 14437 | tListElem *pEntry; |
| 14438 | tCsrPeStatsReqInfo *pTempStaEntry; |
| 14439 | VOS_STATUS vosStatus; |
| 14440 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14441 | if(!pEntry) |
| 14442 | { |
| 14443 | //list empty |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14444 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: List empty, no stats req for PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14445 | return; |
| 14446 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14447 | while( pEntry ) |
| 14448 | { |
| 14449 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14450 | if( pTempStaEntry && pTempStaEntry->statsMask == pPeStaEntry->statsMask) |
| 14451 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14452 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14453 | if(pTempStaEntry->timerRunning) |
| 14454 | { |
| 14455 | vosStatus = vos_timer_stop( &pTempStaEntry->hPeStatsTimer ); |
| 14456 | /* If we are not able to stop the timer here, just remove |
| 14457 | * the entry from the linked list. Destroy the timer object |
| 14458 | * and free the memory in the timer CB |
| 14459 | */ |
| 14460 | if( vosStatus == VOS_STATUS_SUCCESS ) |
| 14461 | { |
| 14462 | /* the timer is successfully stopped */ |
| 14463 | pTempStaEntry->timerRunning = FALSE; |
| 14464 | |
| 14465 | /* Destroy the timer */ |
| 14466 | vosStatus = vos_timer_destroy( &pTempStaEntry->hPeStatsTimer ); |
| 14467 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14468 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14469 | smsLog(pMac, LOGE, FL("csrRoamRemoveEntryFromPeStatsReqList:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14470 | } |
| 14471 | } |
| 14472 | else |
| 14473 | { |
| 14474 | // the timer could not be stopped. Hence destroy and free the |
| 14475 | // memory for the PE stat entry in the timer CB. |
| 14476 | pTempStaEntry->timerStopFailed = TRUE; |
| 14477 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14478 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14479 | |
| 14480 | if(csrLLRemoveEntry(&pMac->roam.peStatsReqList, pEntry, LL_ACCESS_LOCK)) |
| 14481 | { |
| 14482 | // Only free the memory if we could stop the timer successfully |
| 14483 | if(!pTempStaEntry->timerStopFailed) |
| 14484 | { |
| 14485 | palFreeMemory(pMac->hHdd, pTempStaEntry); |
| 14486 | pTempStaEntry = NULL; |
| 14487 | } |
| 14488 | break; |
| 14489 | } |
| 14490 | |
| 14491 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14492 | } |
| 14493 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14494 | return; |
| 14495 | } |
| 14496 | |
| 14497 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14498 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14499 | { |
| 14500 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14501 | pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = pTlStats->rxBcntCRCok; |
| 14502 | pMac->roam.classDStatsInfo.rx_bc_byte_cnt = pTlStats->rxBCBcnt; |
| 14503 | pMac->roam.classDStatsInfo.rx_bc_frm_cnt = pTlStats->rxBCFcnt; |
| 14504 | pMac->roam.classDStatsInfo.rx_byte_cnt = pTlStats->rxBcnt; |
| 14505 | pMac->roam.classDStatsInfo.rx_mc_byte_cnt = pTlStats->rxMCBcnt; |
| 14506 | pMac->roam.classDStatsInfo.rx_mc_frm_cnt = pTlStats->rxMCFcnt; |
| 14507 | pMac->roam.classDStatsInfo.rx_rate = pTlStats->rxRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14508 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14509 | pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = pTlStats->rxUCBcnt; |
| 14510 | pMac->roam.classDStatsInfo.rx_uc_frm_cnt = pTlStats->rxUCFcnt; |
| 14511 | pMac->roam.classDStatsInfo.tx_bc_byte_cnt = pTlStats->txBCBcnt; |
| 14512 | pMac->roam.classDStatsInfo.tx_bc_frm_cnt = pTlStats->txBCFcnt; |
| 14513 | pMac->roam.classDStatsInfo.tx_mc_byte_cnt = pTlStats->txMCBcnt; |
| 14514 | pMac->roam.classDStatsInfo.tx_mc_frm_cnt = pTlStats->txMCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14515 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14516 | pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = pTlStats->txUCBcnt; |
| 14517 | pMac->roam.classDStatsInfo.tx_uc_frm_cnt = pTlStats->txUCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14518 | |
| 14519 | } |
| 14520 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14521 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 14522 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext) |
| 14523 | { |
| 14524 | tANI_U8 stats[500]; |
| 14525 | tANI_U8 *pStats = NULL; |
| 14526 | tANI_U32 tempMask = 0; |
| 14527 | tANI_U8 counter = 0; |
| 14528 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14529 | if(!callback) |
| 14530 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14531 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report callback NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14532 | return; |
| 14533 | } |
| 14534 | if(!statsMask) |
| 14535 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14536 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report statsMask is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14537 | return; |
| 14538 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14539 | pStats = stats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14540 | tempMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14541 | while(tempMask) |
| 14542 | { |
| 14543 | if(tempMask & 1) |
| 14544 | { |
| 14545 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 14546 | switch(counter) |
| 14547 | { |
| 14548 | case eCsrSummaryStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14549 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14550 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 14551 | sizeof(tCsrSummaryStatsInfo)); |
| 14552 | if(!HAL_STATUS_SUCCESS(status)) |
| 14553 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14554 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy summary stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14555 | } |
| 14556 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 14557 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14558 | case eCsrGlobalClassAStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14559 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14560 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 14561 | sizeof(tCsrGlobalClassAStatsInfo)); |
| 14562 | if(!HAL_STATUS_SUCCESS(status)) |
| 14563 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14564 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassA stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14565 | } |
| 14566 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14567 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14568 | case eCsrGlobalClassBStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14569 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14570 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 14571 | sizeof(tCsrGlobalClassBStatsInfo)); |
| 14572 | if(!HAL_STATUS_SUCCESS(status)) |
| 14573 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14574 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassB stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14575 | } |
| 14576 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14577 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14578 | case eCsrGlobalClassCStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14579 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14580 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 14581 | sizeof(tCsrGlobalClassCStatsInfo)); |
| 14582 | if(!HAL_STATUS_SUCCESS(status)) |
| 14583 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14584 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassC stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14585 | } |
| 14586 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14587 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14588 | case eCsrGlobalClassDStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14589 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassD stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14590 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classDStatsInfo, |
| 14591 | sizeof(tCsrGlobalClassDStatsInfo)); |
| 14592 | if(!HAL_STATUS_SUCCESS(status)) |
| 14593 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14594 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassD stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14595 | } |
| 14596 | pStats += sizeof(tCsrGlobalClassDStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14597 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14598 | case eCsrPerStaStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14599 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14600 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.perStaStatsInfo[staId], |
| 14601 | sizeof(tCsrPerStaStatsInfo)); |
| 14602 | if(!HAL_STATUS_SUCCESS(status)) |
| 14603 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14604 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14605 | } |
| 14606 | pStats += sizeof(tCsrPerStaStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14607 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14608 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14609 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:unknown stats type")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14610 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14611 | } |
| 14612 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14613 | tempMask >>=1; |
| 14614 | counter++; |
| 14615 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14616 | callback(stats, pContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14617 | } |
| 14618 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14619 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac) |
| 14620 | { |
| 14621 | tListElem *pEntry = NULL; |
| 14622 | tListElem *pPrevEntry = NULL; |
| 14623 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 14624 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14625 | VOS_STATUS vosStatus; |
| 14626 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14627 | if(!pEntry) |
| 14628 | { |
| 14629 | //list empty |
| 14630 | smsLog(pMac, LOGW, "csrRoamDeregStatisticsReq: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14631 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14632 | return status; |
| 14633 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14634 | while( pEntry ) |
| 14635 | { |
| 14636 | if(pPrevEntry) |
| 14637 | { |
| 14638 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 14639 | //send up the stats report |
| 14640 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 14641 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 14642 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 14643 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14644 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14645 | if (pTempStaEntry->pPeStaEntry) //pPeStaEntry can be NULL |
| 14646 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14647 | pTempStaEntry->pPeStaEntry->numClient--; |
| 14648 | //check if we need to delete the entry from peStatsReqList too |
| 14649 | if(!pTempStaEntry->pPeStaEntry->numClient) |
| 14650 | { |
| 14651 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry); |
| 14652 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14653 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14654 | //check if we need to stop the tl stats timer too |
| 14655 | pMac->roam.tlStatsReqInfo.numClient--; |
| 14656 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 14657 | { |
| 14658 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 14659 | { |
| 14660 | status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 14661 | if(!HAL_STATUS_SUCCESS(status)) |
| 14662 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14663 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14664 | //we will continue |
| 14665 | } |
| 14666 | } |
| 14667 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 14668 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 14669 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14670 | if (pTempStaEntry->periodicity) |
| 14671 | { |
| 14672 | //While creating StaEntry in csrGetStatistics, |
| 14673 | //Initializing and starting timer only when periodicity is set. |
| 14674 | //So Stop and Destroy timer only when periodicity is set. |
| 14675 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14676 | vos_timer_stop( &pTempStaEntry->timer ); |
| 14677 | // Destroy the vos timer... |
| 14678 | vosStatus = vos_timer_destroy( &pTempStaEntry->timer ); |
| 14679 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14680 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14681 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14682 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14683 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14684 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14685 | |
| 14686 | pPrevEntry = pEntry; |
| 14687 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14688 | } |
| 14689 | //the last one |
| 14690 | if(pPrevEntry) |
| 14691 | { |
| 14692 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 14693 | //send up the stats report |
| 14694 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 14695 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 14696 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 14697 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14698 | return status; |
| 14699 | |
| 14700 | } |
| 14701 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14702 | eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 14703 | tRequestFullPowerReason *pReason, |
| 14704 | tANI_BOOLEAN *pfNeedPower ) |
| 14705 | { |
| 14706 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 14707 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
| 14708 | tPmcState pmcState; |
| 14709 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14710 | // TODO : Session info unavailable |
| 14711 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14712 | if( pfNeedPower ) |
| 14713 | { |
| 14714 | *pfNeedPower = eANI_BOOLEAN_FALSE; |
| 14715 | } |
| 14716 | //We only handle CSR commands |
| 14717 | if( !(eSmeCsrCommandMask & pCommand->command) ) |
| 14718 | { |
| 14719 | return eHAL_STATUS_SUCCESS; |
| 14720 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14721 | //Check PMC state first |
| 14722 | pmcState = pmcGetPmcState( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14723 | switch( pmcState ) |
| 14724 | { |
| 14725 | case REQUEST_IMPS: |
| 14726 | case IMPS: |
| 14727 | if( eSmeCommandScan == pCommand->command ) |
| 14728 | { |
| 14729 | switch( pCommand->u.scanCmd.reason ) |
| 14730 | { |
| 14731 | case eCsrScanGetResult: |
| 14732 | case eCsrScanBGScanAbort: |
| 14733 | case eCsrScanBGScanEnable: |
| 14734 | case eCsrScanGetScanChnInfo: |
| 14735 | //Internal process, no need for full power |
| 14736 | fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 14737 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14738 | default: |
| 14739 | //Other scans are real scan, ask for power |
| 14740 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14741 | break; |
| 14742 | } //switch |
| 14743 | } |
| 14744 | else |
| 14745 | { |
| 14746 | //ask for power for roam and status change |
| 14747 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14748 | } |
| 14749 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14750 | case REQUEST_BMPS: |
| 14751 | case BMPS: |
| 14752 | case REQUEST_START_UAPSD: |
| 14753 | case UAPSD: |
| 14754 | //We treat WOWL same as BMPS |
| 14755 | case REQUEST_ENTER_WOWL: |
| 14756 | case WOWL: |
| 14757 | if( eSmeCommandRoam == pCommand->command ) |
| 14758 | { |
| 14759 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 14760 | tCsrScanResult *pScanResult; |
| 14761 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14762 | switch ( pCommand->u.roamCmd.roamReason ) |
| 14763 | { |
| 14764 | case eCsrForcedDisassoc: |
| 14765 | case eCsrForcedDisassocMICFailure: |
| 14766 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 14767 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14768 | break; |
| 14769 | case eCsrSmeIssuedDisassocForHandoff: |
| 14770 | case eCsrForcedDeauth: |
| 14771 | case eCsrHddIssuedReassocToSameAP: |
| 14772 | case eCsrSmeIssuedReassocToSameAP: |
| 14773 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14774 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14775 | case eCsrCapsChange: |
| 14776 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14777 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14778 | default: |
| 14779 | //Check whether the profile is already connected. If so, no need for full power |
| 14780 | //Note: IBSS is ignored for now because we don't support powersave in IBSS |
| 14781 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && pBSSList ) |
| 14782 | { |
| 14783 | //Only need to check the first one |
| 14784 | pEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 14785 | if( pEntry ) |
| 14786 | { |
| 14787 | pScanResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link); |
| 14788 | #if 0 |
| 14789 | // TODO : Session Specific info pConnectBssDesc |
| 14790 | if( csrIsBssIdEqual( pMac, &pScanResult->Result.BssDescriptor, pMac->roam.pConnectBssDesc ) && |
| 14791 | csrIsSsidEqual( pMac, pMac->roam.pConnectBssDesc, |
| 14792 | &pScanResult->Result.BssDescriptor, (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ) ) ) |
| 14793 | { |
| 14794 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 14795 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 14796 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 14797 | // a new Association. |
| 14798 | if(csrIsSameProfile(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 14799 | { |
| 14800 | if(csrRoamIsSameProfileKeys(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 14801 | { |
| 14802 | //Done, eventually, the command reaches eCsrReassocToSelfNoCapChange; |
| 14803 | //No need for full power |
| 14804 | //Set the flag so the code later can avoid to do the above |
| 14805 | //check again. |
| 14806 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_TRUE; |
| 14807 | break; |
| 14808 | } |
| 14809 | } |
| 14810 | } |
| 14811 | #endif |
| 14812 | } |
| 14813 | } |
| 14814 | //If we are here, full power is needed |
| 14815 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14816 | break; |
| 14817 | } |
| 14818 | } |
| 14819 | else if( eSmeCommandWmStatusChange == pCommand->command ) |
| 14820 | { |
| 14821 | //need full power for all |
| 14822 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14823 | reason = eSME_LINK_DISCONNECTED_BY_OTHER; |
| 14824 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14825 | #ifdef FEATURE_WLAN_TDLS |
| 14826 | else if( eSmeCommandTdlsAddPeer == pCommand->command ) |
| 14827 | { |
| 14828 | //TDLS link is getting established. need full power |
| 14829 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14830 | reason = eSME_FULL_PWR_NEEDED_BY_TDLS_PEER_SETUP; |
| 14831 | } |
| 14832 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14833 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14834 | case REQUEST_STOP_UAPSD: |
| 14835 | case REQUEST_EXIT_WOWL: |
| 14836 | if( eSmeCommandRoam == pCommand->command ) |
| 14837 | { |
| 14838 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14839 | switch ( pCommand->u.roamCmd.roamReason ) |
| 14840 | { |
| 14841 | case eCsrForcedDisassoc: |
| 14842 | case eCsrForcedDisassocMICFailure: |
| 14843 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 14844 | break; |
| 14845 | default: |
| 14846 | break; |
| 14847 | } |
| 14848 | } |
| 14849 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14850 | case STOPPED: |
| 14851 | case REQUEST_STANDBY: |
| 14852 | case STANDBY: |
| 14853 | case LOW_POWER: |
| 14854 | //We are not supposed to do anything |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14855 | 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] | 14856 | status = eHAL_STATUS_FAILURE; |
| 14857 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14858 | case FULL_POWER: |
| 14859 | case REQUEST_FULL_POWER: |
| 14860 | default: |
| 14861 | //No need to ask for full power. This has to be FULL_POWER state |
| 14862 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14863 | } //switch |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14864 | if( pReason ) |
| 14865 | { |
| 14866 | *pReason = reason; |
| 14867 | } |
| 14868 | if( pfNeedPower ) |
| 14869 | { |
| 14870 | *pfNeedPower = fNeedFullPower; |
| 14871 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14872 | return ( status ); |
| 14873 | } |
| 14874 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14875 | static eHalStatus csrRequestFullPower( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 14876 | { |
| 14877 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14878 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 14879 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14880 | status = csrIsFullPowerNeeded( pMac, pCommand, &reason, &fNeedFullPower ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14881 | if( fNeedFullPower && HAL_STATUS_SUCCESS( status ) ) |
| 14882 | { |
| 14883 | status = pmcRequestFullPower(pMac, csrFullPowerCallback, pMac, reason); |
| 14884 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14885 | return ( status ); |
| 14886 | } |
| 14887 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14888 | tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac ) |
| 14889 | { |
| 14890 | tSmeCmd *pCmd = smeGetCommandBuffer( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14891 | if( pCmd ) |
| 14892 | { |
| 14893 | pMac->roam.sPendingCommands++; |
| 14894 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14895 | return ( pCmd ); |
| 14896 | } |
| 14897 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14898 | void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 14899 | { |
| 14900 | if (pMac->roam.sPendingCommands > 0) |
| 14901 | { |
| 14902 | //All command allocated through csrGetCommandBuffer need to |
| 14903 | //decrement the pending count when releasing. |
| 14904 | pMac->roam.sPendingCommands--; |
| 14905 | smeReleaseCommand( pMac, pCommand ); |
| 14906 | } |
| 14907 | else |
| 14908 | { |
| 14909 | smsLog(pMac, LOGE, FL( "no pending commands")); |
| 14910 | VOS_ASSERT(0); |
| 14911 | } |
| 14912 | } |
| 14913 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14914 | //Return SUCCESS is the command is queued, failed |
| 14915 | eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority ) |
| 14916 | { |
| 14917 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14918 | if( (eSmeCommandScan == pCommand->command) && pMac->scan.fDropScanCmd ) |
| 14919 | { |
| 14920 | smsLog(pMac, LOGW, FL(" drop scan (scan reason %d) command"), |
| 14921 | pCommand->u.scanCmd.reason); |
| 14922 | return eHAL_STATUS_CSR_WRONG_STATE; |
| 14923 | } |
| 14924 | |
| 14925 | //We can call request full power first before putting the command into pending Q |
| 14926 | //because we are holding SME lock at this point. |
| 14927 | status = csrRequestFullPower( pMac, pCommand ); |
| 14928 | if( HAL_STATUS_SUCCESS( status ) ) |
| 14929 | { |
| 14930 | tANI_BOOLEAN fNoCmdPending; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14931 | //make sure roamCmdPendingList is not empty first |
| 14932 | fNoCmdPending = csrLLIsListEmpty( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_FALSE ); |
| 14933 | if( fNoCmdPending ) |
| 14934 | { |
| 14935 | smePushCommand( pMac, pCommand, fHighPriority ); |
| 14936 | } |
| 14937 | else |
| 14938 | { |
| 14939 | //Other commands are waiting for PMC callback, queue the new command to the pending Q |
| 14940 | //no list lock is needed since SME lock is held |
| 14941 | if( !fHighPriority ) |
| 14942 | { |
| 14943 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14944 | } |
| 14945 | else { |
| 14946 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14947 | } |
| 14948 | } |
| 14949 | } |
| 14950 | else if( eHAL_STATUS_PMC_PENDING == status ) |
| 14951 | { |
| 14952 | //no list lock is needed since SME lock is held |
| 14953 | if( !fHighPriority ) |
| 14954 | { |
| 14955 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14956 | } |
| 14957 | else { |
| 14958 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14959 | } |
| 14960 | //Let caller know the command is queue |
| 14961 | status = eHAL_STATUS_SUCCESS; |
| 14962 | } |
| 14963 | else |
| 14964 | { |
| 14965 | //Not to decrease pMac->roam.sPendingCommands here. Caller will decrease it when it |
| 14966 | //release the command. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14967 | smsLog( pMac, LOGE, FL( " cannot queue command %d" ), pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14968 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14969 | return ( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14970 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14971 | eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs* pAPWPSIES ) |
| 14972 | { |
| 14973 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14974 | tSirUpdateAPWPSIEsReq *pMsg; |
| 14975 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 14976 | |
| 14977 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14978 | if (NULL == pSession) |
| 14979 | { |
| 14980 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 14981 | return eHAL_STATUS_FAILURE; |
| 14982 | } |
| 14983 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14984 | do |
| 14985 | { |
| 14986 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPSIEsReq) ); |
| 14987 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 14988 | palZeroMemory( pMac->hHdd, pMsg, sizeof(tSirUpdateAPWPSIEsReq) ); |
| 14989 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPDATE_APWPSIE_REQ); |
| 14990 | |
| 14991 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 14992 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14993 | // transactionId |
| 14994 | *pBuf = 0; |
| 14995 | *( pBuf + 1 ) = 0; |
| 14996 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14997 | // bssId |
| 14998 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 14999 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15000 | //sessionId |
| 15001 | *pBuf++ = (tANI_U8)sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15002 | // APWPSIEs |
| 15003 | palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *)pBuf, pAPWPSIES, sizeof(tSirAPWPSIEs)); |
| 15004 | pBuf += sizeof(tSirAPWPSIEs); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15005 | 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] | 15006 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15007 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15008 | return ( status ); |
| 15009 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15010 | eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie) |
| 15011 | { |
| 15012 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15013 | tSirUpdateAPWPARSNIEsReq *pMsg; |
| 15014 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15015 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15016 | if (NULL == pSession) |
| 15017 | { |
| 15018 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 15019 | return eHAL_STATUS_FAILURE; |
| 15020 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15021 | do |
| 15022 | { |
| 15023 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPARSNIEsReq) ); |
| 15024 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 15025 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirUpdateAPWPARSNIEsReq ) ); |
| 15026 | 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] | 15027 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 15028 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15029 | // transactionId |
| 15030 | *pBuf = 0; |
| 15031 | *( pBuf + 1 ) = 0; |
| 15032 | pBuf += sizeof(tANI_U16); |
| 15033 | |
| 15034 | // bssId |
| 15035 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 15036 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15037 | // sessionId |
| 15038 | *pBuf++ = (tANI_U8)sessionId; |
| 15039 | |
| 15040 | // APWPARSNIEs |
| 15041 | palCopyMemory( pMac->hHdd, (tSirRSNie *)pBuf, pAPSirRSNie, sizeof(tSirRSNie)); |
| 15042 | pBuf += sizeof(tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15043 | 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] | 15044 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15045 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15046 | return ( status ); |
| 15047 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15048 | |
| 15049 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 15050 | //eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tCsrBssid preAuthBssid, tANI_U8 channelId) |
| 15051 | eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription) |
| 15052 | { |
| 15053 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 15054 | tpSirFTPreAuthReq pftPreAuthReq; |
| 15055 | tANI_U16 auth_req_len = 0; |
| 15056 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15057 | auth_req_len = sizeof(tSirFTPreAuthReq); |
| 15058 | pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len); |
| 15059 | if (pftPreAuthReq == NULL) |
| 15060 | { |
| 15061 | smsLog(pMac, LOGE, FL("Memory allocation for FT Preauth request failed")); |
| 15062 | return eHAL_STATUS_RESOURCES; |
| 15063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15064 | // Save the SME Session ID here. We need it while processing the preauth response |
| 15065 | pMac->ft.ftSmeContext.smeSessionId = sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15066 | vos_mem_zero(pftPreAuthReq, auth_req_len); |
| 15067 | |
| 15068 | pftPreAuthReq->pbssDescription = (tpSirBssDescription)vos_mem_malloc( |
| 15069 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 15070 | |
| 15071 | pftPreAuthReq->messageType = pal_cpu_to_be16(eWNI_SME_FT_PRE_AUTH_REQ); |
| 15072 | |
| 15073 | pftPreAuthReq->preAuthchannelNum = pBssDescription->channelId; |
| 15074 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15075 | palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->currbssId, (void *)pSession->connectedProfile.bssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15076 | palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->preAuthbssId, (void *)pBssDescription->bssId, sizeof(tSirMacAddr)); |
| 15077 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15078 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 15079 | if (csrRoamIs11rAssoc(pMac) && |
| 15080 | (pMac->roam.roamSession[sessionId].connectedProfile.AuthType != eCSR_AUTH_TYPE_OPEN_SYSTEM)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15081 | { |
| 15082 | pftPreAuthReq->ft_ies_length = (tANI_U16)pMac->ft.ftSmeContext.auth_ft_ies_length; |
| 15083 | palCopyMemory(pMac->hHdd, pftPreAuthReq->ft_ies, pMac->ft.ftSmeContext.auth_ft_ies, |
| 15084 | pMac->ft.ftSmeContext.auth_ft_ies_length); |
| 15085 | } |
| 15086 | else |
| 15087 | #endif |
| 15088 | { |
| 15089 | pftPreAuthReq->ft_ies_length = 0; |
| 15090 | } |
Madan Mohan Koyyalamudi | 613b0a4 | 2012-10-31 15:55:53 -0700 | [diff] [blame] | 15091 | vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription, |
| 15092 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 15093 | pftPreAuthReq->length = pal_cpu_to_be16(auth_req_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15094 | return palSendMBMessage(pMac->hHdd, pftPreAuthReq); |
| 15095 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15096 | /*-------------------------------------------------------------------------- |
| 15097 | * This will receive and process the FT Pre Auth Rsp from the current |
| 15098 | * associated ap. |
| 15099 | * |
| 15100 | * This will invoke the hdd call back. This is so that hdd can now |
| 15101 | * send the FTIEs from the Auth Rsp (Auth Seq 2) to the supplicant. |
| 15102 | ------------------------------------------------------------------------*/ |
| 15103 | void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp ) |
| 15104 | { |
| 15105 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 15106 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15107 | #ifdef FEATURE_WLAN_LFR |
| 15108 | tCsrRoamInfo roamInfo; |
| 15109 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15110 | |
| 15111 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 15112 | smsLog( pMac, LOGE, FL("Preauth response status code 0x%x"), pFTPreAuthRsp->status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15113 | #endif |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 15114 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 15115 | status = csrNeighborRoamPreauthRspHandler(pMac, pFTPreAuthRsp->status); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 15116 | if (status != eHAL_STATUS_SUCCESS) { |
| 15117 | /* |
| 15118 | * Bail out if pre-auth was not even processed. |
| 15119 | */ |
| 15120 | smsLog(pMac, LOGW, FL("Preauth was not processed: %d"), status); |
| 15121 | return; |
| 15122 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15123 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15124 | /* The below function calls/timers should be invoked only if the pre-auth is successful */ |
| 15125 | if (VOS_STATUS_SUCCESS != (VOS_STATUS)pFTPreAuthRsp->status) |
| 15126 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15127 | // Implies a success |
| 15128 | pMac->ft.ftSmeContext.FTState = eFT_AUTH_COMPLETE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15129 | // Indicate SME QoS module the completion of Preauth success. This will trigger the creation of RIC IEs |
| 15130 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = pFTPreAuthRsp; |
| 15131 | sme_QosCsrEventInd(pMac, pMac->ft.ftSmeContext.smeSessionId, SME_QOS_CSR_PREAUTH_SUCCESS_IND, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15132 | /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, |
| 15133 | * actual transition from the current to handoff AP is triggered */ |
| 15134 | status = palTimerStart(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer, |
| 15135 | 60 * PAL_TIMER_TO_MS_UNIT, |
| 15136 | eANI_BOOLEAN_FALSE); |
| 15137 | if (eHAL_STATUS_SUCCESS != status) |
| 15138 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15139 | 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] | 15140 | return; |
| 15141 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15142 | // Save the received response |
| 15143 | palCopyMemory(pMac->hHdd, (void *)&pMac->ft.ftSmeContext.preAuthbssId, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 15144 | if (csrRoamIs11rAssoc(pMac)) |
| 15145 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, NULL, 0, |
| 15146 | eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE); |
| 15147 | |
| 15148 | // Currently we dont do anything special for CCX connection. |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15149 | #ifdef FEATURE_WLAN_LFR |
| 15150 | // If Legacy Fast Roaming is enabled, signal the supplicant |
| 15151 | // 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] | 15152 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15153 | { |
| 15154 | // Save the bssid from the received response |
| 15155 | palCopyMemory(pMac->hHdd, (void *)&roamInfo.bssid, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 15156 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_PMK_NOTIFY, 0); |
| 15157 | } |
| 15158 | |
| 15159 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15160 | |
| 15161 | // Done with it, init it. |
| 15162 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL; |
| 15163 | } |
| 15164 | #endif |
| 15165 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 15166 | void csrRoamJoinRetryTimerHandler(void *pv) |
| 15167 | { |
| 15168 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 15169 | tpAniSirGlobal pMac = pInfo->pMac; |
| 15170 | tANI_U32 sessionId = pInfo->sessionId; |
| 15171 | tCsrRoamSession *pSession; |
| 15172 | |
| 15173 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 15174 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15175 | 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] | 15176 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15177 | if(pSession->pCurRoamProfile && csrIsConnStateDisconnected(pMac, sessionId)) |
| 15178 | { |
| 15179 | if( !HAL_STATUS_SUCCESS(csrRoamJoinLastProfile(pMac, sessionId)) ) |
| 15180 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15181 | smsLog( pMac, LOGE, FL( " fail to retry the last roam profile" ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15182 | } |
| 15183 | } |
| 15184 | } |
| 15185 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15186 | eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 15187 | { |
| 15188 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15189 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15190 | |
| 15191 | if(pSession->pCurRoamProfile && pSession->maxRetryCount) |
| 15192 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15193 | 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] | 15194 | pSession->maxRetryCount--; |
| 15195 | pSession->joinRetryTimerInfo.pMac = pMac; |
| 15196 | pSession->joinRetryTimerInfo.sessionId = (tANI_U8)sessionId; |
| 15197 | status = palTimerStart(pMac->hHdd, pSession->hTimerJoinRetry, interval, eANI_BOOLEAN_FALSE); |
| 15198 | if(!HAL_STATUS_SUCCESS(status)) |
| 15199 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15200 | smsLog(pMac, LOGE, FL(" fail to start timer status %s"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15201 | } |
| 15202 | } |
| 15203 | else |
| 15204 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15205 | 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] | 15206 | pSession->maxRetryCount); |
| 15207 | } |
| 15208 | |
| 15209 | return (status); |
| 15210 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15211 | eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 15212 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15213 | smsLog(pMac, LOGE, " csrRoamStopJoinRetryTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15214 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 15215 | { |
| 15216 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerJoinRetry)); |
| 15217 | } |
| 15218 | |
| 15219 | return eHAL_STATUS_SUCCESS; |
| 15220 | } |
| 15221 | #endif |
| 15222 | |
| 15223 | |
| 15224 | /* |
| 15225 | pBuf points to the beginning of the message |
| 15226 | LIM packs disassoc rsp as below, |
| 15227 | messageType - 2 bytes |
| 15228 | messageLength - 2 bytes |
| 15229 | sessionId - 1 byte |
| 15230 | transactionId - 2 bytes (tANI_U16) |
| 15231 | reasonCode - 4 bytes (sizeof(tSirResultCodes)) |
| 15232 | peerMacAddr - 6 bytes |
| 15233 | The rest is conditionally defined of (WNI_POLARIS_FW_PRODUCT == AP) and not used |
| 15234 | */ |
| 15235 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp) |
| 15236 | { |
| 15237 | if(pBuf && pRsp) |
| 15238 | { |
| 15239 | pBuf += 4; //skip type and length |
| 15240 | pRsp->sessionId = *pBuf++; |
| 15241 | pal_get_U16( pBuf, (tANI_U16 *)&pRsp->transactionId ); |
| 15242 | pBuf += 2; |
| 15243 | pal_get_U32( pBuf, (tANI_U32 *)&pRsp->statusCode ); |
| 15244 | pBuf += 4; |
| 15245 | vos_mem_copy(pRsp->peerMacAddr, pBuf, 6); |
| 15246 | } |
| 15247 | } |
| 15248 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 15249 | eHalStatus csrGetDefaultCountryCodeFrmNv(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 15250 | { |
| 15251 | static uNvTables nvTables; |
| 15252 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15253 | VOS_STATUS vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 15254 | |
| 15255 | /* read the country code from NV and use it */ |
| 15256 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 15257 | { |
| 15258 | palCopyMemory( pMac->hHdd, pCountry, |
| 15259 | nvTables.defaultCountryTable.countryCode, |
| 15260 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 15261 | return status; |
| 15262 | } |
| 15263 | else |
| 15264 | { |
| 15265 | palCopyMemory( pMac->hHdd, pCountry, |
| 15266 | "XXX", |
| 15267 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 15268 | status = eHAL_STATUS_FAILURE; |
| 15269 | return status; |
| 15270 | } |
| 15271 | } |
| 15272 | |
| 15273 | eHalStatus csrGetCurrentCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 15274 | { |
| 15275 | palCopyMemory( pMac->hHdd, pCountry, |
| 15276 | pMac->scan.countryCode11d, |
| 15277 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 15278 | return eHAL_STATUS_SUCCESS; |
| 15279 | } |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame^] | 15280 | |
| 15281 | eHalStatus csrSetTxPower(tpAniSirGlobal pMac, v_U8_t sessionId, v_U8_t mW) |
| 15282 | { |
| 15283 | tSirSetTxPowerReq *pMsg = NULL; |
| 15284 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15285 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 15286 | |
| 15287 | if (!pSession) |
| 15288 | { |
| 15289 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 15290 | return eHAL_STATUS_FAILURE; |
| 15291 | } |
| 15292 | |
| 15293 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tSirSetTxPowerReq)); |
| 15294 | if (HAL_STATUS_SUCCESS(status)) |
| 15295 | { |
| 15296 | palZeroMemory(pMac->hHdd, (void *)pMsg, sizeof(tSirSetTxPowerReq)); |
| 15297 | pMsg->messageType = eWNI_SME_SET_TX_POWER_REQ; |
| 15298 | pMsg->length = sizeof(tSirSetTxPowerReq); |
| 15299 | pMsg->mwPower = mW; |
| 15300 | palCopyMemory( pMac->hHdd, |
| 15301 | (tSirMacAddr *)pMsg->bssId, |
| 15302 | &pSession->selfMacAddr, |
| 15303 | sizeof(tSirMacAddr) ); |
| 15304 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 15305 | if (!HAL_STATUS_SUCCESS(status)) |
| 15306 | { |
| 15307 | smsLog(pMac, LOGE, FL(" csr set TX Power Post MSG Fail %d "), status); |
| 15308 | palFreeMemory(pMac->hHdd, pMsg); |
| 15309 | } |
| 15310 | } |
| 15311 | return status; |
| 15312 | } |