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 | #ifdef FEATURE_WLAN_INTEGRATED_SOC |
| 68 | #include "halMsgApi.h" //for HAL_STA_INVALID_IDX. |
| 69 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 70 | #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC |
| 71 | #include "halPhyApi.h" |
| 72 | #include "halInternal.h" |
| 73 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 74 | #include "limUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 75 | #include "palApi.h" |
| 76 | #include "csrInsideApi.h" |
| 77 | #include "smsDebug.h" |
| 78 | #include "logDump.h" |
| 79 | #include "smeQosInternal.h" |
| 80 | #include "wlan_qct_tl.h" |
| 81 | #include "smeInside.h" |
| 82 | #include "vos_diag_core_event.h" |
| 83 | #include "vos_diag_core_log.h" |
| 84 | #include "csrApi.h" |
| 85 | #include "pmc.h" |
| 86 | #include "vos_nvitem.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 87 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 88 | #include "csrNeighborRoam.h" |
| 89 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 90 | #ifdef FEATURE_WLAN_CCX |
| 91 | #include "csrCcx.h" |
| 92 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 93 | #define CSR_NUM_IBSS_START_CHANNELS_50 4 |
| 94 | #define CSR_NUM_IBSS_START_CHANNELS_24 3 |
| 95 | #define CSR_DEF_IBSS_START_CHANNEL_50 36 |
| 96 | #define CSR_DEF_IBSS_START_CHANNEL_24 1 |
| 97 | #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] | 98 | #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] | 99 | #define CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD ( 120 * PAL_TIMER_TO_SEC_UNIT ) // 120 seconds, for WPS |
| 100 | /*--------------------------------------------------------------------------- |
| 101 | OBIWAN recommends [8 10]% : pick 9% |
| 102 | ---------------------------------------------------------------------------*/ |
| 103 | #define CSR_VCC_UL_MAC_LOSS_THRESHOLD 9 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 104 | /*--------------------------------------------------------------------------- |
| 105 | OBIWAN recommends -85dBm |
| 106 | ---------------------------------------------------------------------------*/ |
| 107 | #define CSR_VCC_RSSI_THRESHOLD 80 |
| 108 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD 500 //ms |
| 109 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS 2000 //ms |
| 110 | #define CSR_MIN_TL_STAT_QUERY_PERIOD 500 //ms |
| 111 | #define CSR_DIAG_LOG_STAT_PERIOD 3000 //ms |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 112 | //We use constatnt 4 here |
| 113 | //This macro returns true when higher AC parameter is bigger than lower AC for a difference |
| 114 | //The bigger the number, the less chance of TX |
| 115 | //It must put lower AC as the first parameter. |
| 116 | #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] | 117 | //Flag to send/do not send disassoc frame over the air |
| 118 | #define CSR_DONT_SEND_DISASSOC_OVER_THE_AIR 1 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 119 | #define RSSI_HACK_BMPS (-40) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 120 | #define MAX_CB_VALUE_IN_INI (2) |
| 121 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 122 | /*-------------------------------------------------------------------------- |
| 123 | Static Type declarations |
| 124 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 125 | static tCsrRoamSession csrRoamRoamSession[CSR_ROAM_SESSION_MAX]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 126 | /*-------------------------------------------------------------------------- |
| 127 | Type declarations |
| 128 | ------------------------------------------------------------------------*/ |
| 129 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 130 | int diagAuthTypeFromCSRType(eCsrAuthType authType) |
| 131 | { |
| 132 | int n = AUTH_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 133 | switch(authType) |
| 134 | { |
| 135 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 136 | n = AUTH_SHARED; |
| 137 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 138 | case eCSR_AUTH_TYPE_WPA: |
| 139 | n = AUTH_WPA_EAP; |
| 140 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 141 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 142 | n = AUTH_WPA_PSK; |
| 143 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 144 | case eCSR_AUTH_TYPE_RSN: |
| 145 | n = AUTH_WPA2_EAP; |
| 146 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 147 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 148 | n = AUTH_WPA2_PSK; |
| 149 | break; |
| 150 | #ifdef FEATURE_WLAN_WAPI |
| 151 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 152 | n = AUTH_WAPI_CERT; |
| 153 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 154 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 155 | n = AUTH_WAPI_PSK; |
| 156 | break; |
| 157 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 158 | default: |
| 159 | break; |
| 160 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 161 | return (n); |
| 162 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 163 | int diagEncTypeFromCSRType(eCsrEncryptionType encType) |
| 164 | { |
| 165 | int n = ENC_MODE_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 166 | switch(encType) |
| 167 | { |
| 168 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 169 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 170 | n = ENC_MODE_WEP40; |
| 171 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 172 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 173 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 174 | n = ENC_MODE_WEP104; |
| 175 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 176 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 177 | n = ENC_MODE_TKIP; |
| 178 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 179 | case eCSR_ENCRYPT_TYPE_AES: |
| 180 | n = ENC_MODE_AES; |
| 181 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 182 | #ifdef FEATURE_WLAN_WAPI |
| 183 | case eCSR_ENCRYPT_TYPE_WPI: |
| 184 | n = ENC_MODE_SMS4; |
| 185 | break; |
| 186 | #endif /* FEATURE_WLAN_WAPI */ |
| 187 | default: |
| 188 | break; |
| 189 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 190 | return (n); |
| 191 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 192 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 193 | static const tANI_U8 csrStartIbssChannels50[ CSR_NUM_IBSS_START_CHANNELS_50 ] = { 36, 40, 44, 48}; |
| 194 | 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] | 195 | static void initConfigParam(tpAniSirGlobal pMac); |
| 196 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 197 | eCsrRoamCompleteResult Result, void *Context ); |
| 198 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 199 | tCsrRoamProfile *pProfile, |
| 200 | tANI_BOOLEAN *pfSameIbss ); |
| 201 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirSmeNewBssInfo *pNewBss ); |
| 202 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 203 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes); |
| 204 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 205 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac); |
| 206 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ); |
| 207 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac); |
| 208 | eHalStatus csrRoamClose(tpAniSirGlobal pMac); |
| 209 | void csrRoamMICErrorTimerHandler(void *pv); |
| 210 | void csrRoamTKIPCounterMeasureTimerHandler(void *pv); |
| 211 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2); |
| 212 | |
| 213 | static eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 214 | static eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 215 | static void csrRoamRoamingTimerHandler(void *pv); |
| 216 | eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 217 | eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 218 | static void csrRoamIbssJoinTimerHandler(void *pv); |
| 219 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval); |
| 220 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac); |
| 221 | static void csrRoamWaitForKeyTimeOutHandler(void *pv); |
| 222 | |
| 223 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 224 | static eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 225 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ); |
| 226 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 227 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 228 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 229 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 230 | tANI_U8 *pKeyRsc ); |
| 231 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 232 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, |
| 233 | tCsrRoamProfile *pProfile ); |
| 234 | void csrRoamStatisticsTimerHandler(void *pv); |
| 235 | void csrRoamStatsGlobalClassDTimerHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 236 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid); |
| 237 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 238 | v_U8_t rssiNotification, |
| 239 | void * context); |
| 240 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 241 | void csrRoamVccTrigger(tpAniSirGlobal pMac); |
| 242 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId); |
| 243 | /* |
| 244 | pStaEntry is no longer invalid upon the return of this function. |
| 245 | */ |
| 246 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 247 | #ifdef WLAN_SOFTAP_FEATURE |
| 248 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile,tANI_U8 operationChn, eCsrBand *pBand ); |
| 249 | #else |
| 250 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, eCsrPhyMode phyModeIn, tANI_U8 operationChn, eCsrBand *pBand ); |
| 251 | #endif |
| 252 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 253 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 254 | tDblLinkList *pStaList, |
| 255 | tCsrStatsClientReqInfo *pStaEntry); |
| 256 | void csrRoamStatsClientTimerHandler(void *pv); |
| 257 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 258 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId); |
| 259 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 260 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 261 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 262 | void csrRoamTlStatsTimerHandler(void *pv); |
| 263 | void csrRoamPeStatsTimerHandler(void *pv); |
| 264 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 265 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry); |
| 266 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 267 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac); |
| 268 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ); |
| 269 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ); |
| 270 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ); |
| 271 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 272 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ); |
| 273 | //static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ); |
| 274 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
| 275 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac); |
| 276 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 277 | void csrRoamJoinRetryTimerHandler(void *pv); |
| 278 | #endif |
| 279 | extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 280 | extern void btampEstablishLogLinkHdlr(void* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 281 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 282 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 283 | |
| 284 | //Initialize global variables |
| 285 | static void csrRoamInitGlobals(tpAniSirGlobal pMac) |
| 286 | { |
| 287 | if(pMac) |
| 288 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 289 | vos_mem_zero(&csrRoamRoamSession, sizeof(csrRoamRoamSession)); |
| 290 | pMac->roam.roamSession = csrRoamRoamSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 291 | } |
| 292 | return; |
| 293 | } |
| 294 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 295 | static void csrRoamDeInitGlobals(tpAniSirGlobal pMac) |
| 296 | { |
| 297 | if(pMac) |
| 298 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 299 | pMac->roam.roamSession = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 300 | } |
| 301 | return; |
| 302 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 303 | eHalStatus csrOpen(tpAniSirGlobal pMac) |
| 304 | { |
| 305 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 306 | static uNvTables nvTables; |
| 307 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 308 | v_REGDOMAIN_t regId; |
| 309 | tANI_U32 i; |
| 310 | |
| 311 | do |
| 312 | { |
| 313 | /* Initialize CSR Roam Globals */ |
| 314 | csrRoamInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 315 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 316 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i); |
| 317 | |
| 318 | initConfigParam(pMac); |
| 319 | if(!HAL_STATUS_SUCCESS((status = csrScanOpen(pMac)))) |
| 320 | break; |
| 321 | if(!HAL_STATUS_SUCCESS((status = csrRoamOpen(pMac)))) |
| 322 | break; |
| 323 | pMac->roam.nextRoamId = 1; //Must not be 0 |
| 324 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.statsClientReqList))) |
| 325 | break; |
| 326 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.peStatsReqList))) |
| 327 | break; |
| 328 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.roamCmdPendingList))) |
| 329 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 330 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 331 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 332 | { |
| 333 | palCopyMemory( pMac->hHdd, pMac->scan.countryCodeDefault, |
| 334 | nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN ); |
| 335 | status = eHAL_STATUS_SUCCESS; |
| 336 | } |
| 337 | else |
| 338 | { |
| 339 | smsLog( pMac, LOGE, FL(" fail to get NV_FIELD_IMAGE\n") ); |
| 340 | //hardcoded for now |
| 341 | pMac->scan.countryCodeDefault[0] = 'U'; |
| 342 | pMac->scan.countryCodeDefault[1] = 'S'; |
| 343 | pMac->scan.countryCodeDefault[2] = 'I'; |
| 344 | //status = eHAL_STATUS_SUCCESS; |
| 345 | } |
Madan Mohan Koyyalamudi | 8b7f1e6 | 2012-10-05 14:56:51 -0700 | [diff] [blame] | 346 | smsLog( pMac, LOG1, FL(" country Code from nvRam %s"), pMac->scan.countryCodeDefault ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 347 | csrGetRegulatoryDomainForCountry(pMac, pMac->scan.countryCodeDefault, ®Id); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 348 | WDA_SetRegDomain(pMac, regId); |
| 349 | pMac->scan.domainIdDefault = regId; |
| 350 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 351 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 352 | pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN); |
| 353 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 354 | }while(0); |
| 355 | |
| 356 | return (status); |
| 357 | } |
| 358 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | #ifdef WLAN_SOFTAP_FEATURE |
| 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 | { |
| 368 | smsLog( pMac, LOGW, FL(" Invalid country Code Pointer\n") ); |
| 369 | return eHAL_STATUS_FAILURE; |
| 370 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 371 | smsLog( pMac, LOGW, FL(" country Code %s\n"), 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 | { |
| 379 | smsLog( pMac, LOGW, FL(" Invalid Country Code Length\n") ); |
| 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 | { |
| 386 | smsLog( pMac, LOGE, FL(" fail to get regId for country Code %s\n"), apCntryCode ); |
| 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 | { |
| 392 | smsLog( pMac, LOGE, FL(" fail to get regId for country Code %s\n"), apCntryCode ); |
| 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 | } |
| 436 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 437 | eHalStatus csrClose(tpAniSirGlobal pMac) |
| 438 | { |
| 439 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 440 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 441 | csrStop(pMac); |
| 442 | csrRoamClose(pMac); |
| 443 | csrScanClose(pMac); |
| 444 | csrLLClose(&pMac->roam.statsClientReqList); |
| 445 | csrLLClose(&pMac->roam.peStatsReqList); |
| 446 | csrLLClose(&pMac->roam.roamCmdPendingList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 447 | /* DeInit Globals */ |
| 448 | csrRoamDeInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 449 | return (status); |
| 450 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 451 | eHalStatus csrStart(tpAniSirGlobal pMac) |
| 452 | { |
| 453 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 454 | tANI_U32 i; |
| 455 | |
| 456 | do |
| 457 | { |
| 458 | //save the global vos context |
| 459 | pMac->roam.gVosContext = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 460 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 461 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, i ); |
| 462 | |
| 463 | status = csrRoamStart(pMac); |
| 464 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 465 | pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE; |
| 466 | status = pmcRegisterPowerSaveCheck(pMac, csrCheckPSReady, pMac); |
| 467 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 468 | pMac->roam.sPendingCommands = 0; |
| 469 | csrScanEnable(pMac); |
| 470 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 471 | status = csrNeighborRoamInit(pMac); |
| 472 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
| 473 | pMac->roam.tlStatsReqInfo.numClient = 0; |
| 474 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 475 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 476 | //init the link quality indication also |
| 477 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND; |
| 478 | if(!HAL_STATUS_SUCCESS(status)) |
| 479 | { |
| 480 | smsLog(pMac, LOGW, " csrStart: Couldn't Init HO control blk \n"); |
| 481 | break; |
| 482 | } |
| 483 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 484 | #if defined(ANI_LOGDUMP) |
| 485 | csrDumpInit(pMac); |
| 486 | #endif //#if defined(ANI_LOGDUMP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 487 | return (status); |
| 488 | } |
| 489 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 490 | eHalStatus csrStop(tpAniSirGlobal pMac) |
| 491 | { |
| 492 | tANI_U32 sessionId; |
| 493 | tANI_U32 i; |
| 494 | |
| 495 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 496 | { |
| 497 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 498 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 499 | csrScanDisable(pMac); |
| 500 | pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE; |
| 501 | pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 502 | csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE ); |
| 503 | |
| 504 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 505 | csrNeighborRoamClose(pMac); |
| 506 | #endif |
| 507 | csrScanFlushResult(pMac); //Do we want to do this? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | // deregister from PMC since we register during csrStart() |
| 509 | // (ignore status since there is nothing we can do if it fails) |
| 510 | (void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 511 | //Reset the domain back to the deault |
| 512 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 513 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 514 | |
| 515 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 516 | { |
| 517 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP ,i ); |
| 518 | pMac->roam.curSubState[i] = eCSR_ROAM_SUBSTATE_NONE; |
| 519 | } |
| 520 | |
| 521 | return (eHAL_STATUS_SUCCESS); |
| 522 | } |
| 523 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 524 | eHalStatus csrReady(tpAniSirGlobal pMac) |
| 525 | { |
| 526 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 527 | csrScanGetSupportedChannels( pMac ); |
| 528 | //WNI_CFG_VALID_CHANNEL_LIST should be set by this time |
| 529 | //use it to init the background scan list |
| 530 | csrInitBGScanChannelList(pMac); |
| 531 | /* HDD issues the init scan */ |
| 532 | csrScanStartResultAgingTimer(pMac); |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 533 | /* If the gScanAgingTime is set to '0' then scan results aging timeout |
| 534 | based on timer feature is not enabled*/ |
| 535 | if(0 != pMac->scan.scanResultCfgAgingTime ) |
| 536 | { |
| 537 | csrScanStartResultCfgAgingTimer(pMac); |
| 538 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 539 | //Store the AC weights in TL for later use |
| 540 | WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 541 | status = csrInitChannelList( pMac ); |
| 542 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 543 | { |
| 544 | smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d\n", |
| 545 | status ); |
| 546 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 547 | return (status); |
| 548 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 549 | void csrSetDefaultDot11Mode( tpAniSirGlobal pMac ) |
| 550 | { |
| 551 | v_U32_t wniDot11mode = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 552 | wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode); |
| 553 | ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE); |
| 554 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 555 | void csrSetGlobalCfgs( tpAniSirGlobal pMac ) |
| 556 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 558 | ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 559 | ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 560 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 561 | ((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled), |
| 562 | NULL, eANI_BOOLEAN_FALSE); |
| 563 | 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] | 564 | /* 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 |
| 565 | * Once session is established we will use the session related params stored in PE session for CB mode |
| 566 | */ |
| 567 | 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] | 568 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE); |
| 569 | |
| 570 | //Update the operating mode to configured value during initialization, |
| 571 | //So that client can advertise full capabilities in Probe request frame. |
| 572 | csrSetDefaultDot11Mode( pMac ); |
| 573 | } |
| 574 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 575 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac) |
| 576 | { |
| 577 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 578 | tANI_U32 i; |
| 579 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 580 | do |
| 581 | { |
| 582 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 583 | { |
| 584 | pSession = CSR_GET_SESSION( pMac, i ); |
| 585 | pSession->roamingTimerInfo.pMac = pMac; |
| 586 | pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 587 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 588 | pMac->roam.WaitForKeyTimerInfo.pMac = pMac; |
| 589 | pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 590 | status = palTimerAlloc(pMac->hHdd, &pMac->roam.hTimerWaitForKey, csrRoamWaitForKeyTimeOutHandler, |
| 591 | &pMac->roam.WaitForKeyTimerInfo); |
| 592 | if(!HAL_STATUS_SUCCESS(status)) |
| 593 | { |
| 594 | smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer\n")); |
| 595 | break; |
| 596 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 597 | status = palTimerAlloc(pMac->hHdd, &pMac->roam.tlStatsReqInfo.hTlStatsTimer, csrRoamTlStatsTimerHandler, pMac); |
| 598 | if(!HAL_STATUS_SUCCESS(status)) |
| 599 | { |
| 600 | smsLog(pMac, LOGE, FL("cannot allocate memory for summary Statistics timer\n")); |
| 601 | return eHAL_STATUS_FAILURE; |
| 602 | } |
| 603 | }while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 604 | return (status); |
| 605 | } |
| 606 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 607 | eHalStatus csrRoamClose(tpAniSirGlobal pMac) |
| 608 | { |
| 609 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 610 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 611 | { |
| 612 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 613 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 614 | palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey); |
| 615 | palTimerFree(pMac->hHdd, pMac->roam.hTimerWaitForKey); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 616 | palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 617 | palTimerFree(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 618 | return (eHAL_STATUS_SUCCESS); |
| 619 | } |
| 620 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 621 | eHalStatus csrRoamStart(tpAniSirGlobal pMac) |
| 622 | { |
| 623 | (void)pMac; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 624 | return (eHAL_STATUS_SUCCESS); |
| 625 | } |
| 626 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 627 | void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 628 | { |
| 629 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 630 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 631 | csrRoamDeregStatisticsReq(pMac); |
| 632 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 633 | eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState) |
| 634 | { |
| 635 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Srinivas Girigowda | c84c57c | 2013-02-19 17:41:56 -0800 | [diff] [blame] | 636 | if ( CSR_IS_SESSION_VALID(pMac, sessionId) && (NULL != pState) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 637 | { |
| 638 | status = eHAL_STATUS_SUCCESS; |
| 639 | *pState = pMac->roam.roamSession[sessionId].connectState; |
| 640 | } |
| 641 | return (status); |
| 642 | } |
| 643 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 644 | eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 645 | { |
| 646 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 647 | tANI_U32 size = 0; |
| 648 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 649 | |
| 650 | if(!pSession) |
| 651 | { |
| 652 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 653 | return eHAL_STATUS_FAILURE; |
| 654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 655 | |
| 656 | if(pProfile) |
| 657 | { |
| 658 | if(pSession->pConnectBssDesc) |
| 659 | { |
| 660 | do |
| 661 | { |
| 662 | size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length); |
| 663 | if(size) |
| 664 | { |
| 665 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile->pBssDesc, size); |
| 666 | if(HAL_STATUS_SUCCESS(status)) |
| 667 | { |
| 668 | palCopyMemory(pMac->hHdd, pProfile->pBssDesc, pSession->pConnectBssDesc, size); |
| 669 | } |
| 670 | else |
| 671 | break; |
| 672 | } |
| 673 | else |
| 674 | { |
| 675 | pProfile->pBssDesc = NULL; |
| 676 | } |
| 677 | pProfile->AuthType = pSession->connectedProfile.AuthType; |
| 678 | pProfile->EncryptionType = pSession->connectedProfile.EncryptionType; |
| 679 | pProfile->mcEncryptionType = pSession->connectedProfile.mcEncryptionType; |
| 680 | pProfile->BSSType = pSession->connectedProfile.BSSType; |
| 681 | pProfile->operationChannel = pSession->connectedProfile.operationChannel; |
| 682 | pProfile->CBMode = pSession->connectedProfile.CBMode; |
| 683 | palCopyMemory(pMac->hHdd, &pProfile->bssid, &pSession->connectedProfile.bssid, sizeof(tCsrBssid)); |
| 684 | palCopyMemory(pMac->hHdd, &pProfile->SSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid)); |
| 685 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 686 | if (pSession->connectedProfile.MDID.mdiePresent) |
| 687 | { |
| 688 | pProfile->MDID.mdiePresent = 1; |
| 689 | pProfile->MDID.mobilityDomain = pSession->connectedProfile.MDID.mobilityDomain; |
| 690 | } |
| 691 | else |
| 692 | { |
| 693 | pProfile->MDID.mdiePresent = 0; |
| 694 | pProfile->MDID.mobilityDomain = 0; |
| 695 | } |
| 696 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 697 | #ifdef FEATURE_WLAN_CCX |
| 698 | pProfile->isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 699 | if (csrIsAuthTypeCCX(pSession->connectedProfile.AuthType)) |
| 700 | { |
| 701 | palCopyMemory( pMac->hHdd, pProfile->ccxCckmInfo.krk, |
| 702 | pSession->connectedProfile.ccxCckmInfo.krk, CSR_KRK_KEY_LEN ); |
| 703 | pProfile->ccxCckmInfo.reassoc_req_num= |
| 704 | pSession->connectedProfile.ccxCckmInfo.reassoc_req_num; |
| 705 | pProfile->ccxCckmInfo.krk_plumbed = |
| 706 | pSession->connectedProfile.ccxCckmInfo.krk_plumbed; |
| 707 | } |
| 708 | #endif |
| 709 | }while(0); |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | return (status); |
| 714 | } |
| 715 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 716 | eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 717 | { |
| 718 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 719 | |
| 720 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 721 | { |
| 722 | if(pProfile) |
| 723 | { |
| 724 | status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile); |
| 725 | } |
| 726 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 727 | return (status); |
| 728 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 729 | eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile) |
| 730 | { |
| 731 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 732 | |
| 733 | if(pProfile->pBssDesc) |
| 734 | { |
| 735 | palFreeMemory(pMac->hHdd, pProfile->pBssDesc); |
| 736 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 737 | if(pProfile->pAddIEAssoc) |
| 738 | { |
| 739 | palFreeMemory(pMac->hHdd, pProfile->pAddIEAssoc); |
| 740 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 741 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamConnectedProfile)); |
| 742 | pProfile->AuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 743 | return (status); |
| 744 | } |
| 745 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 746 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ) |
| 747 | { |
| 748 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 749 | if( pConnectedInfo->pbFrames ) |
| 750 | { |
| 751 | palFreeMemory( pMac->hHdd, pConnectedInfo->pbFrames ); |
| 752 | pConnectedInfo->pbFrames = NULL; |
| 753 | } |
| 754 | pConnectedInfo->nBeaconLength = 0; |
| 755 | pConnectedInfo->nAssocReqLength = 0; |
| 756 | pConnectedInfo->nAssocRspLength = 0; |
| 757 | pConnectedInfo->staId = 0; |
| 758 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 759 | pConnectedInfo->nRICRspLength = 0; |
| 760 | #endif |
| 761 | #ifdef FEATURE_WLAN_CCX |
| 762 | pConnectedInfo->nTspecIeLength = 0; |
| 763 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | return ( status ); |
| 765 | } |
| 766 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 767 | |
| 768 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 769 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 770 | void csrReleaseCommandPreauth(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 771 | { |
| 772 | csrReinitPreauthCmd(pMac, pCommand); |
| 773 | csrReleaseCommand( pMac, pCommand ); |
| 774 | } |
| 775 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 776 | void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 777 | { |
| 778 | csrReinitRoamCmd(pMac, pCommand); |
| 779 | csrReleaseCommand( pMac, pCommand ); |
| 780 | } |
| 781 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 782 | void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 783 | { |
| 784 | csrReinitScanCmd(pMac, pCommand); |
| 785 | csrReleaseCommand( pMac, pCommand ); |
| 786 | } |
| 787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 788 | void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 789 | { |
| 790 | csrReinitWmStatusChangeCmd(pMac, pCommand); |
| 791 | csrReleaseCommand( pMac, pCommand ); |
| 792 | } |
| 793 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 794 | void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 795 | { |
| 796 | palZeroMemory(pMac->hHdd, &pCommand->u.setKeyCmd, sizeof(tSetKeyCmd)); |
| 797 | } |
| 798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 799 | void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 800 | { |
| 801 | palZeroMemory(pMac->hHdd, &pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd)); |
| 802 | } |
| 803 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 804 | void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 805 | { |
| 806 | csrReinitSetKeyCmd(pMac, pCommand); |
| 807 | csrReleaseCommand( pMac, pCommand ); |
| 808 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 809 | void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 810 | { |
| 811 | csrReinitRemoveKeyCmd(pMac, pCommand); |
| 812 | csrReleaseCommand( pMac, pCommand ); |
| 813 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 814 | void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping ) |
| 815 | { |
| 816 | |
| 817 | if( eSmeCsrCommandMask & pCommand->command ) |
| 818 | { |
| 819 | switch (pCommand->command) |
| 820 | { |
| 821 | case eSmeCommandScan: |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 822 | // We need to inform the requester before dropping the scan command |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 823 | smsLog( pMac, LOGW, "%s: Drop scan reason %d callback 0x%X\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 824 | __func__, pCommand->u.scanCmd.reason, (unsigned int)pCommand->u.scanCmd.callback); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 825 | if (NULL != pCommand->u.scanCmd.callback) |
| 826 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 827 | smsLog( pMac, LOGW, "%s callback scan requester\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 828 | csrScanCallCallback(pMac, pCommand, eCSR_SCAN_ABORT); |
| 829 | } |
| 830 | csrReleaseCommandScan( pMac, pCommand ); |
| 831 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 832 | case eSmeCommandRoam: |
| 833 | csrReleaseCommandRoam( pMac, pCommand ); |
| 834 | break; |
| 835 | |
| 836 | case eSmeCommandWmStatusChange: |
| 837 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 838 | break; |
| 839 | |
| 840 | case eSmeCommandSetKey: |
| 841 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 842 | break; |
| 843 | |
| 844 | case eSmeCommandRemoveKey: |
| 845 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 846 | break; |
| 847 | |
| 848 | default: |
| 849 | smsLog( pMac, LOGW, " CSR abort standard command %d\n", pCommand->command ); |
| 850 | csrReleaseCommand( pMac, pCommand ); |
| 851 | break; |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 856 | void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId) |
| 857 | { |
| 858 | smsLog( pMac, LOG1, " CSR RoamSubstate: [ %d <== %d ]\n", NewSubstate, pMac->roam.curSubState[sessionId]); |
| 859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 860 | if(pMac->roam.curSubState[sessionId] == NewSubstate) |
| 861 | { |
| 862 | return; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 863 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 864 | pMac->roam.curSubState[sessionId] = NewSubstate; |
| 865 | } |
| 866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 867 | eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId) |
| 868 | { |
| 869 | eCsrRoamState PreviousState; |
| 870 | |
| 871 | smsLog( pMac, LOG1, "CSR RoamState: [ %d <== %d ]\n", NewRoamState, pMac->roam.curState[sessionId]); |
| 872 | |
| 873 | PreviousState = pMac->roam.curState[sessionId]; |
| 874 | |
| 875 | if ( NewRoamState != pMac->roam.curState[sessionId] ) |
| 876 | { |
| 877 | // Whenever we transition OUT of the Roaming state, clear the Roaming substate... |
| 878 | if ( CSR_IS_ROAM_JOINING(pMac, sessionId) ) |
| 879 | { |
| 880 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 881 | } |
| 882 | |
| 883 | pMac->roam.curState[sessionId] = NewRoamState; |
| 884 | } |
| 885 | return( PreviousState ); |
| 886 | } |
| 887 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 888 | void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset) |
| 889 | { |
| 890 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 891 | if(catOffset) |
| 892 | { |
| 893 | pMac->roam.configParam.bCatRssiOffset = catOffset; |
| 894 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 895 | { |
| 896 | pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)CSR_BEST_RSSI_VALUE - (int)(i * catOffset); |
| 897 | } |
| 898 | } |
| 899 | } |
| 900 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 901 | static void initConfigParam(tpAniSirGlobal pMac) |
| 902 | { |
| 903 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 904 | pMac->roam.configParam.agingCount = CSR_AGING_COUNT; |
| 905 | pMac->roam.configParam.channelBondingMode24GHz = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 906 | pMac->roam.configParam.channelBondingMode5GHz = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 907 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 908 | pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 909 | pMac->roam.configParam.eBand = eCSR_BAND_ALL; |
| 910 | pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 911 | pMac->roam.configParam.FragmentationThreshold = eCSR_DOT11_FRAG_THRESH_DEFAULT; |
| 912 | pMac->roam.configParam.HeartbeatThresh24 = 40; |
| 913 | pMac->roam.configParam.HeartbeatThresh50 = 40; |
| 914 | pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE; |
| 915 | pMac->roam.configParam.Is11dSupportEnabledOriginal = eANI_BOOLEAN_FALSE; |
| 916 | pMac->roam.configParam.Is11eSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 917 | pMac->roam.configParam.Is11hSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 918 | pMac->roam.configParam.RTSThreshold = 2346; |
| 919 | pMac->roam.configParam.shortSlotTime = eANI_BOOLEAN_TRUE; |
| 920 | pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto; |
| 921 | pMac->roam.configParam.ProprietaryRatesEnabled = eANI_BOOLEAN_TRUE; |
| 922 | pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO; |
| 923 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 924 | pMac->roam.configParam.scanAgeTimeNCNPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS; |
| 925 | pMac->roam.configParam.scanAgeTimeNCPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS; |
| 926 | pMac->roam.configParam.scanAgeTimeCNPS = CSR_SCAN_AGING_TIME_CONNECT_NO_PS; |
| 927 | pMac->roam.configParam.scanAgeTimeCPS = CSR_SCAN_AGING_TIME_CONNECT_W_PS; |
| 928 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 929 | { |
| 930 | pMac->roam.configParam.BssPreferValue[i] = i; |
| 931 | } |
| 932 | csrAssignRssiForCategory(pMac, CSR_DEFAULT_RSSI_DB_GAP); |
| 933 | pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME; |
| 934 | pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE; |
| 935 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 936 | pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE; |
| 937 | pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE; |
| 938 | pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; |
| 939 | pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; |
| 940 | pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME; |
| 941 | pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 942 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 943 | pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC; |
| 944 | pMac->roam.configParam.nActiveMinChnTimeConc = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC; |
| 945 | pMac->roam.configParam.nPassiveMaxChnTimeConc = CSR_PASSIVE_MAX_CHANNEL_TIME_CONC; |
| 946 | pMac->roam.configParam.nPassiveMinChnTimeConc = CSR_PASSIVE_MIN_CHANNEL_TIME_CONC; |
| 947 | pMac->roam.configParam.nRestTimeConc = CSR_REST_TIME_CONC; |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 948 | pMac->roam.configParam.nNumChanCombinedConc = CSR_NUM_CHAN_COMBINED_CONC; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 949 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 950 | pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default |
| 951 | pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; |
| 952 | pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; |
| 953 | pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 954 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 955 | pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0; |
| 956 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 957 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 958 | pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3; |
| 959 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120; |
| 960 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = 125; |
| 961 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20; |
| 962 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40; |
| 963 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = 200; |
| 964 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels = 3; |
| 965 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[0] = 1; |
| 966 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[1] = 6; |
| 967 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11; |
| 968 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds |
| 969 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 970 | #ifdef WLAN_FEATURE_11AC |
| 971 | pMac->roam.configParam.nVhtChannelWidth = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1; |
| 972 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 973 | |
| 974 | pMac->roam.configParam.addTSWhenACMIsOff = 0; |
| 975 | pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE; |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 976 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 977 | //Remove this code once SLM_Sessionization is supported |
| 978 | //BMPS_WORKAROUND_NOT_NEEDED |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 979 | pMac->roam.configParam.doBMPSWorkaround = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 980 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 981 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 982 | eCsrBand csrGetCurrentBand(tHalHandle hHal) |
| 983 | { |
| 984 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 985 | return pMac->roam.configParam.bandCapability; |
| 986 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 987 | eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand) |
| 988 | { |
| 989 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 990 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 991 | if (CSR_IS_PHY_MODE_A_ONLY(pMac) && |
| 992 | (eBand == eCSR_BAND_24)) |
| 993 | { |
| 994 | /* DOT11 mode configured to 11a only and received |
| 995 | request to change the band to 2.4 GHz */ |
| 996 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 997 | "failed to set band cfg80211 = %u, band = %u\n", |
| 998 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 999 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1000 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1001 | if ((CSR_IS_PHY_MODE_B_ONLY(pMac) || |
| 1002 | CSR_IS_PHY_MODE_G_ONLY(pMac)) && |
| 1003 | (eBand == eCSR_BAND_5G)) |
| 1004 | { |
| 1005 | /* DOT11 mode configured to 11b/11g only and received |
| 1006 | request to change the band to 5 GHz */ |
| 1007 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 1008 | "failed to set band dot11mode = %u, band = %u\n", |
| 1009 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1010 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1011 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1012 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1013 | "Band changed to %u (0 - ALL, 1 - 2.4 GHZ, 2 - 5GHZ)\n", eBand); |
| 1014 | pMac->roam.configParam.eBand = eBand; |
| 1015 | pMac->roam.configParam.bandCapability = eBand; |
| 1016 | csrScanGetSupportedChannels( pMac ); |
| 1017 | status = csrInitGetChannels( pMac ); |
| 1018 | if (eHAL_STATUS_SUCCESS == status) |
| 1019 | csrInitChannelList( hHal ); |
| 1020 | return status; |
| 1021 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1022 | /* The funcns csrConvertCBIniValueToPhyCBState and csrConvertPhyCBStateToIniValue have been |
| 1023 | * introduced to convert the ini value to the ENUM used in csr and MAC for CB state |
| 1024 | * Ideally we should have kept the ini value and enum value same and representing the same |
| 1025 | * cb values as in 11n standard i.e. |
| 1026 | * Set to 1 (SCA) if the secondary channel is above the primary channel |
| 1027 | * Set to 3 (SCB) if the secondary channel is below the primary channel |
| 1028 | * Set to 0 (SCN) if no secondary channel is present |
| 1029 | * However, since our driver is already distributed we will keep the ini definition as it is which is: |
| 1030 | * 0 - secondary none |
| 1031 | * 1 - secondary LOW |
| 1032 | * 2 - secondary HIGH |
| 1033 | * and convert to enum value used within the driver in csrChangeDefaultConfigParam using this funcn |
| 1034 | * The enum values are as follows: |
| 1035 | * PHY_SINGLE_CHANNEL_CENTERED = 0 |
| 1036 | * PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1 |
| 1037 | * PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 1038 | */ |
| 1039 | ePhyChanBondState csrConvertCBIniValueToPhyCBState(v_U32_t cbIniValue) |
| 1040 | { |
| 1041 | |
| 1042 | ePhyChanBondState phyCbState; |
| 1043 | switch (cbIniValue) { |
| 1044 | // secondary none |
| 1045 | case 0: |
| 1046 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1047 | break; |
| 1048 | // secondary LOW |
| 1049 | case 1: |
| 1050 | phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 1051 | break; |
| 1052 | // secondary HIGH |
| 1053 | case 2: |
| 1054 | phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 1055 | break; |
| 1056 | #ifdef WLAN_FEATURE_11AC |
| 1057 | case 3: |
| 1058 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
| 1059 | break; |
| 1060 | case 4: |
| 1061 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1062 | break; |
| 1063 | case 5: |
| 1064 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1065 | break; |
| 1066 | case 6: |
| 1067 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
| 1068 | break; |
| 1069 | case 7: |
| 1070 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
| 1071 | break; |
| 1072 | case 8: |
| 1073 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 1074 | break; |
| 1075 | case 9: |
| 1076 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
| 1077 | break; |
| 1078 | #endif |
| 1079 | default: |
| 1080 | // If an invalid value is passed, disable CHANNEL BONDING |
| 1081 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1082 | break; |
| 1083 | } |
| 1084 | return phyCbState; |
| 1085 | } |
| 1086 | |
| 1087 | v_U32_t csrConvertPhyCBStateToIniValue(ePhyChanBondState phyCbState) |
| 1088 | { |
| 1089 | |
| 1090 | v_U32_t cbIniValue; |
| 1091 | switch (phyCbState) { |
| 1092 | // secondary none |
| 1093 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 1094 | cbIniValue = 0; |
| 1095 | break; |
| 1096 | // secondary LOW |
| 1097 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 1098 | cbIniValue = 1; |
| 1099 | break; |
| 1100 | // secondary HIGH |
| 1101 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 1102 | cbIniValue = 2; |
| 1103 | break; |
| 1104 | #ifdef WLAN_FEATURE_11AC |
| 1105 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 1106 | cbIniValue = 3; |
| 1107 | break; |
| 1108 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 1109 | cbIniValue = 4; |
| 1110 | break; |
| 1111 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 1112 | cbIniValue = 5; |
| 1113 | break; |
| 1114 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 1115 | cbIniValue = 6; |
| 1116 | break; |
| 1117 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 1118 | cbIniValue = 7; |
| 1119 | break; |
| 1120 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 1121 | cbIniValue = 8; |
| 1122 | break; |
| 1123 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 1124 | cbIniValue = 9; |
| 1125 | break; |
| 1126 | #endif |
| 1127 | default: |
| 1128 | // return some invalid value |
| 1129 | cbIniValue = 10; |
| 1130 | break; |
| 1131 | } |
| 1132 | return cbIniValue; |
| 1133 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1134 | |
| 1135 | eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1136 | { |
| 1137 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1138 | |
| 1139 | if(pParam) |
| 1140 | { |
| 1141 | pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode; |
| 1142 | pMac->roam.configParam.Is11eSupportEnabled = pParam->Is11eSupportEnabled; |
| 1143 | pMac->roam.configParam.FragmentationThreshold = pParam->FragmentationThreshold; |
| 1144 | pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled; |
| 1145 | pMac->roam.configParam.Is11dSupportEnabledOriginal = pParam->Is11dSupportEnabled; |
| 1146 | pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled; |
| 1147 | |
| 1148 | pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode; |
Mohit Khanna | 7ed53f0 | 2012-09-11 17:52:10 -0700 | [diff] [blame] | 1149 | pMac->roam.configParam.fAllowMCCGODiffBI = pParam->fAllowMCCGODiffBI; |
| 1150 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1151 | /* channelBondingMode5GHz plays a dual role right now |
| 1152 | * 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 |
| 1153 | * This is how channelBondingMode5GHz works now and this is kept intact to avoid any cfg.ini change |
| 1154 | */ |
| 1155 | if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI) |
| 1156 | { |
| 1157 | smsLog( pMac, LOGW, "Invalid CB value from ini in 2.4GHz band %d, CB DISABLED\n", pParam->channelBondingMode24GHz); |
| 1158 | } |
| 1159 | pMac->roam.configParam.channelBondingMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode24GHz); |
| 1160 | if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI) |
| 1161 | { |
| 1162 | smsLog( pMac, LOGW, "Invalid CB value from ini in 5GHz band %d, CB DISABLED\n", pParam->channelBondingMode5GHz); |
| 1163 | } |
| 1164 | pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1165 | pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold; |
| 1166 | pMac->roam.configParam.phyMode = pParam->phyMode; |
| 1167 | pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime; |
| 1168 | pMac->roam.configParam.HeartbeatThresh24 = pParam->HeartbeatThresh24; |
| 1169 | pMac->roam.configParam.HeartbeatThresh50 = pParam->HeartbeatThresh50; |
| 1170 | pMac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled; |
| 1171 | pMac->roam.configParam.TxRate = pParam->TxRate; |
| 1172 | pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; |
| 1173 | pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; |
| 1174 | pMac->roam.configParam.bandCapability = pParam->bandCapability; |
| 1175 | pMac->roam.configParam.cbChoice = pParam->cbChoice; |
| 1176 | pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1177 | //if HDD passed down non zero values then only update, |
| 1178 | //otherwise keep using the defaults |
| 1179 | if(pParam->nActiveMaxChnTime) |
| 1180 | { |
| 1181 | pMac->roam.configParam.nActiveMaxChnTime = pParam->nActiveMaxChnTime; |
| 1182 | } |
| 1183 | if(pParam->nActiveMinChnTime) |
| 1184 | { |
| 1185 | pMac->roam.configParam.nActiveMinChnTime = pParam->nActiveMinChnTime; |
| 1186 | } |
| 1187 | if(pParam->nPassiveMaxChnTime) |
| 1188 | { |
| 1189 | pMac->roam.configParam.nPassiveMaxChnTime = pParam->nPassiveMaxChnTime; |
| 1190 | } |
| 1191 | if(pParam->nPassiveMinChnTime) |
| 1192 | { |
| 1193 | pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime; |
| 1194 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1195 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1196 | if(pParam->nActiveMaxChnTimeConc) |
| 1197 | { |
| 1198 | pMac->roam.configParam.nActiveMaxChnTimeConc = pParam->nActiveMaxChnTimeConc; |
| 1199 | } |
| 1200 | if(pParam->nActiveMinChnTimeConc) |
| 1201 | { |
| 1202 | pMac->roam.configParam.nActiveMinChnTimeConc = pParam->nActiveMinChnTimeConc; |
| 1203 | } |
| 1204 | if(pParam->nPassiveMaxChnTimeConc) |
| 1205 | { |
| 1206 | pMac->roam.configParam.nPassiveMaxChnTimeConc = pParam->nPassiveMaxChnTimeConc; |
| 1207 | } |
| 1208 | if(pParam->nPassiveMinChnTimeConc) |
| 1209 | { |
| 1210 | pMac->roam.configParam.nPassiveMinChnTimeConc = pParam->nPassiveMinChnTimeConc; |
| 1211 | } |
| 1212 | if(pParam->nRestTimeConc) |
| 1213 | { |
| 1214 | pMac->roam.configParam.nRestTimeConc = pParam->nRestTimeConc; |
| 1215 | } |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1216 | if(pParam->nNumChanCombinedConc) |
| 1217 | { |
| 1218 | pMac->roam.configParam.nNumChanCombinedConc = pParam->nNumChanCombinedConc; |
| 1219 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1220 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1221 | //if upper layer wants to disable idle scan altogether set it to 0 |
| 1222 | if(pParam->impsSleepTime) |
| 1223 | { |
| 1224 | //Change the unit from second to microsecond |
| 1225 | tANI_U32 impsSleepTime = pParam->impsSleepTime * PAL_TIMER_TO_SEC_UNIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1226 | if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime) |
| 1227 | { |
| 1228 | pMac->roam.configParam.impsSleepTime = impsSleepTime; |
| 1229 | } |
| 1230 | else |
| 1231 | { |
| 1232 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 1233 | } |
| 1234 | } |
| 1235 | else |
| 1236 | { |
| 1237 | pMac->roam.configParam.impsSleepTime = 0; |
| 1238 | } |
| 1239 | pMac->roam.configParam.eBand = pParam->eBand; |
| 1240 | #ifdef WLAN_SOFTAP_FEATURE |
| 1241 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, pMac->roam.configParam.phyMode, |
| 1242 | pMac->roam.configParam.ProprietaryRatesEnabled); |
| 1243 | #else |
| 1244 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pMac->roam.configParam.phyMode, |
| 1245 | pMac->roam.configParam.ProprietaryRatesEnabled); |
| 1246 | #endif |
| 1247 | //if HDD passed down non zero values for age params, then only update, |
| 1248 | //otherwise keep using the defaults |
| 1249 | if(pParam->nScanResultAgeCount) |
| 1250 | { |
| 1251 | pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount; |
| 1252 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1253 | if(pParam->scanAgeTimeNCNPS) |
| 1254 | { |
| 1255 | pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS; |
| 1256 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1257 | if(pParam->scanAgeTimeNCPS) |
| 1258 | { |
| 1259 | pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS; |
| 1260 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1261 | if(pParam->scanAgeTimeCNPS) |
| 1262 | { |
| 1263 | pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS; |
| 1264 | } |
| 1265 | if(pParam->scanAgeTimeCPS) |
| 1266 | { |
| 1267 | pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS; |
| 1268 | } |
| 1269 | |
| 1270 | csrAssignRssiForCategory(pMac, pParam->bCatRssiOffset); |
| 1271 | pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime; |
| 1272 | pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels; |
| 1273 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority; |
| 1274 | pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch; |
| 1275 | pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1276 | pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold; |
| 1277 | pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1278 | pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled; |
| 1279 | pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity; |
| 1280 | pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS; |
| 1281 | //Assign this before calling CsrInit11dInfo |
| 1282 | pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1283 | if( csrIs11dSupported( pMac ) ) |
| 1284 | { |
| 1285 | status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo); |
| 1286 | } |
| 1287 | else |
| 1288 | { |
| 1289 | pMac->scan.curScanType = eSIR_ACTIVE_SCAN; |
| 1290 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1291 | |
| 1292 | /* Initialize the power + channel information if 11h is enabled. |
| 1293 | If 11d is enabled this information has already been initialized */ |
| 1294 | if( csrIs11hSupported( pMac ) && !csrIs11dSupported( pMac ) ) |
| 1295 | { |
| 1296 | csrInitChannelPowerList(pMac, &pParam->Csr11dinfo); |
| 1297 | } |
| 1298 | |
| 1299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1300 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1301 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.csr11rConfig, &pParam->csr11rConfig, sizeof(tCsr11rConfigParams) ); |
| 1302 | smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d\n", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported); |
| 1303 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1304 | #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] | 1305 | pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1306 | pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1307 | pMac->roam.configParam.nImmediateRoamRssiDiff = pParam->nImmediateRoamRssiDiff; |
| 1308 | smsLog( pMac, LOG1, "nImmediateRoamRssiDiff = %d\n", |
| 1309 | pMac->roam.configParam.nImmediateRoamRssiDiff ); |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 1310 | pMac->roam.configParam.nRoamPrefer5GHz = pParam->nRoamPrefer5GHz; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1311 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1312 | #ifdef FEATURE_WLAN_LFR |
| 1313 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled; |
| 1314 | #endif |
| 1315 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1316 | #ifdef FEATURE_WLAN_CCX |
| 1317 | pMac->roam.configParam.isCcxIniFeatureEnabled = pParam->isCcxIniFeatureEnabled; |
| 1318 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1319 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1320 | palCopyMemory( pMac->hHdd, &pMac->roam.configParam.neighborRoamConfig, &pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1321 | smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod); |
| 1322 | smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold); |
| 1323 | smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold); |
| 1324 | smsLog( pMac, LOG1, "nNeighborScanMinChanTime = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime); |
| 1325 | smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime); |
| 1326 | smsLog( pMac, LOG1, "nMaxNeighborRetries = %d\n", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries); |
| 1327 | smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1328 | { |
| 1329 | int i; |
| 1330 | smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d\n"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1331 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1332 | { |
| 1333 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1334 | } |
| 1335 | smsLog( pMac, LOG1, "\n"); |
| 1336 | } |
| 1337 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1338 | pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff; |
| 1339 | pMac->scan.fValidateList = pParam->fValidateList; |
| 1340 | pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d; |
| 1341 | pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan; |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 1342 | pMac->scan.scanResultCfgAgingTime = pParam->scanCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1343 | pMac->roam.configParam.fScanTwice = pParam->fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1344 | pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl; |
| 1345 | /* This parameter is not available in cfg and not passed from upper layers. Instead it is initialized here |
| 1346 | * This paramtere is used in concurrency to determine if there are concurrent active sessions. |
| 1347 | * Is used as a temporary fix to disconnect all active sessions when BMPS enabled so the active session if Infra STA |
| 1348 | * will automatically connect back and resume BMPS since resume BMPS is not working when moving from concurrent to |
| 1349 | * single session |
| 1350 | */ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1351 | //Remove this code once SLM_Sessionization is supported |
| 1352 | //BMPS_WORKAROUND_NOT_NEEDED |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1353 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 1354 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1355 | #ifdef WLAN_FEATURE_11AC |
| 1356 | pMac->roam.configParam.nVhtChannelWidth = pParam->nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1357 | pMac->roam.configParam.txBFEnable= pParam->enableTxBF; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1358 | pMac->roam.configParam.txBFCsnValue = pParam->txBFCsnValue; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1359 | #endif |
Madan Mohan Koyyalamudi | 3f65e31 | 2012-11-06 15:31:12 -0800 | [diff] [blame] | 1360 | pMac->scan.fIgnore_chan165 = pParam->fIgnore_chan165; |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1361 | pMac->roam.configParam.txLdpcEnable = pParam->enableTxLdpc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1362 | } |
| 1363 | |
| 1364 | return status; |
| 1365 | } |
| 1366 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1367 | eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1368 | { |
| 1369 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1370 | if(pParam) |
| 1371 | { |
| 1372 | pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode; |
| 1373 | pParam->Is11eSupportEnabled = pMac->roam.configParam.Is11eSupportEnabled; |
| 1374 | pParam->FragmentationThreshold = pMac->roam.configParam.FragmentationThreshold; |
| 1375 | pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled; |
| 1376 | pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 1377 | pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1378 | pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz); |
| 1379 | pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1380 | pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold; |
| 1381 | pParam->phyMode = pMac->roam.configParam.phyMode; |
| 1382 | pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 1383 | pParam->HeartbeatThresh24 = pMac->roam.configParam.HeartbeatThresh24; |
| 1384 | pParam->HeartbeatThresh50 = pMac->roam.configParam.HeartbeatThresh50; |
| 1385 | pParam->ProprietaryRatesEnabled = pMac->roam.configParam.ProprietaryRatesEnabled; |
| 1386 | pParam->TxRate = pMac->roam.configParam.TxRate; |
| 1387 | pParam->AdHocChannel24 = pMac->roam.configParam.AdHocChannel24; |
| 1388 | pParam->AdHocChannel5G = pMac->roam.configParam.AdHocChannel5G; |
| 1389 | pParam->bandCapability = pMac->roam.configParam.bandCapability; |
| 1390 | pParam->cbChoice = pMac->roam.configParam.cbChoice; |
| 1391 | pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1392 | pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime; |
| 1393 | pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime; |
| 1394 | pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; |
| 1395 | pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1396 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1397 | pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc; |
| 1398 | pParam->nActiveMinChnTimeConc = pMac->roam.configParam.nActiveMinChnTimeConc; |
| 1399 | pParam->nPassiveMaxChnTimeConc = pMac->roam.configParam.nPassiveMaxChnTimeConc; |
| 1400 | pParam->nPassiveMinChnTimeConc = pMac->roam.configParam.nPassiveMinChnTimeConc; |
| 1401 | pParam->nRestTimeConc = pMac->roam.configParam.nRestTimeConc; |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1402 | pParam->nNumChanCombinedConc = pMac->roam.configParam.nNumChanCombinedConc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1403 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1404 | //Change the unit from microsecond to second |
| 1405 | pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT; |
| 1406 | pParam->eBand = pMac->roam.configParam.eBand; |
| 1407 | pParam->nScanResultAgeCount = pMac->roam.configParam.agingCount; |
| 1408 | pParam->scanAgeTimeNCNPS = pMac->roam.configParam.scanAgeTimeNCNPS; |
| 1409 | pParam->scanAgeTimeNCPS = pMac->roam.configParam.scanAgeTimeNCPS; |
| 1410 | pParam->scanAgeTimeCNPS = pMac->roam.configParam.scanAgeTimeCNPS; |
| 1411 | pParam->scanAgeTimeCPS = pMac->roam.configParam.scanAgeTimeCPS; |
| 1412 | pParam->bCatRssiOffset = pMac->roam.configParam.bCatRssiOffset; |
| 1413 | pParam->nRoamingTime = pMac->roam.configParam.nRoamingTime; |
| 1414 | pParam->fEnforce11dChannels = pMac->roam.configParam.fEnforce11dChannels; |
| 1415 | pParam->fSupplicantCountryCodeHasPriority = pMac->roam.configParam.fSupplicantCountryCodeHasPriority; |
| 1416 | pParam->fEnforceCountryCodeMatch = pMac->roam.configParam.fEnforceCountryCodeMatch; |
| 1417 | pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain; |
| 1418 | pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold; |
| 1419 | pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1420 | pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled; |
| 1421 | pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap; |
| 1422 | pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 1423 | pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1424 | pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff; |
| 1425 | pParam->fValidateList = pMac->roam.configParam.fValidateList; |
| 1426 | pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d; |
| 1427 | pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan; |
Madan Mohan Koyyalamudi | 3f65e31 | 2012-11-06 15:31:12 -0800 | [diff] [blame] | 1428 | pParam->fIgnore_chan165= pMac->scan.fIgnore_chan165; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1429 | pParam->fScanTwice = pMac->roam.configParam.fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1430 | pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl; |
Madan Mohan Koyyalamudi | ed41951 | 2012-11-29 15:53:46 -0800 | [diff] [blame] | 1431 | pParam->fEnableMCCMode = pMac->roam.configParam.fenableMCCMode; |
Madan Mohan Koyyalamudi | 057bd80 | 2012-11-29 16:02:39 -0800 | [diff] [blame] | 1432 | pParam->fAllowMCCGODiffBI = pMac->roam.configParam.fAllowMCCGODiffBI; |
Sunil Ravi | 39b2e53 | 2013-01-20 23:45:53 -0800 | [diff] [blame] | 1433 | pParam->scanCfgAgingTime = pMac->scan.scanResultCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1434 | |
| 1435 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1436 | palCopyMemory( pMac->hHdd, &pParam->neighborRoamConfig, &pMac->roam.configParam.neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) ); |
| 1437 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1438 | #ifdef WLAN_FEATURE_11AC |
| 1439 | pParam->nVhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1440 | pParam->enableTxBF = pMac->roam.configParam.txBFEnable; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1441 | pParam->txBFCsnValue = pMac->roam.configParam.txBFCsnValue; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1442 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1443 | |
| 1444 | csrSetChannels(pMac, pParam); |
| 1445 | |
| 1446 | status = eHAL_STATUS_SUCCESS; |
| 1447 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1448 | return (status); |
| 1449 | } |
| 1450 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1451 | eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded) |
| 1452 | { |
| 1453 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 1454 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1455 | tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE; |
| 1456 | eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1457 | do |
| 1458 | { |
| 1459 | if(eCSR_BAND_24 == eBand) |
| 1460 | { |
| 1461 | if(CSR_IS_RADIO_A_ONLY(pMac)) break; |
| 1462 | if((eCSR_DOT11_MODE_11a & phyMode) || (eCSR_DOT11_MODE_11a_ONLY & phyMode)) break; |
| 1463 | } |
| 1464 | if(eCSR_BAND_5G == eBand) |
| 1465 | { |
| 1466 | if(CSR_IS_RADIO_BG_ONLY(pMac)) break; |
| 1467 | if((eCSR_DOT11_MODE_11b & phyMode) || (eCSR_DOT11_MODE_11b_ONLY & phyMode) || |
| 1468 | (eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1469 | ) |
| 1470 | { |
| 1471 | break; |
| 1472 | } |
| 1473 | } |
| 1474 | if((0 == phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode)) |
| 1475 | { |
| 1476 | newPhyMode = eCSR_DOT11_MODE_TAURUS; |
| 1477 | } |
| 1478 | else if(eCSR_DOT11_MODE_AUTO & phyMode) |
| 1479 | { |
| 1480 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1481 | } |
| 1482 | else |
| 1483 | { |
| 1484 | //Check for dual band and higher capability first |
| 1485 | if(eCSR_DOT11_MODE_11n_ONLY & phyMode) |
| 1486 | { |
| 1487 | if(eCSR_DOT11_MODE_11n_ONLY != phyMode) break; |
| 1488 | newPhyMode = eCSR_DOT11_MODE_11n_ONLY; |
| 1489 | } |
| 1490 | else if(eCSR_DOT11_MODE_11a_ONLY & phyMode) |
| 1491 | { |
| 1492 | if(eCSR_DOT11_MODE_11a_ONLY != phyMode) break; |
| 1493 | if(eCSR_BAND_24 == eBand) break; |
| 1494 | newPhyMode = eCSR_DOT11_MODE_11a_ONLY; |
| 1495 | eBand = eCSR_BAND_5G; |
| 1496 | } |
| 1497 | else if(eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1498 | { |
| 1499 | if(eCSR_DOT11_MODE_11g_ONLY != phyMode) break; |
| 1500 | if(eCSR_BAND_5G == eBand) break; |
| 1501 | newPhyMode = eCSR_DOT11_MODE_11g_ONLY; |
| 1502 | eBand = eCSR_BAND_24; |
| 1503 | } |
| 1504 | else if(eCSR_DOT11_MODE_11b_ONLY & phyMode) |
| 1505 | { |
| 1506 | if(eCSR_DOT11_MODE_11b_ONLY != phyMode) break; |
| 1507 | if(eCSR_BAND_5G == eBand) break; |
| 1508 | newPhyMode = eCSR_DOT11_MODE_11b_ONLY; |
| 1509 | eBand = eCSR_BAND_24; |
| 1510 | } |
| 1511 | else if(eCSR_DOT11_MODE_11n & phyMode) |
| 1512 | { |
| 1513 | newPhyMode = eCSR_DOT11_MODE_11n; |
| 1514 | } |
| 1515 | else if(eCSR_DOT11_MODE_abg & phyMode) |
| 1516 | { |
| 1517 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1518 | } |
| 1519 | else if(eCSR_DOT11_MODE_11a & phyMode) |
| 1520 | { |
| 1521 | if((eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11b & phyMode)) |
| 1522 | { |
| 1523 | if(eCSR_BAND_ALL == eBand) |
| 1524 | { |
| 1525 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1526 | } |
| 1527 | else |
| 1528 | { |
| 1529 | //bad setting |
| 1530 | break; |
| 1531 | } |
| 1532 | } |
| 1533 | else |
| 1534 | { |
| 1535 | newPhyMode = eCSR_DOT11_MODE_11a; |
| 1536 | eBand = eCSR_BAND_5G; |
| 1537 | } |
| 1538 | } |
| 1539 | else if(eCSR_DOT11_MODE_11g & phyMode) |
| 1540 | { |
| 1541 | newPhyMode = eCSR_DOT11_MODE_11g; |
| 1542 | eBand = eCSR_BAND_24; |
| 1543 | } |
| 1544 | else if(eCSR_DOT11_MODE_11b & phyMode) |
| 1545 | { |
| 1546 | newPhyMode = eCSR_DOT11_MODE_11b; |
| 1547 | eBand = eCSR_BAND_24; |
| 1548 | } |
| 1549 | else |
| 1550 | { |
| 1551 | //We will never be here |
| 1552 | smsLog( pMac, LOGE, FL(" cannot recognize the phy mode 0x%08X\n"), phyMode ); |
| 1553 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1554 | } |
| 1555 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1556 | //Done validating |
| 1557 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1558 | //Now we need to check whether a restart is needed. |
| 1559 | if(eBand != pMac->roam.configParam.eBand) |
| 1560 | { |
| 1561 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1562 | break; |
| 1563 | } |
| 1564 | if(newPhyMode != pMac->roam.configParam.phyMode) |
| 1565 | { |
| 1566 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1567 | break; |
| 1568 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1569 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1570 | if(HAL_STATUS_SUCCESS(status)) |
| 1571 | { |
| 1572 | pMac->roam.configParam.eBand = eBand; |
| 1573 | pMac->roam.configParam.phyMode = newPhyMode; |
| 1574 | if(pfRestartNeeded) |
| 1575 | { |
| 1576 | *pfRestartNeeded = fRestartNeeded; |
| 1577 | } |
| 1578 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1579 | return (status); |
| 1580 | } |
| 1581 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1582 | void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList ) |
| 1583 | { |
| 1584 | tANI_U8 Index; |
| 1585 | tANI_U8 cChannels; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1586 | // for dual band NICs, don't need to trim the channel list.... |
| 1587 | if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) ) |
| 1588 | { |
| 1589 | // 2.4 GHz band operation requires the channel list to be trimmed to |
| 1590 | // the 2.4 GHz channels only... |
| 1591 | if ( CSR_IS_24_BAND_ONLY( pMac ) ) |
| 1592 | { |
| 1593 | for( Index = 0, cChannels = 0; Index < pChannelList->numChannels; |
| 1594 | Index++ ) |
| 1595 | { |
| 1596 | if ( CSR_IS_CHANNEL_24GHZ(pChannelList->channelList[ Index ]) ) |
| 1597 | { |
| 1598 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 1599 | cChannels++; |
| 1600 | } |
| 1601 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1602 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 1603 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 1604 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 1605 | // only if we need to. |
| 1606 | // |
| 1607 | // The amount of memory to clear is the number of channesl that we trimmed |
| 1608 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 1609 | |
| 1610 | if ( pChannelList->numChannels > cChannels ) |
| 1611 | { |
| 1612 | palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ], |
| 1613 | sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) ); |
| 1614 | |
| 1615 | } |
| 1616 | |
| 1617 | pChannelList->numChannels = cChannels; |
| 1618 | } |
| 1619 | else if ( CSR_IS_5G_BAND_ONLY( pMac ) ) |
| 1620 | { |
| 1621 | for ( Index = 0, cChannels = 0; Index < pChannelList->numChannels; Index++ ) |
| 1622 | { |
| 1623 | if ( CSR_IS_CHANNEL_5GHZ(pChannelList->channelList[ Index ]) ) |
| 1624 | { |
| 1625 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 1626 | cChannels++; |
| 1627 | } |
| 1628 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1629 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 1630 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 1631 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 1632 | // only if we need to. |
| 1633 | // |
| 1634 | // The amount of memory to clear is the number of channesl that we trimmed |
| 1635 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 1636 | if ( pChannelList->numChannels > cChannels ) |
| 1637 | { |
| 1638 | palZeroMemory( pMac->hHdd, &pChannelList->channelList[ cChannels ], |
| 1639 | sizeof( pChannelList->channelList[ 0 ] ) * ( pChannelList->numChannels - cChannels ) ); |
| 1640 | } |
| 1641 | |
| 1642 | pChannelList->numChannels = cChannels; |
| 1643 | } |
| 1644 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1645 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1646 | #ifdef WLAN_SOFTAP_FEATURE |
| 1647 | #define INFRA_AP_DEFAULT_CHANNEL 6 |
| 1648 | eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum) |
| 1649 | { |
| 1650 | tANI_U8 index= 0; |
| 1651 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1652 | for (index=0; index < pMac->scan.base20MHzChannels.numChannels ;index++) |
| 1653 | { |
| 1654 | if(pMac->scan.base20MHzChannels.channelList[ index ] == chnNum){ |
| 1655 | status = eHAL_STATUS_SUCCESS; |
| 1656 | break; |
| 1657 | } |
| 1658 | } |
| 1659 | return status; |
| 1660 | } |
| 1661 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1662 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac) |
| 1663 | { |
| 1664 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1665 | tANI_U8 num20MHzChannelsFound = 0; |
| 1666 | VOS_STATUS vosStatus; |
| 1667 | tANI_U8 Index = 0; |
| 1668 | tANI_U8 num40MHzChannelsFound = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1669 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1670 | |
| 1671 | //TODO: this interface changed to include the 40MHz channel list |
| 1672 | // this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation |
| 1673 | // Read the scan channel list (including the power limit) from EEPROM |
| 1674 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 1675 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 1676 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 1677 | { |
| 1678 | smsLog( pMac, LOGE, FL("failed to get channels \n")); |
| 1679 | status = eHAL_STATUS_FAILURE; |
| 1680 | } |
| 1681 | else |
| 1682 | { |
| 1683 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 1684 | { |
| 1685 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1686 | } |
| 1687 | pMac->scan.numChannelsDefault = num20MHzChannelsFound; |
| 1688 | // Move the channel list to the global data |
| 1689 | // structure -- this will be used as the scan list |
| 1690 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 1691 | { |
| 1692 | #ifdef FEATURE_WLAN_INTEGRATED_SOC /* Need to fix this while dealing with NV item */ |
| 1693 | pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[ Index ].chanId; |
| 1694 | #else |
| 1695 | pMac->scan.base20MHzChannels.channelList[ Index ] = Index + 1; |
| 1696 | pMac->scan.defaultPowerTable[Index].chanId = Index + 1; |
| 1697 | pMac->scan.defaultPowerTable[Index].pwr = 25; |
| 1698 | #endif |
| 1699 | } |
| 1700 | pMac->scan.base20MHzChannels.numChannels = num20MHzChannelsFound; |
| 1701 | if(num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 1702 | { |
| 1703 | num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1704 | } |
| 1705 | for ( Index = 0; Index < num40MHzChannelsFound; Index++) |
| 1706 | { |
| 1707 | pMac->scan.base40MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable40MHz[ Index ].chanId; |
| 1708 | } |
| 1709 | pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound; |
| 1710 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1711 | return (status); |
| 1712 | } |
| 1713 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1714 | eHalStatus csrInitChannelList( tHalHandle hHal ) |
| 1715 | { |
| 1716 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1717 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1718 | csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels); |
| 1719 | csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels); |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 1720 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_FALSE); |
| 1721 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1722 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 1723 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1724 | |
| 1725 | return (status); |
| 1726 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1727 | eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, |
| 1728 | tCsrUpdateConfigParam *pUpdateConfigParam) |
| 1729 | { |
| 1730 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1731 | tCsr11dinfo *ps11dinfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1732 | ps11dinfo = &pUpdateConfigParam->Csr11dinfo; |
| 1733 | status = CsrInit11dInfo(pMac, ps11dinfo); |
| 1734 | return status; |
| 1735 | } |
| 1736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1737 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 1738 | { |
| 1739 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1740 | tANI_U8 index; |
| 1741 | tANI_U32 count=0; |
| 1742 | tSirMacChanInfo *pChanInfo; |
| 1743 | tSirMacChanInfo *pChanInfoStart; |
| 1744 | tANI_BOOLEAN applyConfig = TRUE; |
| 1745 | |
| 1746 | if(!ps11dinfo) |
| 1747 | { |
| 1748 | return (status); |
| 1749 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1750 | if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) ) |
| 1751 | { |
| 1752 | pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels; |
| 1753 | status = palCopyMemory(pMac->hHdd, pMac->scan.base20MHzChannels.channelList, |
| 1754 | ps11dinfo->Channels.channelList, ps11dinfo->Channels.numChannels); |
| 1755 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
| 1756 | } |
| 1757 | else |
| 1758 | { |
| 1759 | //No change |
| 1760 | return (eHAL_STATUS_SUCCESS); |
| 1761 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1762 | //legacy maintenance |
| 1763 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, |
| 1764 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 1765 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1766 | //Tush: at csropen get this initialized with default, during csr reset if this |
| 1767 | // already set with some value no need initilaize with default again |
| 1768 | if(0 == pMac->scan.countryCodeCurrent[0]) |
| 1769 | { |
| 1770 | status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, |
| 1771 | ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN); |
| 1772 | if(!HAL_STATUS_SUCCESS(status)) return (status); |
| 1773 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1774 | // need to add the max power channel list |
| 1775 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN))) |
| 1776 | { |
| 1777 | palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 1778 | pChanInfoStart = pChanInfo; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1779 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 1780 | { |
| 1781 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 1782 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 1783 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 1784 | pChanInfo++; |
| 1785 | count++; |
| 1786 | } |
| 1787 | if(count) |
| 1788 | { |
| 1789 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 1790 | } |
| 1791 | palFreeMemory(pMac->hHdd, pChanInfoStart); |
| 1792 | } |
| 1793 | //Only apply them to CFG when not in STOP state. Otherwise they will be applied later |
| 1794 | if( HAL_STATUS_SUCCESS(status) ) |
| 1795 | { |
| 1796 | for( index = 0; index < CSR_ROAM_SESSION_MAX; index++ ) |
| 1797 | { |
| 1798 | if((CSR_IS_SESSION_VALID(pMac, index)) && CSR_IS_ROAM_STOP(pMac, index)) |
| 1799 | { |
| 1800 | applyConfig = FALSE; |
| 1801 | } |
| 1802 | } |
| 1803 | |
| 1804 | if(TRUE == applyConfig) |
| 1805 | { |
| 1806 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 1807 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1808 | } |
| 1809 | |
| 1810 | } |
| 1811 | return (status); |
| 1812 | } |
| 1813 | /* Initialize the Channel + Power List in the local cache and in the CFG */ |
| 1814 | eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 1815 | { |
| 1816 | tANI_U8 index; |
| 1817 | tANI_U32 count=0; |
| 1818 | tSirMacChanInfo *pChanInfo; |
| 1819 | tSirMacChanInfo *pChanInfoStart; |
| 1820 | |
| 1821 | if(!ps11dinfo || !pMac) |
| 1822 | { |
| 1823 | return eHAL_STATUS_FAILURE; |
| 1824 | } |
| 1825 | |
| 1826 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN))) |
| 1827 | { |
| 1828 | palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 1829 | pChanInfoStart = pChanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1830 | |
| 1831 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 1832 | { |
| 1833 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 1834 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 1835 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 1836 | pChanInfo++; |
| 1837 | count++; |
| 1838 | } |
| 1839 | if(count) |
| 1840 | { |
| 1841 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 1842 | } |
| 1843 | palFreeMemory(pMac->hHdd, pChanInfoStart); |
| 1844 | } |
| 1845 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1846 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1847 | } |
| 1848 | |
| 1849 | //pCommand may be NULL |
| 1850 | //Pass in sessionId in case pCommand is NULL. sessionId is not used in case pCommand is not NULL. |
| 1851 | void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason) |
| 1852 | { |
| 1853 | tListElem *pEntry, *pNextEntry; |
| 1854 | tSmeCmd *pDupCommand; |
| 1855 | tDblLinkList localList; |
| 1856 | |
| 1857 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 1858 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 1859 | { |
| 1860 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 1861 | return; |
| 1862 | } |
| 1863 | csrLLLock( &pMac->sme.smeCmdPendingList ); |
| 1864 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK ); |
| 1865 | while( pEntry ) |
| 1866 | { |
| 1867 | pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ); |
| 1868 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1869 | // Remove the previous command if.. |
| 1870 | // - the new roam command is for the same RoamReason... |
| 1871 | // - the new roam command is a NewProfileList. |
| 1872 | // - the new roam command is a Forced Dissoc |
| 1873 | // - the new roam command is from an 802.11 OID (OID_SSID or OID_BSSID). |
| 1874 | if ( |
| 1875 | (pCommand && ( pCommand->sessionId == pDupCommand->sessionId ) && |
| 1876 | ((pCommand->command == pDupCommand->command) && |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 1877 | /* This peermac check is requried for Softap/GO scenarios |
| 1878 | * For STA scenario below OR check will suffice as pCommand will |
| 1879 | * always be NULL for STA scenarios |
| 1880 | */ |
| 1881 | (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] | 1882 | (pCommand->u.roamCmd.roamReason == pDupCommand->u.roamCmd.roamReason || |
| 1883 | eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason || |
| 1884 | eCsrHddIssued == pCommand->u.roamCmd.roamReason))) |
| 1885 | || |
| 1886 | //below the pCommand is NULL |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1887 | ( (sessionId == pDupCommand->sessionId) && |
| 1888 | (eSmeCommandRoam == pDupCommand->command) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1889 | ((eCsrForcedDisassoc == eRoamReason) || |
| 1890 | (eCsrHddIssued == eRoamReason)) |
| 1891 | ) |
| 1892 | ) |
| 1893 | { |
| 1894 | smsLog(pMac, LOGW, FL(" roamReason = %d\n"), pDupCommand->u.roamCmd.roamReason); |
| 1895 | // Remove the 'stale' roam command from the pending list... |
| 1896 | if(csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK )) |
| 1897 | { |
| 1898 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 1899 | } |
| 1900 | } |
| 1901 | pEntry = pNextEntry; |
| 1902 | } |
| 1903 | csrLLUnlock( &pMac->sme.smeCmdPendingList ); |
| 1904 | |
| 1905 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 1906 | { |
| 1907 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 1908 | //Tell caller that the command is cancelled |
| 1909 | csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL, pDupCommand->u.roamCmd.roamId, |
| 1910 | eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE); |
| 1911 | csrReleaseCommandRoam(pMac, pDupCommand); |
| 1912 | } |
| 1913 | csrLLClose(&localList); |
| 1914 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1915 | eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, |
| 1916 | tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2) |
| 1917 | { |
| 1918 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1919 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 1920 | WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type); |
| 1921 | #endif |
| 1922 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1923 | if( CSR_IS_SESSION_VALID( pMac, sessionId) ) |
| 1924 | { |
| 1925 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 1926 | } |
| 1927 | else |
| 1928 | { |
| 1929 | smsLog(pMac, LOGE, "Session ID:%d is not valid\n", sessionId); |
| 1930 | VOS_ASSERT(0); |
| 1931 | return eHAL_STATUS_FAILURE; |
| 1932 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1933 | if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo) |
| 1934 | { |
| 1935 | smsLog(pMac, LOGW, " Assoc complete result = %d statusCode = %d reasonCode = %d\n", u2, pRoamInfo->statusCode, pRoamInfo->reasonCode); |
| 1936 | } |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 1937 | if ((u1 == eCSR_ROAM_FT_REASSOC_FAILED) && (pSession->bRefAssocStartCnt)) { |
| 1938 | /* |
| 1939 | * Decrement bRefAssocStartCnt for FT reassoc failure. |
| 1940 | * Reason: For FT reassoc failures, we first call |
| 1941 | * csrRoamCallCallback before notifying a failed roam |
| 1942 | * completion through csrRoamComplete. The latter in |
| 1943 | * turn calls csrRoamProcessResults which tries to |
| 1944 | * once again call csrRoamCallCallback if bRefAssocStartCnt |
| 1945 | * is non-zero. Since this is redundant for FT reassoc |
| 1946 | * failure, decrement bRefAssocStartCnt. |
| 1947 | */ |
| 1948 | pSession->bRefAssocStartCnt--; |
| 1949 | } |
| 1950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1951 | if ( (pSession == NULL) || |
| 1952 | (eANI_BOOLEAN_FALSE == pSession->sessionActive) ) |
| 1953 | { |
| 1954 | smsLog(pMac, LOG1, "Session ID is not valid\n"); |
| 1955 | return eHAL_STATUS_FAILURE; |
| 1956 | } |
| 1957 | |
| 1958 | if(NULL != pSession->callback) |
| 1959 | { |
| 1960 | if( pRoamInfo ) |
| 1961 | { |
| 1962 | pRoamInfo->sessionId = (tANI_U8)sessionId; |
| 1963 | } |
| 1964 | |
| 1965 | /* avoid holding the global lock when making the roaming callback , original change came |
| 1966 | from a raised CR (CR304874). Since this callback is in HDD a potential deadlock |
| 1967 | is possible on other OS ports where the callback may need to take locks to protect |
| 1968 | HDD state |
| 1969 | UPDATE : revert this change but keep the comments here. Need to revisit as there are callbacks |
| 1970 | that may actually depend on the lock being held */ |
| 1971 | // TODO: revisit: sme_ReleaseGlobalLock( &pMac->sme ); |
| 1972 | status = pSession->callback(pSession->pContext, pRoamInfo, roamId, u1, u2); |
| 1973 | // TODO: revisit: sme_AcquireGlobalLock( &pMac->sme ); |
| 1974 | } |
| 1975 | //EVENT_WLAN_STATUS: eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 1976 | // eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED, |
| 1977 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 1978 | palZeroMemory(pMac->hHdd, &connectionStatus, sizeof(vos_event_wlan_status_payload_type)); |
| 1979 | if((eCSR_ROAM_ASSOCIATION_COMPLETION == u1) && (eCSR_ROAM_RESULT_ASSOCIATED == u2)) |
| 1980 | { |
| 1981 | connectionStatus.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 1982 | connectionStatus.bssType = pRoamInfo->u.pConnectedProfile->BSSType; |
| 1983 | if(NULL != pRoamInfo->pBssDesc) |
| 1984 | { |
| 1985 | connectionStatus.rssi = pRoamInfo->pBssDesc->rssi * (-1); |
| 1986 | connectionStatus.channel = pRoamInfo->pBssDesc->channelId; |
| 1987 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1988 | connectionStatus.qosCapability = pRoamInfo->u.pConnectedProfile->qosConnection; |
| 1989 | connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType); |
| 1990 | connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType); |
| 1991 | palCopyMemory(pMac->hHdd, connectionStatus.ssid, pRoamInfo->u.pConnectedProfile->SSID.ssId, 6); |
| 1992 | connectionStatus.reason = eCSR_REASON_UNSPECIFIED; |
| 1993 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 1994 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1995 | if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2)) |
| 1996 | { |
| 1997 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 1998 | connectionStatus.reason = eCSR_REASON_MIC_ERROR; |
| 1999 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2000 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2001 | if(eCSR_ROAM_RESULT_FORCED == u2) |
| 2002 | { |
| 2003 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2004 | connectionStatus.reason = eCSR_REASON_USER_REQUESTED; |
| 2005 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2006 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2007 | if(eCSR_ROAM_RESULT_DISASSOC_IND == u2) |
| 2008 | { |
| 2009 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2010 | connectionStatus.reason = eCSR_REASON_DISASSOC; |
| 2011 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2012 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2013 | if(eCSR_ROAM_RESULT_DEAUTH_IND == u2) |
| 2014 | { |
| 2015 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2016 | connectionStatus.reason = eCSR_REASON_DEAUTH; |
| 2017 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2018 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2019 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2020 | |
| 2021 | return (status); |
| 2022 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2023 | // Returns whether handoff is currently in progress or not |
| 2024 | tANI_BOOLEAN csrRoamIsHandoffInProgress(tpAniSirGlobal pMac) |
| 2025 | { |
| 2026 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 2027 | return csrNeighborRoamIsHandoffInProgress(pMac); |
| 2028 | #else |
| 2029 | return eANI_BOOLEAN_FALSE; |
| 2030 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2031 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2032 | eHalStatus csrRoamIssueDisassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2033 | eCsrRoamSubState NewSubstate, tANI_BOOLEAN fMICFailure ) |
| 2034 | { |
| 2035 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2036 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2037 | tANI_U16 reasonCode; |
| 2038 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2039 | |
| 2040 | if(!pSession) |
| 2041 | { |
| 2042 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2043 | return eHAL_STATUS_FAILURE; |
| 2044 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2045 | |
| 2046 | //Restore AC weight in case we change it |
| 2047 | if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 2048 | { |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 2049 | 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] | 2050 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 2051 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 2052 | } |
| 2053 | |
| 2054 | if ( fMICFailure ) |
| 2055 | { |
| 2056 | reasonCode = eSIR_MAC_MIC_FAILURE_REASON; |
| 2057 | } |
| 2058 | else if (NewSubstate == eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF) |
| 2059 | { |
| 2060 | reasonCode = eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2061 | } |
| 2062 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2063 | { |
| 2064 | reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 2065 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2066 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2067 | if ( (csrRoamIsHandoffInProgress(pMac)) && |
| 2068 | (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF)) |
| 2069 | { |
| 2070 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2071 | palCopyMemory(pMac->hHdd, &bssId, pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, sizeof(tSirMacAddr)); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2072 | } |
| 2073 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2074 | #endif |
| 2075 | if(pSession->pConnectBssDesc) |
| 2076 | { |
| 2077 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2078 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2079 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2080 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 2081 | smsLog( pMac, LOG2, "CSR Attempting to Disassociate Bssid=%02x-%02x-%02x-%02x-%02x-%02x" |
| 2082 | "subState = %d reason=%d", bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], bssId[ 3 ], |
| 2083 | bssId[ 4 ], bssId[ 5 ], NewSubstate, reasonCode); |
| 2084 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2085 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2086 | |
| 2087 | status = csrSendMBDisassocReqMsg( pMac, sessionId, bssId, reasonCode ); |
| 2088 | |
| 2089 | if(HAL_STATUS_SUCCESS(status)) |
| 2090 | { |
| 2091 | csrRoamLinkDown(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2092 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2093 | //no need to tell QoS that we are disassociating, it will be taken care off in assoc req for HO |
| 2094 | if(eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate) |
| 2095 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2096 | //notify QoS module that disassoc happening |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2097 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 2098 | } |
| 2099 | #endif |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2100 | } |
| 2101 | else |
| 2102 | { |
| 2103 | smsLog(pMac, LOGW, FL("csrSendMBDisassocReqMsg failed with status %d"), status); |
| 2104 | } |
| 2105 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2106 | return (status); |
| 2107 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2108 | #ifdef WLAN_SOFTAP_FEATURE |
| 2109 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2110 | /* --------------------------------------------------------------------------- |
| 2111 | \fn csrRoamIssueDisassociateStaCmd |
| 2112 | \brief csr function that HDD calls to disassociate a associated station |
| 2113 | \param sessionId - session Id for Soft AP |
| 2114 | \param pPeerMacAddr - MAC of associated station to delete |
| 2115 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2116 | \return eHalStatus |
| 2117 | ---------------------------------------------------------------------------*/ |
| 2118 | eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, |
| 2119 | tANI_U32 sessionId, |
| 2120 | tANI_U8 *pPeerMacAddr, |
| 2121 | tANI_U32 reason) |
| 2122 | { |
| 2123 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2124 | tSmeCmd *pCommand; |
| 2125 | |
| 2126 | do |
| 2127 | { |
| 2128 | pCommand = csrGetCommandBuffer( pMac ); |
| 2129 | if ( !pCommand ) |
| 2130 | { |
| 2131 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2132 | status = eHAL_STATUS_RESOURCES; |
| 2133 | break; |
| 2134 | } |
| 2135 | pCommand->command = eSmeCommandRoam; |
| 2136 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2137 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocSta; |
| 2138 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2139 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2140 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2141 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2142 | { |
| 2143 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 2144 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2145 | } |
| 2146 | }while(0); |
| 2147 | |
| 2148 | return status; |
| 2149 | } |
| 2150 | |
| 2151 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2152 | /* --------------------------------------------------------------------------- |
| 2153 | \fn csrRoamIssueDeauthSta |
| 2154 | \brief csr function that HDD calls to delete a associated station |
| 2155 | \param sessionId - session Id for Soft AP |
| 2156 | \param pPeerMacAddr - MAC of associated station to delete |
| 2157 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2158 | \return eHalStatus |
| 2159 | ---------------------------------------------------------------------------*/ |
| 2160 | eHalStatus csrRoamIssueDeauthStaCmd( tpAniSirGlobal pMac, |
| 2161 | tANI_U32 sessionId, |
| 2162 | tANI_U8 *pPeerMacAddr, |
| 2163 | tANI_U32 reason) |
| 2164 | { |
| 2165 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2166 | tSmeCmd *pCommand; |
| 2167 | |
| 2168 | do |
| 2169 | { |
| 2170 | pCommand = csrGetCommandBuffer( pMac ); |
| 2171 | if ( !pCommand ) |
| 2172 | { |
| 2173 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2174 | status = eHAL_STATUS_RESOURCES; |
| 2175 | break; |
| 2176 | } |
| 2177 | pCommand->command = eSmeCommandRoam; |
| 2178 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2179 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 2180 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2181 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2182 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2183 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2184 | { |
| 2185 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 2186 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2187 | } |
| 2188 | }while(0); |
| 2189 | |
| 2190 | return status; |
| 2191 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2192 | eHalStatus |
| 2193 | csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2194 | tANI_BOOLEAN bEnable ) |
| 2195 | { |
| 2196 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2197 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2198 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2199 | if (!pSession) |
| 2200 | { |
| 2201 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:CSR Session not found\n"); |
| 2202 | return (status); |
| 2203 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2204 | if (pSession->pConnectBssDesc) |
| 2205 | { |
| 2206 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2207 | } |
| 2208 | else |
| 2209 | { |
| 2210 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:Connected BSS Description in CSR Session not found\n"); |
| 2211 | return (status); |
| 2212 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2213 | smsLog( pMac, LOG2, "CSR issuing tkip counter measures for Bssid = %02x-%02x-%02x-%02x-%02x-%02x, Enable = %d\n", |
| 2214 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2215 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] , bEnable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2216 | status = csrSendMBTkipCounterMeasuresReqMsg( pMac, sessionId, bEnable, bssId ); |
| 2217 | return (status); |
| 2218 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2219 | eHalStatus |
| 2220 | csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2221 | VOS_MODULE_ID modId, void *pUsrContext, |
| 2222 | void *pfnSapEventCallback, v_U8_t *pAssocStasBuf ) |
| 2223 | { |
| 2224 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2225 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2226 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2227 | if (!pSession) |
| 2228 | { |
| 2229 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:CSR Session not found\n"); |
| 2230 | return (status); |
| 2231 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2232 | if(pSession->pConnectBssDesc) |
| 2233 | { |
| 2234 | palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) ); |
| 2235 | } |
| 2236 | else |
| 2237 | { |
| 2238 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:Connected BSS Description in CSR Session not found\n"); |
| 2239 | return (status); |
| 2240 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2241 | smsLog( pMac, LOG2, "CSR getting associated stations for Bssid = %02x-%02x-%02x-%02x-%02x-%02x\n", |
| 2242 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2243 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2244 | status = csrSendMBGetAssociatedStasReqMsg( pMac, sessionId, modId, bssId, pUsrContext, pfnSapEventCallback, pAssocStasBuf ); |
| 2245 | return (status); |
| 2246 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2247 | eHalStatus |
| 2248 | csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2249 | void *pUsrContext, void *pfnSapEventCallback, v_MACADDR_t pRemoveMac ) |
| 2250 | { |
| 2251 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2252 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2253 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2254 | |
| 2255 | if (!pSession) |
| 2256 | { |
| 2257 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:CSR Session not found\n"); |
| 2258 | return (status); |
| 2259 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2260 | if(pSession->pConnectBssDesc) |
| 2261 | { |
| 2262 | palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) ); |
| 2263 | } |
| 2264 | else |
| 2265 | { |
| 2266 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:Connected BSS Description in CSR Session not found\n"); |
| 2267 | return (status); |
| 2268 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2269 | smsLog( pMac, LOG2, "CSR getting WPS Session Overlap for Bssid = %02x-%02x-%02x-%02x-%02x-%02x\n", |
| 2270 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2271 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
| 2272 | |
| 2273 | status = csrSendMBGetWPSPBCSessions( pMac, sessionId, bssId, pUsrContext, pfnSapEventCallback, pRemoveMac); |
| 2274 | |
| 2275 | return (status); |
| 2276 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2277 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2278 | eHalStatus csrRoamIssueDeauth( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 2279 | { |
| 2280 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2281 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2282 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2283 | |
| 2284 | if (!pSession) |
| 2285 | { |
| 2286 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2287 | return eHAL_STATUS_FAILURE; |
| 2288 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2289 | |
| 2290 | if(pSession->pConnectBssDesc) |
| 2291 | { |
| 2292 | palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 2293 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2294 | smsLog( pMac, LOG2, "CSR Attempting to Deauth Bssid= %02x-%02x-%02x-%02x-%02x-%02x\n", |
| 2295 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2296 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2297 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2298 | |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2299 | status = csrSendMBDeauthReqMsg( pMac, sessionId, bssId, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2300 | if(!HAL_STATUS_SUCCESS(status)) |
| 2301 | { |
| 2302 | smsLog(pMac, LOGW, FL("csrSendMBDeauthReqMsg failed with status %d"), status); |
| 2303 | } |
| 2304 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2305 | return (status); |
| 2306 | } |
| 2307 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2308 | eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc ) |
| 2309 | { |
| 2310 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2311 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2312 | tANI_U32 size; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2313 | |
| 2314 | if(!pSession) |
| 2315 | { |
| 2316 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2317 | return eHAL_STATUS_FAILURE; |
| 2318 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2319 | |
| 2320 | // If no BSS description was found in this connection (happens with start IBSS), then |
| 2321 | // nix the BSS description that we keep around for the connected BSS) and get out... |
| 2322 | if(NULL == pBssDesc) |
| 2323 | { |
| 2324 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2325 | } |
| 2326 | else |
| 2327 | { |
| 2328 | size = pBssDesc->length + sizeof( pBssDesc->length ); |
| 2329 | if(NULL != pSession->pConnectBssDesc) |
| 2330 | { |
| 2331 | if(((pSession->pConnectBssDesc->length) + sizeof(pSession->pConnectBssDesc->length)) < size) |
| 2332 | { |
| 2333 | //not enough room for the new BSS, pMac->roam.pConnectBssDesc is freed inside |
| 2334 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2335 | } |
| 2336 | } |
| 2337 | if(NULL == pSession->pConnectBssDesc) |
| 2338 | { |
| 2339 | status = palAllocateMemory( pMac->hHdd, (void **)&pSession->pConnectBssDesc, size); |
| 2340 | } |
| 2341 | if ( HAL_STATUS_SUCCESS(status) && pSession->pConnectBssDesc ) |
| 2342 | { |
| 2343 | palCopyMemory( pMac->hHdd, pSession->pConnectBssDesc, pBssDesc, size ); |
| 2344 | } |
| 2345 | } |
| 2346 | |
| 2347 | return (status); |
| 2348 | } |
| 2349 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2350 | eHalStatus csrRoamPrepareBssConfig(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2351 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 2352 | tDot11fBeaconIEs *pIes) |
| 2353 | { |
| 2354 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2355 | eCsrCfgDot11Mode cfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2356 | #if defined(VOSS_ENABLED) |
| 2357 | VOS_ASSERT( pIes != NULL ); |
| 2358 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2359 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2360 | do |
| 2361 | { |
| 2362 | palCopyMemory(pMac->hHdd, &pBssConfig->BssCap, &pBssDesc->capabilityInfo, sizeof(tSirMacCapabilityInfo)); |
| 2363 | //get qos |
| 2364 | pBssConfig->qosType = csrGetQoSFromBssDesc(pMac, pBssDesc, pIes); |
| 2365 | //get SSID |
| 2366 | if(pIes->SSID.present) |
| 2367 | { |
| 2368 | palCopyMemory(pMac->hHdd, &pBssConfig->SSID.ssId, pIes->SSID.ssid, pIes->SSID.num_ssid); |
| 2369 | pBssConfig->SSID.length = pIes->SSID.num_ssid; |
| 2370 | } |
| 2371 | else |
| 2372 | pBssConfig->SSID.length = 0; |
| 2373 | if(csrIsNULLSSID(pBssConfig->SSID.ssId, pBssConfig->SSID.length)) |
| 2374 | { |
| 2375 | smsLog(pMac, LOGW, " BSS desc SSID is a wildcard\n"); |
| 2376 | //Return failed if profile doesn't have an SSID either. |
| 2377 | if(pProfile->SSIDs.numOfSSIDs == 0) |
| 2378 | { |
| 2379 | smsLog(pMac, LOGW, " Both BSS desc and profile doesn't have SSID\n"); |
| 2380 | status = eHAL_STATUS_FAILURE; |
| 2381 | break; |
| 2382 | } |
| 2383 | } |
| 2384 | if(CSR_IS_CHANNEL_5GHZ(pBssDesc->channelId)) |
| 2385 | { |
| 2386 | pBssConfig->eBand = eCSR_BAND_5G; |
| 2387 | } |
| 2388 | else |
| 2389 | { |
| 2390 | pBssConfig->eBand = eCSR_BAND_24; |
| 2391 | } |
| 2392 | //phymode |
| 2393 | if(csrIsPhyModeMatch( pMac, pProfile->phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes )) |
| 2394 | { |
| 2395 | pBssConfig->uCfgDot11Mode = cfgDot11Mode; |
| 2396 | } |
| 2397 | else |
| 2398 | { |
| 2399 | smsLog(pMac, LOGW, " Can not find match phy mode\n"); |
| 2400 | //force it |
| 2401 | if(eCSR_BAND_24 == pBssConfig->eBand) |
| 2402 | { |
| 2403 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2404 | } |
| 2405 | else |
| 2406 | { |
| 2407 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2408 | } |
| 2409 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2410 | //Qos |
| 2411 | if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) && |
| 2412 | (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos)) |
| 2413 | { |
| 2414 | //Joining BSS is not 11n capable and WMM is disabled on client. |
| 2415 | //Disable QoS and WMM |
| 2416 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2417 | } |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2418 | |
| 2419 | if (((pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11N) || |
Pratik Bhalgat | 8d46164 | 2012-11-22 16:55:42 +0530 | [diff] [blame] | 2420 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC)) && |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2421 | ((pBssConfig->qosType != eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP) || |
| 2422 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_HCF) || |
| 2423 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_eDCF) )) |
| 2424 | { |
| 2425 | //Joining BSS is 11n capable and WMM is disabled on AP. |
| 2426 | //Assume all HT AP's are QOS AP's and enable WMM |
| 2427 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2428 | } |
| 2429 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2430 | //auth type |
| 2431 | switch( pProfile->negotiatedAuthType ) |
| 2432 | { |
| 2433 | default: |
| 2434 | case eCSR_AUTH_TYPE_WPA: |
| 2435 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2436 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2437 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2438 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2439 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2440 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2441 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2442 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2443 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2444 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2445 | break; |
| 2446 | } |
| 2447 | //short slot time |
| 2448 | if( eCSR_CFG_DOT11_MODE_11B != cfgDot11Mode ) |
| 2449 | { |
| 2450 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2451 | } |
| 2452 | else |
| 2453 | { |
| 2454 | pBssConfig->uShortSlotTime = 0; |
| 2455 | } |
| 2456 | if(pBssConfig->BssCap.ibss) |
| 2457 | { |
| 2458 | //We don't support 11h on IBSS |
| 2459 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2460 | } |
| 2461 | else |
| 2462 | { |
| 2463 | pBssConfig->f11hSupport = pMac->roam.configParam.Is11hSupportEnabled; |
| 2464 | } |
| 2465 | //power constraint |
| 2466 | pBssConfig->uPowerLimit = csrGet11hPowerConstraint(pMac, &pIes->PowerConstraints); |
| 2467 | //heartbeat |
| 2468 | if ( CSR_IS_11A_BSS( pBssDesc ) ) |
| 2469 | { |
| 2470 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2471 | } |
| 2472 | else |
| 2473 | { |
| 2474 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 2475 | } |
| 2476 | //Join timeout |
| 2477 | // 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] | 2478 | // be 10 x the BeaconInterval. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2479 | if ( pBssDesc->beaconInterval ) |
| 2480 | { |
| 2481 | //Make sure it is bigger than the minimal |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2482 | 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] | 2483 | } |
| 2484 | else |
| 2485 | { |
| 2486 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
| 2487 | } |
| 2488 | //validate CB |
| 2489 | pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes); |
| 2490 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2491 | return (status); |
| 2492 | } |
| 2493 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2494 | static eHalStatus csrRoamPrepareBssConfigFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2495 | tBssConfigParam *pBssConfig, tSirBssDescription *pBssDesc) |
| 2496 | { |
| 2497 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2498 | tANI_U8 operationChannel = 0; |
| 2499 | tANI_U8 qAPisEnabled = FALSE; |
| 2500 | //SSID |
| 2501 | pBssConfig->SSID.length = 0; |
| 2502 | if(pProfile->SSIDs.numOfSSIDs) |
| 2503 | { |
| 2504 | //only use the first one |
| 2505 | palCopyMemory(pMac->hHdd, &pBssConfig->SSID, &pProfile->SSIDs.SSIDList[0].SSID, sizeof(tSirMacSSid)); |
| 2506 | } |
| 2507 | else |
| 2508 | { |
| 2509 | //SSID must present |
| 2510 | return eHAL_STATUS_FAILURE; |
| 2511 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2512 | //Settomg up the capabilities |
| 2513 | if( csrIsBssTypeIBSS(pProfile->BSSType) ) |
| 2514 | { |
| 2515 | pBssConfig->BssCap.ibss = 1; |
| 2516 | } |
| 2517 | else |
| 2518 | { |
| 2519 | pBssConfig->BssCap.ess = 1; |
| 2520 | } |
| 2521 | if( eCSR_ENCRYPT_TYPE_NONE != pProfile->EncryptionType.encryptionType[0] ) |
| 2522 | { |
| 2523 | pBssConfig->BssCap.privacy = 1; |
| 2524 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2525 | pBssConfig->eBand = pMac->roam.configParam.eBand; |
| 2526 | //phymode |
| 2527 | if(pProfile->ChannelInfo.ChannelList) |
| 2528 | { |
| 2529 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 2530 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2531 | #ifdef WLAN_SOFTAP_FEATURE |
| 2532 | pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, operationChannel, |
| 2533 | &pBssConfig->eBand); |
| 2534 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2535 | pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, (eCsrPhyMode)pProfile->phyMode, operationChannel, |
| 2536 | &pBssConfig->eBand); |
| 2537 | #endif |
| 2538 | //QOS |
| 2539 | //Is this correct to always set to this //*** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2540 | if ( pBssConfig->BssCap.ess == 1 ) |
| 2541 | { |
| 2542 | #ifdef WLAN_SOFTAP_FEATURE |
| 2543 | /*For Softap case enable WMM*/ |
| 2544 | if(CSR_IS_INFRA_AP(pProfile) && (eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode )){ |
| 2545 | qAPisEnabled = TRUE; |
| 2546 | } |
| 2547 | else |
| 2548 | #endif |
| 2549 | if (csrRoamGetQosInfoFromBss(pMac, pBssDesc) == eHAL_STATUS_SUCCESS) { |
| 2550 | qAPisEnabled = TRUE; |
| 2551 | } else { |
| 2552 | qAPisEnabled = FALSE; |
| 2553 | } |
| 2554 | } else { |
| 2555 | qAPisEnabled = TRUE; |
| 2556 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2557 | if (( eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && qAPisEnabled) || |
| 2558 | (( eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && qAPisEnabled) || |
| 2559 | ( eCSR_CFG_DOT11_MODE_TAURUS == pBssConfig->uCfgDot11Mode ) ) //For 11n, need QoS |
| 2560 | ) |
| 2561 | { |
| 2562 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2563 | } else { |
| 2564 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2565 | } |
| 2566 | |
| 2567 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 2568 | switch( pProfile->AuthType.authType[0] ) //Take the preferred Auth type. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2569 | { |
| 2570 | default: |
| 2571 | case eCSR_AUTH_TYPE_WPA: |
| 2572 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2573 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2574 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2575 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2576 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2577 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2578 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2579 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2580 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2581 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2582 | break; |
| 2583 | } |
| 2584 | //short slot time |
| 2585 | if( WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode ) |
| 2586 | { |
| 2587 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2588 | } |
| 2589 | else |
| 2590 | { |
| 2591 | pBssConfig->uShortSlotTime = 0; |
| 2592 | } |
| 2593 | //power constraint. We don't support 11h on IBSS |
| 2594 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2595 | pBssConfig->uPowerLimit = 0; |
| 2596 | //heartbeat |
| 2597 | if ( eCSR_BAND_5G == pBssConfig->eBand ) |
| 2598 | { |
| 2599 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2600 | } |
| 2601 | else |
| 2602 | { |
| 2603 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 2604 | } |
| 2605 | //Join timeout |
| 2606 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2607 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2608 | return (status); |
| 2609 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2610 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc) |
| 2611 | { |
| 2612 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2613 | tDot11fBeaconIEs *pIes = NULL; |
| 2614 | |
| 2615 | do |
| 2616 | { |
| 2617 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 2618 | { |
| 2619 | //err msg |
| 2620 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 2621 | "csrRoamGetQosInfoFromBss() failed\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2622 | break; |
| 2623 | } |
| 2624 | //check if the AP is QAP & it supports APSD |
| 2625 | if( CSR_IS_QOS_BSS(pIes) ) |
| 2626 | { |
| 2627 | return eHAL_STATUS_SUCCESS; |
| 2628 | } |
| 2629 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2630 | return status; |
| 2631 | } |
| 2632 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2633 | void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy ) |
| 2634 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2635 | // !! Note: the only difference between this function and the csrSetCfgPrivacyFromProfile() is the |
| 2636 | // setting of the privacy CFG based on the advertised privacy setting from the AP for WPA associations. |
| 2637 | // See !!Note: below in this function... |
| 2638 | tANI_U32 PrivacyEnabled = 0; |
| 2639 | tANI_U32 RsnEnabled = 0; |
| 2640 | tANI_U32 WepDefaultKeyId = 0; |
| 2641 | tANI_U32 WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; /* default 40 bits */ |
| 2642 | tANI_U32 Key0Length = 0; |
| 2643 | tANI_U32 Key1Length = 0; |
| 2644 | tANI_U32 Key2Length = 0; |
| 2645 | tANI_U32 Key3Length = 0; |
| 2646 | |
| 2647 | // Reserve for the biggest key |
| 2648 | tANI_U8 Key0[ WNI_CFG_WEP_DEFAULT_KEY_1_LEN ]; |
| 2649 | tANI_U8 Key1[ WNI_CFG_WEP_DEFAULT_KEY_2_LEN ]; |
| 2650 | tANI_U8 Key2[ WNI_CFG_WEP_DEFAULT_KEY_3_LEN ]; |
| 2651 | tANI_U8 Key3[ WNI_CFG_WEP_DEFAULT_KEY_4_LEN ]; |
| 2652 | |
| 2653 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 2654 | { |
| 2655 | case eCSR_ENCRYPT_TYPE_NONE: |
| 2656 | |
| 2657 | // for NO encryption, turn off Privacy and Rsn. |
| 2658 | PrivacyEnabled = 0; |
| 2659 | RsnEnabled = 0; |
| 2660 | |
| 2661 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 2662 | |
| 2663 | // clear out the WEP keys that may be hanging around. |
| 2664 | Key0Length = 0; |
| 2665 | Key1Length = 0; |
| 2666 | Key2Length = 0; |
| 2667 | Key3Length = 0; |
| 2668 | |
| 2669 | break; |
| 2670 | |
| 2671 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 2672 | |
| 2673 | // Privacy is ON. NO RSN for Wep40 static key. |
| 2674 | PrivacyEnabled = 1; |
| 2675 | RsnEnabled = 0; |
| 2676 | |
| 2677 | // Set the Wep default key ID. |
| 2678 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2679 | // Wep key size if 5 bytes (40 bits). |
| 2680 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2681 | |
| 2682 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 2683 | if ( pProfile->Keys.KeyLength[0] ) |
| 2684 | { |
| 2685 | palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[0], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2686 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2687 | } |
| 2688 | else |
| 2689 | { |
| 2690 | Key0Length = 0; |
| 2691 | } |
| 2692 | |
| 2693 | if ( pProfile->Keys.KeyLength[1] ) |
| 2694 | { |
| 2695 | palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[1], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2696 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2697 | } |
| 2698 | else |
| 2699 | { |
| 2700 | Key1Length = 0; |
| 2701 | } |
| 2702 | |
| 2703 | if ( pProfile->Keys.KeyLength[2] ) |
| 2704 | { |
| 2705 | palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[2], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2706 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2707 | } |
| 2708 | else |
| 2709 | { |
| 2710 | Key2Length = 0; |
| 2711 | } |
| 2712 | |
| 2713 | if ( pProfile->Keys.KeyLength[3] ) |
| 2714 | { |
| 2715 | palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[3], WNI_CFG_WEP_KEY_LENGTH_5 ); |
| 2716 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 2717 | } |
| 2718 | else |
| 2719 | { |
| 2720 | Key3Length = 0; |
| 2721 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2722 | break; |
| 2723 | |
| 2724 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 2725 | |
| 2726 | // Privacy is ON. NO RSN for Wep40 static key. |
| 2727 | PrivacyEnabled = 1; |
| 2728 | RsnEnabled = 0; |
| 2729 | |
| 2730 | // Set the Wep default key ID. |
| 2731 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
| 2732 | |
| 2733 | // Wep key size if 13 bytes (104 bits). |
| 2734 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2735 | |
| 2736 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 2737 | if ( pProfile->Keys.KeyLength[0] ) |
| 2738 | { |
| 2739 | palCopyMemory( pMac->hHdd, Key0, pProfile->Keys.KeyMaterial[ 0 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2740 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2741 | } |
| 2742 | else |
| 2743 | { |
| 2744 | Key0Length = 0; |
| 2745 | } |
| 2746 | |
| 2747 | if ( pProfile->Keys.KeyLength[1] ) |
| 2748 | { |
| 2749 | palCopyMemory( pMac->hHdd, Key1, pProfile->Keys.KeyMaterial[ 1 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2750 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2751 | } |
| 2752 | else |
| 2753 | { |
| 2754 | Key1Length = 0; |
| 2755 | } |
| 2756 | |
| 2757 | if ( pProfile->Keys.KeyLength[2] ) |
| 2758 | { |
| 2759 | palCopyMemory( pMac->hHdd, Key2, pProfile->Keys.KeyMaterial[ 2 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2760 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2761 | } |
| 2762 | else |
| 2763 | { |
| 2764 | Key2Length = 0; |
| 2765 | } |
| 2766 | |
| 2767 | if ( pProfile->Keys.KeyLength[3] ) |
| 2768 | { |
| 2769 | palCopyMemory( pMac->hHdd, Key3, pProfile->Keys.KeyMaterial[ 3 ], WNI_CFG_WEP_KEY_LENGTH_13 ); |
| 2770 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 2771 | } |
| 2772 | else |
| 2773 | { |
| 2774 | Key3Length = 0; |
| 2775 | } |
| 2776 | |
| 2777 | break; |
| 2778 | |
| 2779 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 2780 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 2781 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 2782 | case eCSR_ENCRYPT_TYPE_AES: |
| 2783 | #ifdef FEATURE_WLAN_WAPI |
| 2784 | case eCSR_ENCRYPT_TYPE_WPI: |
| 2785 | #endif /* FEATURE_WLAN_WAPI */ |
| 2786 | // !! Note: this is the only difference between this function and the csrSetCfgPrivacyFromProfile() |
| 2787 | // (setting of the privacy CFG based on the advertised privacy setting from the AP for WPA/WAPI associations ). |
| 2788 | PrivacyEnabled = (0 != fPrivacy); |
| 2789 | |
| 2790 | // turn on RSN enabled for WPA associations |
| 2791 | RsnEnabled = 1; |
| 2792 | |
| 2793 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 2794 | |
| 2795 | // clear out the static WEP keys that may be hanging around. |
| 2796 | Key0Length = 0; |
| 2797 | Key1Length = 0; |
| 2798 | Key2Length = 0; |
| 2799 | Key3Length = 0; |
| 2800 | |
| 2801 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2802 | default: |
| 2803 | PrivacyEnabled = 0; |
| 2804 | RsnEnabled = 0; |
| 2805 | break; |
| 2806 | } |
| 2807 | |
| 2808 | ccmCfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 2809 | ccmCfgSetInt(pMac, WNI_CFG_RSN_ENABLED, RsnEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 2810 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length, NULL, eANI_BOOLEAN_FALSE); |
| 2811 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length, NULL, eANI_BOOLEAN_FALSE); |
| 2812 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length, NULL, eANI_BOOLEAN_FALSE); |
| 2813 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length, NULL, eANI_BOOLEAN_FALSE); |
| 2814 | ccmCfgSetInt(pMac, WNI_CFG_WEP_KEY_LENGTH, WepKeyLength, NULL, eANI_BOOLEAN_FALSE); |
| 2815 | ccmCfgSetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId, NULL, eANI_BOOLEAN_FALSE); |
| 2816 | } |
| 2817 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2818 | static void csrSetCfgSsid( tpAniSirGlobal pMac, tSirMacSSid *pSSID ) |
| 2819 | { |
| 2820 | tANI_U32 len = 0; |
| 2821 | if(pSSID->length <= WNI_CFG_SSID_LEN) |
| 2822 | { |
| 2823 | len = pSSID->length; |
| 2824 | } |
| 2825 | ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pSSID->ssId, len, NULL, eANI_BOOLEAN_FALSE); |
| 2826 | } |
| 2827 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2828 | eHalStatus csrSetQosToCfg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrMediaAccessType qosType ) |
| 2829 | { |
| 2830 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2831 | tANI_U32 QoSEnabled; |
| 2832 | tANI_U32 WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2833 | // set the CFG enable/disable variables based on the qosType being configured... |
| 2834 | switch( qosType ) |
| 2835 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2836 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p: |
| 2837 | QoSEnabled = FALSE; |
| 2838 | WmeEnabled = TRUE; |
| 2839 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2840 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP: |
| 2841 | QoSEnabled = FALSE; |
| 2842 | WmeEnabled = TRUE; |
| 2843 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2844 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify: |
| 2845 | QoSEnabled = FALSE; |
| 2846 | WmeEnabled = TRUE; |
| 2847 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2848 | case eCSR_MEDIUM_ACCESS_11e_eDCF: |
| 2849 | QoSEnabled = TRUE; |
| 2850 | WmeEnabled = FALSE; |
| 2851 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2852 | case eCSR_MEDIUM_ACCESS_11e_HCF: |
| 2853 | QoSEnabled = TRUE; |
| 2854 | WmeEnabled = FALSE; |
| 2855 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2856 | default: |
| 2857 | case eCSR_MEDIUM_ACCESS_DCF: |
| 2858 | QoSEnabled = FALSE; |
| 2859 | WmeEnabled = FALSE; |
| 2860 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2861 | } |
| 2862 | //save the WMM setting for later use |
| 2863 | pMac->roam.roamSession[sessionId].fWMMConnection = (tANI_BOOLEAN)WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2864 | status = ccmCfgSetInt(pMac, WNI_CFG_QOS_ENABLED, QoSEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 2865 | status = ccmCfgSetInt(pMac, WNI_CFG_WME_ENABLED, WmeEnabled, NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2866 | return (status); |
| 2867 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2868 | static eHalStatus csrGetRateSet( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc, |
| 2869 | tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet) |
| 2870 | { |
| 2871 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2872 | int i; |
| 2873 | eCsrCfgDot11Mode cfgDot11Mode; |
| 2874 | tANI_U8 *pDstRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2875 | palZeroMemory(pMac->hHdd, pOpRateSet, sizeof(tSirMacRateSet)); |
| 2876 | palZeroMemory(pMac->hHdd, pExRateSet, sizeof(tSirMacRateSet)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2877 | #if defined(VOSS_ENABLED) |
| 2878 | VOS_ASSERT( pIes != NULL ); |
| 2879 | #endif |
| 2880 | |
| 2881 | if( NULL != pIes ) |
| 2882 | { |
| 2883 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2884 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 2885 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 2886 | // appear in the Operational Rate set. Consequently, in either case, we |
| 2887 | // would blindly put the rates we support into our Operational Rate set |
| 2888 | // (including the basic rates, which we have already verified are |
| 2889 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2890 | // However, it turns out that this is not always the case. Some AP's |
| 2891 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 2892 | // too. Now, we're a little more careful: |
| 2893 | pDstRate = pOpRateSet->rate; |
| 2894 | if(pIes->SuppRates.present) |
| 2895 | { |
| 2896 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 2897 | { |
| 2898 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) ) |
| 2899 | { |
| 2900 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 2901 | pOpRateSet->numRates++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2902 | } |
| 2903 | } |
| 2904 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2905 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 2906 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 2907 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 2908 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 2909 | { |
| 2910 | // If there are Extended Rates in the beacon, we will reflect those |
| 2911 | // extended rates that we support in out Extended Operational Rate |
| 2912 | // set: |
| 2913 | pDstRate = pExRateSet->rate; |
| 2914 | if(pIes->ExtSuppRates.present) |
| 2915 | { |
| 2916 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 2917 | { |
| 2918 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) ) |
| 2919 | { |
| 2920 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 2921 | pExRateSet->numRates++; |
| 2922 | } |
| 2923 | } |
| 2924 | } |
| 2925 | } |
| 2926 | }//Parsing BSSDesc |
| 2927 | else |
| 2928 | { |
| 2929 | smsLog(pMac, LOGE, FL("failed to parse BssDesc\n")); |
| 2930 | } |
| 2931 | if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0) status = eHAL_STATUS_SUCCESS; |
| 2932 | return status; |
| 2933 | } |
| 2934 | |
| 2935 | static void csrSetCfgRateSet( tpAniSirGlobal pMac, eCsrPhyMode phyMode, tCsrRoamProfile *pProfile, |
| 2936 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 2937 | { |
| 2938 | int i; |
| 2939 | tANI_U8 *pDstRate; |
| 2940 | eCsrCfgDot11Mode cfgDot11Mode; |
| 2941 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 2942 | tANI_U32 OperationalRatesLength = 0; |
| 2943 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 2944 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 2945 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 2946 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 2947 | tANI_U32 PropRatesEnable = 0; |
| 2948 | tANI_U8 MCSRateIdxSet[ SIZE_OF_SUPPORTED_MCS_SET ]; |
| 2949 | tANI_U32 MCSRateLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2950 | #if defined(VOSS_ENABLED) |
| 2951 | VOS_ASSERT( pIes != NULL ); |
| 2952 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2953 | if( NULL != pIes ) |
| 2954 | { |
| 2955 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2956 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 2957 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 2958 | // appear in the Operational Rate set. Consequently, in either case, we |
| 2959 | // would blindly put the rates we support into our Operational Rate set |
| 2960 | // (including the basic rates, which we have already verified are |
| 2961 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2962 | // However, it turns out that this is not always the case. Some AP's |
| 2963 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 2964 | // too. Now, we're a little more careful: |
| 2965 | pDstRate = OperationalRates; |
| 2966 | if(pIes->SuppRates.present) |
| 2967 | { |
| 2968 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 2969 | { |
| 2970 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) && |
| 2971 | ( OperationalRatesLength < CSR_DOT11_SUPPORTED_RATES_MAX )) |
| 2972 | { |
| 2973 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
| 2974 | OperationalRatesLength++; |
| 2975 | } |
| 2976 | } |
| 2977 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2978 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 2979 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 2980 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 2981 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 2982 | { |
| 2983 | // If there are Extended Rates in the beacon, we will reflect those |
| 2984 | // extended rates that we support in out Extended Operational Rate |
| 2985 | // set: |
| 2986 | pDstRate = ExtendedOperationalRates; |
| 2987 | if(pIes->ExtSuppRates.present) |
| 2988 | { |
| 2989 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 2990 | { |
| 2991 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) && |
| 2992 | ( ExtendedOperationalRatesLength < CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX )) |
| 2993 | { |
| 2994 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 2995 | ExtendedOperationalRatesLength++; |
| 2996 | } |
| 2997 | } |
| 2998 | } |
| 2999 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3000 | // Enable proprietary MAC features if peer node is Airgo node and STA |
| 3001 | // user wants to use them |
| 3002 | if( pIes->Airgo.present && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3003 | { |
| 3004 | PropRatesEnable = 1; |
| 3005 | } |
| 3006 | else |
| 3007 | { |
| 3008 | PropRatesEnable = 0; |
| 3009 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3010 | // For ANI network companions, we need to populate the proprietary rate |
| 3011 | // set with any proprietary rates we found in the beacon, only if user |
| 3012 | // allows them... |
| 3013 | if ( PropRatesEnable && pIes->Airgo.PropSuppRates.present && |
| 3014 | ( pIes->Airgo.PropSuppRates.num_rates > 0 )) |
| 3015 | { |
| 3016 | ProprietaryOperationalRatesLength = pIes->Airgo.PropSuppRates.num_rates; |
| 3017 | if ( ProprietaryOperationalRatesLength > sizeof(ProprietaryOperationalRates) ) |
| 3018 | { |
| 3019 | ProprietaryOperationalRatesLength = sizeof (ProprietaryOperationalRates); |
| 3020 | } |
| 3021 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, pIes->Airgo.PropSuppRates.rates, ProprietaryOperationalRatesLength ); |
| 3022 | } |
| 3023 | else { |
| 3024 | // No proprietary modes... |
| 3025 | ProprietaryOperationalRatesLength = 0; |
| 3026 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3027 | /* Get MCS Rate */ |
| 3028 | pDstRate = MCSRateIdxSet; |
| 3029 | if ( pIes->HTCaps.present ) |
| 3030 | { |
| 3031 | for ( i = 0; i < VALID_MAX_MCS_INDEX; i++ ) |
| 3032 | { |
| 3033 | if ( (unsigned int)pIes->HTCaps.supportedMCSSet[0] & (1 << i) ) |
| 3034 | { |
| 3035 | MCSRateLength++; |
| 3036 | *pDstRate++ = i; |
| 3037 | } |
| 3038 | } |
| 3039 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3040 | // Set the operational rate set CFG variables... |
| 3041 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3042 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3043 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3044 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3045 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3046 | ProprietaryOperationalRates, |
| 3047 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3048 | ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE); |
| 3049 | ccmCfgSetStr(pMac, WNI_CFG_CURRENT_MCS_SET, MCSRateIdxSet, |
| 3050 | MCSRateLength, NULL, eANI_BOOLEAN_FALSE); |
| 3051 | }//Parsing BSSDesc |
| 3052 | else |
| 3053 | { |
| 3054 | smsLog(pMac, LOGE, FL("failed to parse BssDesc\n")); |
| 3055 | } |
| 3056 | } |
| 3057 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3058 | static void csrSetCfgRateSetFromProfile( tpAniSirGlobal pMac, |
| 3059 | tCsrRoamProfile *pProfile ) |
| 3060 | { |
| 3061 | tSirMacRateSetIE DefaultSupportedRates11a = { SIR_MAC_RATESET_EID, |
| 3062 | { 8, |
| 3063 | { SIR_MAC_RATE_6, |
| 3064 | SIR_MAC_RATE_9, |
| 3065 | SIR_MAC_RATE_12, |
| 3066 | SIR_MAC_RATE_18, |
| 3067 | SIR_MAC_RATE_24, |
| 3068 | SIR_MAC_RATE_36, |
| 3069 | SIR_MAC_RATE_48, |
| 3070 | SIR_MAC_RATE_54 } } }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3071 | tSirMacRateSetIE DefaultSupportedRates11b = { SIR_MAC_RATESET_EID, |
| 3072 | { 4, |
| 3073 | { SIR_MAC_RATE_1, |
| 3074 | SIR_MAC_RATE_2, |
| 3075 | SIR_MAC_RATE_5_5, |
| 3076 | SIR_MAC_RATE_11 } } }; |
| 3077 | |
| 3078 | |
| 3079 | tSirMacPropRateSet DefaultSupportedPropRates = { 3, |
| 3080 | { SIR_MAC_RATE_72, |
| 3081 | SIR_MAC_RATE_96, |
| 3082 | SIR_MAC_RATE_108 } }; |
| 3083 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3084 | eCsrBand eBand; |
| 3085 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3086 | tANI_U32 OperationalRatesLength = 0; |
| 3087 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3088 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3089 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3090 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3091 | tANI_U32 PropRatesEnable = 0; |
| 3092 | tANI_U8 operationChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3093 | if(pProfile->ChannelInfo.ChannelList) |
| 3094 | { |
| 3095 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 3096 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3097 | #ifdef WLAN_SOFTAP_FEATURE |
| 3098 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
| 3099 | #else |
| 3100 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, (eCsrPhyMode)pProfile->phyMode, operationChannel, &eBand ); |
| 3101 | #endif |
| 3102 | // For 11a networks, the 11a rates go into the Operational Rate set. For 11b and 11g |
| 3103 | // networks, the 11b rates appear in the Operational Rate set. In either case, |
| 3104 | // we can blindly put the rates we support into our Operational Rate set |
| 3105 | // (including the basic rates, which we have already verified are supported |
| 3106 | // earlier in the roaming decision). |
| 3107 | if ( eCSR_BAND_5G == eBand ) |
| 3108 | { |
| 3109 | // 11a rates into the Operational Rate Set. |
| 3110 | OperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3111 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
| 3112 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3113 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3114 | OperationalRatesLength ); |
| 3115 | |
| 3116 | // Nothing in the Extended rate set. |
| 3117 | ExtendedOperationalRatesLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3118 | // populate proprietary rates if user allows them |
| 3119 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3120 | { |
| 3121 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3122 | sizeof(*DefaultSupportedPropRates.propRate); |
| 3123 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, |
| 3124 | DefaultSupportedPropRates.propRate, |
| 3125 | ProprietaryOperationalRatesLength ); |
| 3126 | } |
| 3127 | else |
| 3128 | { |
| 3129 | // No proprietary modes |
| 3130 | ProprietaryOperationalRatesLength = 0; |
| 3131 | } |
| 3132 | } |
| 3133 | else if ( eCSR_CFG_DOT11_MODE_11B == cfgDot11Mode ) |
| 3134 | { |
| 3135 | // 11b rates into the Operational Rate Set. |
| 3136 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3137 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
| 3138 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3139 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3140 | OperationalRatesLength ); |
| 3141 | // Nothing in the Extended rate set. |
| 3142 | ExtendedOperationalRatesLength = 0; |
| 3143 | // No proprietary modes |
| 3144 | ProprietaryOperationalRatesLength = 0; |
| 3145 | } |
| 3146 | else |
| 3147 | { |
| 3148 | // 11G |
| 3149 | |
| 3150 | // 11b rates into the Operational Rate Set. |
| 3151 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3152 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
| 3153 | palCopyMemory( pMac->hHdd, OperationalRates, |
| 3154 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3155 | OperationalRatesLength ); |
| 3156 | |
| 3157 | // 11a rates go in the Extended rate set. |
| 3158 | ExtendedOperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3159 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
| 3160 | palCopyMemory( pMac->hHdd, ExtendedOperationalRates, |
| 3161 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3162 | ExtendedOperationalRatesLength ); |
| 3163 | |
| 3164 | // populate proprietary rates if user allows them |
| 3165 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3166 | { |
| 3167 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3168 | sizeof(*DefaultSupportedPropRates.propRate); |
| 3169 | palCopyMemory( pMac->hHdd, ProprietaryOperationalRates, |
| 3170 | DefaultSupportedPropRates.propRate, |
| 3171 | ProprietaryOperationalRatesLength ); |
| 3172 | } |
| 3173 | else |
| 3174 | { |
| 3175 | // No proprietary modes |
| 3176 | ProprietaryOperationalRatesLength = 0; |
| 3177 | } |
| 3178 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3179 | // set this to 1 if prop. rates need to be advertised in to the IBSS beacon and user wants to use them |
| 3180 | if ( ProprietaryOperationalRatesLength && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3181 | { |
| 3182 | PropRatesEnable = 1; |
| 3183 | } |
| 3184 | else |
| 3185 | { |
| 3186 | PropRatesEnable = 0; |
| 3187 | } |
| 3188 | |
| 3189 | // Set the operational rate set CFG variables... |
| 3190 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3191 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3192 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3193 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3194 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3195 | ProprietaryOperationalRates, |
| 3196 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3197 | 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] | 3198 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3199 | void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result) |
| 3200 | { |
| 3201 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3202 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3203 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 3204 | tANI_U32 sessionId; |
| 3205 | tSmeCmd *pCommand = NULL; |
| 3206 | |
| 3207 | if(NULL == pEntry) |
| 3208 | { |
| 3209 | smsLog(pMac, LOGW, " CFG_CNF with active list empty\n"); |
| 3210 | return; |
| 3211 | } |
| 3212 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 3213 | sessionId = pCommand->sessionId; |
| 3214 | |
| 3215 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 3216 | { |
| 3217 | csrRoamingStateConfigCnfProcessor(pMac, (tANI_U32)result); |
| 3218 | } |
| 3219 | } |
| 3220 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3221 | //This function is very dump. It is here because PE still need WNI_CFG_PHY_MODE |
| 3222 | tANI_U32 csrRoamGetPhyModeFromDot11Mode(eCsrCfgDot11Mode dot11Mode, eCsrBand band) |
| 3223 | { |
| 3224 | if(eCSR_CFG_DOT11_MODE_11B == dot11Mode) |
| 3225 | { |
| 3226 | return (WNI_CFG_PHY_MODE_11B); |
| 3227 | } |
| 3228 | else |
| 3229 | { |
| 3230 | if(eCSR_BAND_24 == band) |
| 3231 | return (WNI_CFG_PHY_MODE_11G); |
| 3232 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3233 | return (WNI_CFG_PHY_MODE_11A); |
| 3234 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3235 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3236 | |
| 3237 | #ifdef WLAN_FEATURE_11AC |
| 3238 | ePhyChanBondState csrGetHTCBStateFromVHTCBState(ePhyChanBondState aniCBMode) |
| 3239 | { |
| 3240 | switch ( aniCBMode ) |
| 3241 | { |
| 3242 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 3243 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 3244 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 3245 | return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 3246 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 3247 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 3248 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 3249 | return PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 3250 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3251 | default : |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3252 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 3253 | } |
| 3254 | } |
| 3255 | #endif |
| 3256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3257 | //pIes may be NULL |
| 3258 | eHalStatus csrRoamSetBssConfigCfg(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3259 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 3260 | tDot11fBeaconIEs *pIes) |
| 3261 | { |
| 3262 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3263 | tANI_U32 cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3264 | tANI_U8 channel = 0; |
| 3265 | //Make sure we have the domain info for the BSS we try to connect to. |
| 3266 | //Do we need to worry about sequence for OSs that are not Windows?? |
| 3267 | if(pBssDesc) |
| 3268 | { |
| 3269 | if(csrLearnCountryInformation(pMac, pBssDesc, pIes, eANI_BOOLEAN_TRUE)) |
| 3270 | { |
| 3271 | //Make sure the 11d info from this BSSDesc can be applied |
| 3272 | pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE; |
| 3273 | csrApplyCountryInformation( pMac, TRUE ); |
| 3274 | } |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3275 | if ((csrIs11dSupported (pMac)) && pIes) |
| 3276 | { |
| 3277 | if (!pIes->Country.present) |
| 3278 | csrResetCountryInformation(pMac, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE ); |
| 3279 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3280 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3281 | //Qos |
| 3282 | csrSetQosToCfg( pMac, sessionId, pBssConfig->qosType ); |
| 3283 | //SSID |
| 3284 | csrSetCfgSsid(pMac, &pBssConfig->SSID ); |
| 3285 | //fragment threshold |
| 3286 | //ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3287 | //RTS threshold |
| 3288 | //ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3289 | |
| 3290 | //ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, csrTranslateToWNICfgDot11Mode(pMac, pBssConfig->uCfgDot11Mode), NULL, eANI_BOOLEAN_FALSE); |
| 3291 | |
| 3292 | //Auth type |
| 3293 | ccmCfgSetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType, NULL, eANI_BOOLEAN_FALSE); |
| 3294 | //encryption type |
| 3295 | csrSetCfgPrivacy(pMac, pProfile, (tANI_BOOLEAN)pBssConfig->BssCap.privacy ); |
| 3296 | //short slot time |
| 3297 | 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] | 3298 | #ifdef WLAN_SOFTAP_FEATURE |
| 3299 | //11d |
| 3300 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 3301 | ((pBssConfig->f11hSupport) ? pBssConfig->f11hSupport : pProfile->ieee80211d), |
| 3302 | NULL, eANI_BOOLEAN_FALSE); |
| 3303 | #endif |
| 3304 | /*//11h |
| 3305 | ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3306 | */ |
| 3307 | ccmCfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, pBssConfig->uPowerLimit, NULL, eANI_BOOLEAN_FALSE); |
| 3308 | //CB |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3309 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3310 | if(CSR_IS_INFRA_AP(pProfile) || CSR_IS_WDS_AP(pProfile)) |
| 3311 | { |
| 3312 | channel = pProfile->operationChannel; |
| 3313 | } |
| 3314 | else |
| 3315 | { |
| 3316 | if(pBssDesc) |
| 3317 | { |
| 3318 | channel = pBssDesc->channelId; |
| 3319 | } |
| 3320 | } |
| 3321 | if(0 != channel) |
| 3322 | { |
| 3323 | if(CSR_IS_CHANNEL_24GHZ(channel)) |
| 3324 | {//for now if we are on 2.4 Ghz, CB will be always disabled |
| 3325 | cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3326 | } |
| 3327 | else |
| 3328 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3329 | cfgCb = pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3330 | } |
| 3331 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3332 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | a0d8893 | 2012-11-13 10:51:26 -0800 | [diff] [blame] | 3333 | // cbMode = 1 in cfg.ini is mapped to PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 3334 | // in function csrConvertCBIniValueToPhyCBState() |
| 3335 | // So, max value for cbMode in 40MHz mode is 3 (MAC\src\include\sirParams.h) |
| 3336 | if(cfgCb > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3337 | { |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3338 | if(!WDA_getFwWlanFeatCaps(DOT11AC)) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3339 | cfgCb = csrGetHTCBStateFromVHTCBState(cfgCb); |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3340 | } |
| 3341 | else |
| 3342 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3343 | 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] | 3344 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3345 | } |
| 3346 | else |
| 3347 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3348 | ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, cfgCb, NULL, eANI_BOOLEAN_FALSE); |
| 3349 | //Rate |
| 3350 | //Fixed Rate |
| 3351 | if(pBssDesc) |
| 3352 | { |
| 3353 | csrSetCfgRateSet(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile, pBssDesc, pIes); |
| 3354 | } |
| 3355 | else |
| 3356 | { |
| 3357 | csrSetCfgRateSetFromProfile(pMac, pProfile); |
| 3358 | } |
| 3359 | //Make this the last CFG to set. The callback will trigger a join_req |
| 3360 | //Join time out |
| 3361 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId ); |
| 3362 | |
| 3363 | 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] | 3364 | return (status); |
| 3365 | } |
| 3366 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3367 | eHalStatus csrRoamStopNetwork( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3368 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3369 | { |
| 3370 | eHalStatus status; |
| 3371 | tBssConfigParam *pBssConfig; |
| 3372 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3373 | |
| 3374 | if(!pSession) |
| 3375 | { |
| 3376 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3377 | return eHAL_STATUS_FAILURE; |
| 3378 | } |
| 3379 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3380 | status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); |
| 3381 | if(HAL_STATUS_SUCCESS(status)) |
| 3382 | { |
| 3383 | palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam)); |
| 3384 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, pBssConfig, pIes); |
| 3385 | if(HAL_STATUS_SUCCESS(status)) |
| 3386 | { |
| 3387 | pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3388 | /* This will allow to pass cbMode during join req */ |
| 3389 | pSession->bssParams.cbMode= pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3390 | //For IBSS, we need to prepare some more information |
| 3391 | if( csrIsBssTypeIBSS(pProfile->BSSType) || CSR_IS_WDS( pProfile ) |
| 3392 | #ifdef WLAN_SOFTAP_FEATURE |
| 3393 | || CSR_IS_INFRA_AP(pProfile) |
| 3394 | #endif |
| 3395 | ) |
| 3396 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3397 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3398 | } |
| 3399 | // If we are in an IBSS, then stop the IBSS... |
| 3400 | ////Not worry about WDS connection for now |
| 3401 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 3402 | { |
| 3403 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 3404 | } |
| 3405 | else |
| 3406 | { |
| 3407 | // if we are in an Infrastructure association.... |
| 3408 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 3409 | { |
| 3410 | // and the new Bss is an Ibss OR we are roaming from Infra to Infra |
| 3411 | // across SSIDs (roaming to a new SSID)... // |
| 3412 | //Not worry about WDS connection for now |
| 3413 | if ( pBssDesc && ( ( csrIsIbssBssDesc( pBssDesc ) ) || |
| 3414 | !csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIes ) ) ) |
| 3415 | { |
| 3416 | // then we need to disassociate from the Infrastructure network... |
| 3417 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 3418 | } |
| 3419 | else |
| 3420 | { |
| 3421 | // In an Infrastucture and going to an Infrastructure network with the same SSID. This |
| 3422 | // calls for a Reassociation sequence. So issue the CFG sets for this new AP. |
| 3423 | if ( pBssDesc ) |
| 3424 | { |
| 3425 | // Set parameters for this Bss. |
| 3426 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
| 3427 | } |
| 3428 | } |
| 3429 | } |
| 3430 | else |
| 3431 | { |
| 3432 | // Neiher in IBSS nor in Infra. We can go ahead and set the CFG for tne new network... |
| 3433 | // Nothing to stop. |
| 3434 | if ( pBssDesc || CSR_IS_WDS_AP( pProfile ) |
| 3435 | #ifdef WLAN_SOFTAP_FEATURE |
| 3436 | || CSR_IS_INFRA_AP(pProfile) |
| 3437 | #endif |
| 3438 | ) |
| 3439 | { |
| 3440 | // Set parameters for this Bss. |
| 3441 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
| 3442 | } |
| 3443 | } |
| 3444 | } |
| 3445 | }//Success getting BSS config info |
| 3446 | palFreeMemory(pMac->hHdd, pBssConfig); |
| 3447 | }//Allocate memory |
| 3448 | |
| 3449 | return (status); |
| 3450 | } |
| 3451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3452 | eCsrJoinState csrRoamJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3453 | tCsrScanResultInfo *pScanResult, tCsrRoamProfile *pProfile ) |
| 3454 | { |
| 3455 | eCsrJoinState eRoamState = eCsrContinueRoaming; |
| 3456 | eHalStatus status; |
| 3457 | tSirBssDescription *pBssDesc = &pScanResult->BssDescriptor; |
| 3458 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)( pScanResult->pvIes ); //This may be NULL |
| 3459 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3460 | |
| 3461 | if(!pSession) |
| 3462 | { |
| 3463 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3464 | return (eCsrStopRoaming); |
| 3465 | } |
| 3466 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3467 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 3468 | { |
| 3469 | status = csrRoamStartWds( pMac, sessionId, pProfile, pBssDesc ); |
| 3470 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 3471 | { |
| 3472 | eRoamState = eCsrStopRoaming; |
| 3473 | } |
| 3474 | } |
| 3475 | else |
| 3476 | { |
| 3477 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 3478 | { |
| 3479 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
| 3480 | return (eCsrStopRoaming); |
| 3481 | } |
| 3482 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 3483 | { |
| 3484 | // If we are connected in infrastructure mode and the Join Bss description is for the same BssID, then we are |
| 3485 | // attempting to join the AP we are already connected with. In that case, see if the Bss or Sta capabilities |
| 3486 | // have changed and handle the changes (without disturbing the current association). |
| 3487 | |
| 3488 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && |
| 3489 | csrIsBssIdEqual( pMac, pBssDesc, pSession->pConnectBssDesc ) && |
| 3490 | csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIesLocal ) |
| 3491 | ) |
| 3492 | { |
| 3493 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 3494 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 3495 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 3496 | // a new Association. |
| 3497 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 3498 | { |
| 3499 | smsLog(pMac, LOGW, FL(" detect same profile authType = %d encryType = %d\n"), pProfile->AuthType, pProfile->EncryptionType); |
| 3500 | if(csrRoamIsSameProfileKeys(pMac, &pSession->connectedProfile, pProfile)) |
| 3501 | { |
| 3502 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 3503 | } |
| 3504 | else |
| 3505 | { |
| 3506 | tBssConfigParam bssConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3507 | //The key changes |
| 3508 | palZeroMemory(pMac->hHdd, &bssConfig, sizeof(bssConfig)); |
| 3509 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 3510 | if(HAL_STATUS_SUCCESS(status)) |
| 3511 | { |
| 3512 | pSession->bssParams.uCfgDot11Mode = bssConfig.uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3513 | pSession->bssParams.cbMode = bssConfig.cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3514 | //Reapply the config including Keys so reassoc is happening. |
| 3515 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 3516 | if(!HAL_STATUS_SUCCESS(status)) |
| 3517 | { |
| 3518 | eRoamState = eCsrStopRoaming; |
| 3519 | } |
| 3520 | } |
| 3521 | else |
| 3522 | { |
| 3523 | eRoamState = eCsrStopRoaming; |
| 3524 | } |
| 3525 | }//same profile |
| 3526 | } |
| 3527 | else |
| 3528 | { |
| 3529 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, sessionId, |
| 3530 | eCSR_ROAM_SUBSTATE_DISASSOC_REQ, FALSE ))) |
| 3531 | { |
| 3532 | smsLog(pMac, LOGW, FL(" fail to issue disassociate\n")); |
| 3533 | eRoamState = eCsrStopRoaming; |
| 3534 | } |
| 3535 | } |
| 3536 | } |
| 3537 | else |
| 3538 | { |
| 3539 | // note: we used to pre-auth here with open authentication networks but that was not working so well. |
| 3540 | // we had a lot of join timeouts when testing at Samsung. removing this step helped associations |
| 3541 | // work much better. |
| 3542 | // |
| 3543 | // |
| 3544 | // stop the existing network before attempting to join the new network... |
| 3545 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 3546 | { |
| 3547 | eRoamState = eCsrStopRoaming; |
| 3548 | } |
| 3549 | } |
| 3550 | }//Infra |
| 3551 | else |
| 3552 | { |
| 3553 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 3554 | { |
| 3555 | eRoamState = eCsrStopRoaming; |
| 3556 | } |
| 3557 | } |
| 3558 | if( pIesLocal && !pScanResult->pvIes ) |
| 3559 | { |
| 3560 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 3561 | } |
| 3562 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3563 | return( eRoamState ); |
| 3564 | } |
| 3565 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3566 | eHalStatus csrRoamShouldRoam(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3567 | tSirBssDescription *pBssDesc, tANI_U32 roamId) |
| 3568 | { |
| 3569 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3570 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3571 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 3572 | roamInfo.pBssDesc = pBssDesc; |
| 3573 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, roamId, eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE); |
| 3574 | return (status); |
| 3575 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3576 | //In case no matching BSS is found, use whatever default we can find |
| 3577 | static void csrRoamAssignDefaultParam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 3578 | { |
| 3579 | //Need to get all negotiated types in place first |
| 3580 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 3581 | 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] | 3582 | { |
| 3583 | default: |
| 3584 | case eCSR_AUTH_TYPE_WPA: |
| 3585 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 3586 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 3587 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3588 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 3589 | break; |
| 3590 | |
| 3591 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 3592 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 3593 | break; |
| 3594 | |
| 3595 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 3596 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 3597 | break; |
| 3598 | } |
| 3599 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 3600 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 3601 | //In this case, the multicast encryption needs to follow the uncast ones. |
| 3602 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 3603 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 3604 | } |
| 3605 | |
| 3606 | static eCsrJoinState csrRoamJoinNextBss( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fUseSameBss ) |
| 3607 | { |
| 3608 | eHalStatus status; |
| 3609 | tCsrScanResult *pScanResult = NULL; |
| 3610 | eCsrJoinState eRoamState = eCsrStopRoaming; |
| 3611 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 3612 | tANI_BOOLEAN fDone = eANI_BOOLEAN_FALSE; |
| 3613 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 3614 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 3615 | v_U8_t acm_mask = 0; |
| 3616 | #endif |
| 3617 | tANI_U32 sessionId = pCommand->sessionId; |
| 3618 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 3619 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 3620 | tANI_U8 concurrentChannel = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3621 | |
| 3622 | if(!pSession) |
| 3623 | { |
| 3624 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3625 | return (eCsrStopRoaming); |
| 3626 | } |
| 3627 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3628 | do |
| 3629 | { |
| 3630 | // Check for Cardbus eject condition, before trying to Roam to any BSS |
| 3631 | //***if( !balIsCardPresent(pAdapter) ) break; |
| 3632 | |
| 3633 | if(NULL != pBSSList) |
| 3634 | { |
| 3635 | // When handling AP's capability change, continue to associate to |
| 3636 | // same BSS and make sure pRoamBssEntry is not Null. |
| 3637 | if((eANI_BOOLEAN_FALSE == fUseSameBss) || (pCommand->u.roamCmd.pRoamBssEntry == NULL)) |
| 3638 | { |
| 3639 | if(pCommand->u.roamCmd.pRoamBssEntry == NULL) |
| 3640 | { |
| 3641 | //Try the first BSS |
| 3642 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 3643 | pCommand->u.roamCmd.pRoamBssEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 3644 | } |
| 3645 | else |
| 3646 | { |
| 3647 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 3648 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 3649 | { |
| 3650 | //Done with all the BSSs |
| 3651 | //In this case, will tell HDD the completion |
| 3652 | break; |
| 3653 | } |
| 3654 | else |
| 3655 | { |
| 3656 | //We need to indicate to HDD that we are done with this one. |
| 3657 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 3658 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; //this shall not be NULL |
| 3659 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 3660 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 3661 | pRoamInfo = &roamInfo; |
| 3662 | } |
| 3663 | } |
| 3664 | while(pCommand->u.roamCmd.pRoamBssEntry) |
| 3665 | { |
| 3666 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3667 | /*If concurrency enabled take the concurrent connected channel first. */ |
| 3668 | /* Valid multichannel concurrent sessions exempted */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3669 | if (vos_concurrent_sessions_running() && |
| 3670 | !csrIsValidMcConcurrentSession(pMac, sessionId, &pScanResult->Result.BssDescriptor)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3671 | { |
| 3672 | concurrentChannel = |
| 3673 | csrGetConcurrentOperationChannel(pMac); |
| 3674 | 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] | 3675 | " csr Concurrent Channel = %d", __func__, concurrentChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3676 | if ((concurrentChannel) && |
| 3677 | (concurrentChannel == |
| 3678 | pScanResult->Result.BssDescriptor.channelId)) |
| 3679 | { |
| 3680 | //make this 0 because we do not want the |
| 3681 | //below check to pass as we don't want to |
| 3682 | //connect on other channel |
| 3683 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 3684 | FL("Concurrent channel match =%d"), |
| 3685 | concurrentChannel); |
| 3686 | concurrentChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3687 | } |
| 3688 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3689 | |
| 3690 | if (!concurrentChannel) |
| 3691 | { |
| 3692 | |
| 3693 | if(HAL_STATUS_SUCCESS(csrRoamShouldRoam(pMac, |
| 3694 | sessionId, &pScanResult->Result.BssDescriptor, |
| 3695 | pCommand->u.roamCmd.roamId))) |
| 3696 | { |
| 3697 | //Ok to roam this |
| 3698 | break; |
| 3699 | } |
| 3700 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3701 | else |
| 3702 | { |
| 3703 | eRoamState = eCsrStopRoamingDueToConcurrency; |
| 3704 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3705 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 3706 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 3707 | { |
| 3708 | //Done with all the BSSs |
| 3709 | fDone = eANI_BOOLEAN_TRUE; |
| 3710 | break; |
| 3711 | } |
| 3712 | } |
| 3713 | if(fDone) |
| 3714 | { |
| 3715 | break; |
| 3716 | } |
| 3717 | } |
| 3718 | } |
| 3719 | //We have something to roam, tell HDD when it is infra. |
| 3720 | //For IBSS, the indication goes back to HDD via eCSR_ROAM_IBSS_IND |
| 3721 | //For WDS, the indication is eCSR_ROAM_WDS_IND |
| 3722 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 3723 | { |
| 3724 | if(pRoamInfo) |
| 3725 | { |
| 3726 | pSession->bRefAssocStartCnt--; |
| 3727 | //Complete the last association attemp because a new one is about to be tried |
| 3728 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 3729 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 3730 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 3731 | } |
| 3732 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 3733 | if(pScanResult) |
| 3734 | { |
| 3735 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3736 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->Result.BssDescriptor, &pIesLocal))) ) |
| 3737 | { |
| 3738 | smsLog(pMac, LOGE, FL(" cannot parse IEs\n")); |
| 3739 | fDone = eANI_BOOLEAN_TRUE; |
| 3740 | eRoamState = eCsrStopRoaming; |
| 3741 | break; |
| 3742 | } |
| 3743 | roamInfo.pBssDesc = &pScanResult->Result.BssDescriptor; |
| 3744 | pCommand->u.roamCmd.pLastRoamBss = roamInfo.pBssDesc; |
| 3745 | //No need to put uapsd_mask in if the BSS doesn't support uAPSD |
| 3746 | if( pCommand->u.roamCmd.roamProfile.uapsd_mask && |
| 3747 | CSR_IS_QOS_BSS(pIesLocal) && |
| 3748 | CSR_IS_UAPSD_BSS(pIesLocal) ) |
| 3749 | { |
| 3750 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3751 | acm_mask = sme_QosGetACMMask(pMac, &pScanResult->Result.BssDescriptor, |
| 3752 | pIesLocal); |
| 3753 | pCommand->u.roamCmd.roamProfile.uapsd_mask &= ~(acm_mask); |
| 3754 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3755 | } |
| 3756 | else |
| 3757 | { |
| 3758 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 3759 | } |
| 3760 | if( pIesLocal && !pScanResult->Result.pvIes) |
| 3761 | { |
| 3762 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 3763 | } |
| 3764 | } |
| 3765 | else |
| 3766 | { |
| 3767 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 3768 | } |
| 3769 | roamInfo.pProfile = pProfile; |
| 3770 | pSession->bRefAssocStartCnt++; |
| 3771 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 3772 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 3773 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3774 | if ( NULL == pCommand->u.roamCmd.pRoamBssEntry ) |
| 3775 | { |
| 3776 | // If this is a start IBSS profile, then we need to start the IBSS. |
| 3777 | if ( CSR_IS_START_IBSS(pProfile) ) |
| 3778 | { |
| 3779 | tANI_BOOLEAN fSameIbss = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3780 | // Attempt to start this IBSS... |
| 3781 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 3782 | status = csrRoamStartIbss( pMac, sessionId, pProfile, &fSameIbss ); |
| 3783 | if(HAL_STATUS_SUCCESS(status)) |
| 3784 | { |
| 3785 | if ( fSameIbss ) |
| 3786 | { |
| 3787 | eRoamState = eCsrStartIbssSameIbss; |
| 3788 | } |
| 3789 | else |
| 3790 | { |
| 3791 | eRoamState = eCsrContinueRoaming; |
| 3792 | } |
| 3793 | } |
| 3794 | else |
| 3795 | { |
| 3796 | //it somehow fail need to stop |
| 3797 | eRoamState = eCsrStopRoaming; |
| 3798 | } |
| 3799 | break; |
| 3800 | } |
| 3801 | else if ( (CSR_IS_WDS_AP(pProfile)) |
| 3802 | #ifdef WLAN_SOFTAP_FEATURE |
| 3803 | || (CSR_IS_INFRA_AP(pProfile)) |
| 3804 | #endif |
| 3805 | ) |
| 3806 | { |
| 3807 | // Attempt to start this WDS... |
| 3808 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 3809 | /* For AP WDS, we dont have any BSSDescription */ |
| 3810 | status = csrRoamStartWds( pMac, sessionId, pProfile, NULL ); |
| 3811 | if(HAL_STATUS_SUCCESS(status)) |
| 3812 | { |
| 3813 | eRoamState = eCsrContinueRoaming; |
| 3814 | } |
| 3815 | else |
| 3816 | { |
| 3817 | //it somehow fail need to stop |
| 3818 | eRoamState = eCsrStopRoaming; |
| 3819 | } |
| 3820 | } |
| 3821 | else |
| 3822 | { |
| 3823 | //Nothing we can do |
| 3824 | smsLog(pMac, LOGW, FL("cannot continue without BSS list\n")); |
| 3825 | eRoamState = eCsrStopRoaming; |
| 3826 | break; |
| 3827 | } |
| 3828 | } |
| 3829 | else //We have BSS |
| 3830 | { |
| 3831 | //Need to assign these value because they are used in csrIsSameProfile |
| 3832 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 3833 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = pScanResult->ucEncryptionType; //Negotiated while building scan result. |
| 3834 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = pScanResult->mcEncryptionType; |
| 3835 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = pScanResult->authType; |
| 3836 | if ( CSR_IS_START_IBSS(&pCommand->u.roamCmd.roamProfile) ) |
| 3837 | { |
| 3838 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 3839 | { |
| 3840 | eRoamState = eCsrStartIbssSameIbss; |
| 3841 | break; |
| 3842 | } |
| 3843 | } |
| 3844 | if( pCommand->u.roamCmd.fReassocToSelfNoCapChange ) |
| 3845 | { |
| 3846 | //trying to connect to the one already connected |
| 3847 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_FALSE; |
| 3848 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 3849 | break; |
| 3850 | } |
| 3851 | // Attempt to Join this Bss... |
| 3852 | eRoamState = csrRoamJoin( pMac, sessionId, &pScanResult->Result, pProfile ); |
| 3853 | break; |
| 3854 | } |
| 3855 | |
| 3856 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3857 | if( (eCsrStopRoaming == eRoamState) && (CSR_IS_INFRASTRUCTURE( pProfile )) ) |
| 3858 | { |
| 3859 | //Need to indicate association_completion if association_start has been done |
| 3860 | if(pSession->bRefAssocStartCnt > 0) |
| 3861 | { |
| 3862 | pSession->bRefAssocStartCnt--; |
| 3863 | //Complete the last association attemp because a new one is about to be tried |
| 3864 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 3865 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 3866 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 3867 | } |
| 3868 | } |
| 3869 | |
| 3870 | return( eRoamState ); |
| 3871 | } |
| 3872 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3873 | static eHalStatus csrRoam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 3874 | { |
| 3875 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3876 | eCsrJoinState RoamState; |
| 3877 | tANI_U32 sessionId = pCommand->sessionId; |
| 3878 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3879 | //***if( hddIsRadioStateOn( pAdapter ) ) |
| 3880 | { |
| 3881 | // Attept to join a Bss... |
| 3882 | RoamState = csrRoamJoinNextBss( pMac, pCommand, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3883 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3884 | // if nothing to join.. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3885 | if (( eCsrStopRoaming == RoamState ) || ( eCsrStopRoamingDueToConcurrency == RoamState)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3886 | { |
| 3887 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3888 | // and if connected in Infrastructure mode... |
| 3889 | if ( csrIsConnStateInfra(pMac, sessionId) ) |
| 3890 | { |
| 3891 | //... then we need to issue a disassociation |
| 3892 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, FALSE ); |
| 3893 | if(!HAL_STATUS_SUCCESS(status)) |
| 3894 | { |
| 3895 | smsLog(pMac, LOGW, FL(" failed to issue disassociate, status = %d\n"), status); |
| 3896 | //roam command is completed by caller in the failed case |
| 3897 | fComplete = eANI_BOOLEAN_TRUE; |
| 3898 | } |
| 3899 | } |
| 3900 | else if( csrIsConnStateIbss(pMac, sessionId) ) |
| 3901 | { |
| 3902 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 3903 | if(!HAL_STATUS_SUCCESS(status)) |
| 3904 | { |
| 3905 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d\n"), status); |
| 3906 | //roam command is completed by caller in the failed case |
| 3907 | fComplete = eANI_BOOLEAN_TRUE; |
| 3908 | } |
| 3909 | } |
| 3910 | #ifdef WLAN_SOFTAP_FEATURE |
| 3911 | else if (csrIsConnStateConnectedInfraAp(pMac, sessionId)) |
| 3912 | { |
| 3913 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 3914 | if(!HAL_STATUS_SUCCESS(status)) |
| 3915 | { |
| 3916 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d\n"), status); |
| 3917 | //roam command is completed by caller in the failed case |
| 3918 | fComplete = eANI_BOOLEAN_TRUE; |
| 3919 | } |
| 3920 | } |
| 3921 | #endif |
| 3922 | else |
| 3923 | { |
| 3924 | fComplete = eANI_BOOLEAN_TRUE; |
| 3925 | } |
| 3926 | if(fComplete) |
| 3927 | { |
| 3928 | // ... otherwise, we can complete the Roam command here. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3929 | if(eCsrStopRoamingDueToConcurrency == RoamState) |
| 3930 | { |
| 3931 | csrRoamComplete( pMac, eCsrJoinFailureDueToConcurrency, NULL ); |
| 3932 | } |
| 3933 | else |
| 3934 | { |
| 3935 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 3936 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3937 | } |
| 3938 | } |
| 3939 | else if ( eCsrReassocToSelfNoCapChange == RoamState ) |
| 3940 | { |
| 3941 | csrRoamComplete( pMac, eCsrSilentlyStopRoamingSaveState, NULL ); |
| 3942 | } |
| 3943 | else if ( eCsrStartIbssSameIbss == RoamState ) |
| 3944 | { |
| 3945 | csrRoamComplete( pMac, eCsrSilentlyStopRoaming, NULL ); |
| 3946 | } |
| 3947 | }//hddIsRadioStateOn |
| 3948 | |
| 3949 | return status; |
| 3950 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3951 | eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 3952 | { |
| 3953 | tANI_U32 sessionId; |
| 3954 | tCsrRoamSession *pSession; |
| 3955 | tCsrScanResult *pScanResult = NULL; |
| 3956 | tSirBssDescription *pBssDesc = NULL; |
| 3957 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3958 | sessionId = pCommand->sessionId; |
| 3959 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3960 | |
| 3961 | if(!pSession) |
| 3962 | { |
| 3963 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3964 | return eHAL_STATUS_FAILURE; |
| 3965 | } |
| 3966 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3967 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 3968 | { |
| 3969 | //the roaming is cancelled. Simply complete the command |
| 3970 | smsLog(pMac, LOG1, FL(" Roam command cancelled\n")); |
| 3971 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 3972 | return eHAL_STATUS_FAILURE; |
| 3973 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3974 | if (pCommand->u.roamCmd.pRoamBssEntry) |
| 3975 | { |
| 3976 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 3977 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 3978 | } |
| 3979 | else |
| 3980 | { |
| 3981 | //the roaming is cancelled. Simply complete the command |
| 3982 | smsLog(pMac, LOG1, FL(" Roam command cancelled\n")); |
| 3983 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 3984 | return eHAL_STATUS_FAILURE; |
| 3985 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3986 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 3987 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 3988 | return status; |
| 3989 | } |
| 3990 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3991 | eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 3992 | { |
| 3993 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3994 | tCsrRoamInfo roamInfo; |
| 3995 | tANI_U32 sessionId = pCommand->sessionId; |
| 3996 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3997 | |
| 3998 | if(!pSession) |
| 3999 | { |
| 4000 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4001 | return eHAL_STATUS_FAILURE; |
| 4002 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4003 | |
| 4004 | switch ( pCommand->u.roamCmd.roamReason ) |
| 4005 | { |
| 4006 | case eCsrForcedDisassoc: |
| 4007 | csrFreeRoamProfile(pMac, sessionId); |
| 4008 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 4009 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4010 | case eCsrSmeIssuedDisassocForHandoff: |
| 4011 | //Not to free pMac->roam.pCurRoamProfile (via csrFreeRoamProfile) because it is needed after disconnect |
| 4012 | #if 0 // TODO : Confirm this change |
| 4013 | status = csrRoamProcessDisassociate( pMac, pCommand, FALSE ); |
| 4014 | #else |
| 4015 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 4016 | #endif |
| 4017 | |
| 4018 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4019 | case eCsrForcedDisassocMICFailure: |
| 4020 | csrFreeRoamProfile(pMac, sessionId); |
| 4021 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, TRUE ); |
| 4022 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4023 | case eCsrForcedDeauth: |
| 4024 | csrFreeRoamProfile(pMac, sessionId); |
| 4025 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, FALSE, FALSE ); |
| 4026 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4027 | case eCsrHddIssuedReassocToSameAP: |
| 4028 | case eCsrSmeIssuedReassocToSameAP: |
| 4029 | { |
| 4030 | tDot11fBeaconIEs *pIes = NULL; |
| 4031 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4032 | if( pSession->pConnectBssDesc ) |
| 4033 | { |
| 4034 | status = csrGetParsedBssDescriptionIEs(pMac, pSession->pConnectBssDesc, &pIes); |
| 4035 | if(!HAL_STATUS_SUCCESS(status) ) |
| 4036 | { |
| 4037 | smsLog(pMac, LOGE, FL(" fail to parse IEs\n")); |
| 4038 | } |
| 4039 | else |
| 4040 | { |
| 4041 | roamInfo.reasonCode = eCsrRoamReasonStaCapabilityChanged; |
| 4042 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
| 4043 | pSession->roamingReason = eCsrReassocRoaming; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4044 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 4045 | roamInfo.pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4046 | pSession->bRefAssocStartCnt++; |
| 4047 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4048 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4049 | |
| 4050 | smsLog(pMac, LOG1, FL(" calling csrRoamIssueReassociate\n")); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4051 | status = csrRoamIssueReassociate( pMac, sessionId, pSession->pConnectBssDesc, pIes, |
| 4052 | &pCommand->u.roamCmd.roamProfile ); |
| 4053 | if(!HAL_STATUS_SUCCESS(status)) |
| 4054 | { |
| 4055 | smsLog(pMac, LOGE, FL("csrRoamIssueReassociate failed with status %d"), status); |
| 4056 | } |
| 4057 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4058 | palFreeMemory(pMac->hHdd, pIes); |
| 4059 | pIes = NULL; |
| 4060 | } |
| 4061 | } |
| 4062 | break; |
| 4063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4064 | case eCsrCapsChange: |
| 4065 | smsLog(pMac, LOGE, FL("received eCsrCapsChange \n")); |
| 4066 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4067 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE); |
| 4068 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4069 | case eCsrSmeIssuedFTReassoc: |
| 4070 | smsLog(pMac, LOGE, FL("received FT Reassoc Req \n")); |
| 4071 | status = csrProcessFTReassocRoamCommand(pMac, pCommand); |
| 4072 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4073 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4074 | case eCsrStopBss: |
| 4075 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4076 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4077 | break; |
| 4078 | |
| 4079 | case eCsrForcedDisassocSta: |
| 4080 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4081 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId); |
| 4082 | status = csrSendMBDisassocReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4083 | pCommand->u.roamCmd.reason); |
| 4084 | break; |
| 4085 | |
| 4086 | case eCsrForcedDeauthSta: |
| 4087 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4088 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId); |
| 4089 | status = csrSendMBDeauthReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4090 | pCommand->u.roamCmd.reason); |
| 4091 | break; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4092 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4093 | case eCsrPerformPreauth: |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 4094 | smsLog(pMac, LOG1, FL("Attempting FT PreAuth Req")); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4095 | status = csrRoamIssueFTPreauthReq(pMac, sessionId, |
| 4096 | pCommand->u.roamCmd.pLastRoamBss); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4097 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4098 | |
| 4099 | default: |
| 4100 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4101 | |
| 4102 | if( pCommand->u.roamCmd.fUpdateCurRoamProfile ) |
| 4103 | { |
| 4104 | //Remember the roaming profile |
| 4105 | csrFreeRoamProfile(pMac, sessionId); |
| 4106 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)))) |
| 4107 | { |
| 4108 | palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 4109 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, &pCommand->u.roamCmd.roamProfile); |
| 4110 | } |
| 4111 | } |
| 4112 | |
| 4113 | //At this point, original uapsd_mask is saved in pCurRoamProfile |
| 4114 | //uapsd_mask in the pCommand may change from this point on. |
| 4115 | |
| 4116 | // Attempt to roam with the new scan results (if we need to..) |
| 4117 | status = csrRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4118 | if(!HAL_STATUS_SUCCESS(status)) |
| 4119 | { |
| 4120 | smsLog(pMac, LOGW, FL("csrRoam() failed with status = 0x%08X\n"), status); |
| 4121 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4122 | break; |
| 4123 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4124 | return (status); |
| 4125 | } |
| 4126 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4127 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4128 | { |
| 4129 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4130 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4131 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
| 4132 | palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd)); |
| 4133 | } |
| 4134 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4135 | void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4136 | { |
| 4137 | if(pCommand->u.roamCmd.fReleaseBssList) |
| 4138 | { |
| 4139 | csrScanResultPurge(pMac, pCommand->u.roamCmd.hBSSList); |
| 4140 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 4141 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 4142 | } |
| 4143 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 4144 | { |
| 4145 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 4146 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 4147 | } |
| 4148 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4149 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
| 4150 | palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd)); |
| 4151 | } |
| 4152 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4153 | void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4154 | { |
| 4155 | palZeroMemory(pMac->hHdd, &pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd)); |
| 4156 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4157 | void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context ) |
| 4158 | { |
| 4159 | tListElem *pEntry; |
| 4160 | tSmeCmd *pCommand; |
| 4161 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4162 | smsLog( pMac, LOG2, "Roam Completion ...\n" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4163 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 4164 | if ( pEntry ) |
| 4165 | { |
| 4166 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4167 | // If the head of the queue is Active and it is a ROAM command, remove |
| 4168 | // and put this on the Free queue. |
| 4169 | if ( eSmeCommandRoam == pCommand->command ) |
| 4170 | { |
| 4171 | //we need to process the result first before removing it from active list because state changes |
| 4172 | //still happening insides roamQProcessRoamResults so no other roam command should be issued |
| 4173 | fReleaseCommand = csrRoamProcessResults( pMac, pCommand, Result, Context ); |
| 4174 | if( fReleaseCommand ) |
| 4175 | { |
| 4176 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 4177 | { |
| 4178 | csrReleaseCommandRoam( pMac, pCommand ); |
| 4179 | } |
| 4180 | else |
| 4181 | { |
| 4182 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d\n", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4183 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4184 | } |
| 4185 | } |
| 4186 | else |
| 4187 | { |
| 4188 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d\n", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4189 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4190 | } |
| 4191 | } |
| 4192 | else |
| 4193 | { |
| 4194 | smsLog( pMac, LOGW, "CSR: Roam Completion called but ROAM command is not ACTIVE ...\n" ); |
| 4195 | } |
| 4196 | } |
| 4197 | else |
| 4198 | { |
| 4199 | smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ...\n" ); |
| 4200 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4201 | if( fReleaseCommand ) |
| 4202 | { |
| 4203 | smeProcessPendingQueue( pMac ); |
| 4204 | } |
| 4205 | } |
| 4206 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4207 | void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4208 | { |
| 4209 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4210 | if(!pSession) |
| 4211 | { |
| 4212 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4213 | return; |
| 4214 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4215 | palZeroMemory( pMac->hHdd, &(pSession->PmkidCandidateInfo[0]), sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED ); |
| 4216 | pSession->NumPmkidCandidate = 0; |
| 4217 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4218 | #ifdef FEATURE_WLAN_WAPI |
| 4219 | void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4220 | { |
| 4221 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4222 | if(!pSession) |
| 4223 | { |
| 4224 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4225 | return; |
| 4226 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4227 | palZeroMemory( pMac->hHdd, &(pSession->BkidCandidateInfo[0]), sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED ); |
| 4228 | pSession->NumBkidCandidate = 0; |
| 4229 | } |
| 4230 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4231 | extern tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ]; |
| 4232 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4233 | static eHalStatus csrRoamSaveSecurityRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrAuthType authType, |
| 4234 | tSirBssDescription *pSirBssDesc, |
| 4235 | tDot11fBeaconIEs *pIes) |
| 4236 | { |
| 4237 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4238 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4239 | tDot11fBeaconIEs *pIesLocal = pIes; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4240 | |
| 4241 | if(!pSession) |
| 4242 | { |
| 4243 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4244 | return eHAL_STATUS_FAILURE; |
| 4245 | } |
| 4246 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4247 | if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4248 | (eCSR_AUTH_TYPE_WPA_PSK == authType) || |
| 4249 | (eCSR_AUTH_TYPE_RSN == authType) || |
| 4250 | (eCSR_AUTH_TYPE_RSN_PSK == authType) |
| 4251 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4252 | || |
| 4253 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4254 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) |
| 4255 | #endif /* FEATURE_WLAN_WAPI */ |
| 4256 | #ifdef FEATURE_WLAN_WAPI |
| 4257 | || |
| 4258 | (eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4259 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType) |
| 4260 | #endif /* FEATURE_WLAN_WAPI */ |
| 4261 | ) |
| 4262 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4263 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 4264 | { |
| 4265 | smsLog(pMac, LOGE, FL(" cannot parse IEs\n")); |
| 4266 | } |
| 4267 | if( pIesLocal ) |
| 4268 | { |
| 4269 | tANI_U32 nIeLen; |
| 4270 | tANI_U8 *pIeBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4271 | if((eCSR_AUTH_TYPE_RSN == authType) || |
| 4272 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4273 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4274 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) || |
| 4275 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4276 | (eCSR_AUTH_TYPE_RSN_PSK == authType)) |
| 4277 | { |
| 4278 | if(pIesLocal->RSN.present) |
| 4279 | { |
| 4280 | //Calculate the actual length |
| 4281 | nIeLen = 8 //version + gp_cipher_suite + pwise_cipher_suite_count |
| 4282 | + pIesLocal->RSN.pwise_cipher_suite_count * 4 //pwise_cipher_suites |
| 4283 | + 2 //akm_suite_count |
| 4284 | + pIesLocal->RSN.akm_suite_count * 4 //akm_suites |
| 4285 | + 2; //reserved |
| 4286 | if( pIesLocal->RSN.pmkid_count ) |
| 4287 | { |
| 4288 | nIeLen += 2 + pIesLocal->RSN.pmkid_count * 4; //pmkid |
| 4289 | } |
| 4290 | //nIeLen doesn't count EID and length fields |
| 4291 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2)))) |
| 4292 | { |
| 4293 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_RSN; |
| 4294 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4295 | //copy upto akm_suites |
| 4296 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 4297 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.version, 8); |
| 4298 | pIeBuf += 8; |
| 4299 | if( pIesLocal->RSN.pwise_cipher_suite_count ) |
| 4300 | { |
| 4301 | //copy pwise_cipher_suites |
| 4302 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.pwise_cipher_suites, |
| 4303 | pIesLocal->RSN.pwise_cipher_suite_count * 4); |
| 4304 | pIeBuf += pIesLocal->RSN.pwise_cipher_suite_count * 4; |
| 4305 | } |
| 4306 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->RSN.akm_suite_count, 2); |
| 4307 | pIeBuf += 2; |
| 4308 | if( pIesLocal->RSN.akm_suite_count ) |
| 4309 | { |
| 4310 | //copy akm_suites |
| 4311 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites, |
| 4312 | pIesLocal->RSN.akm_suite_count * 4); |
| 4313 | pIeBuf += pIesLocal->RSN.akm_suite_count * 4; |
| 4314 | } |
| 4315 | //copy the rest |
| 4316 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->RSN.akm_suites + |
| 4317 | pIesLocal->RSN.akm_suite_count * 4, |
| 4318 | 2 + pIesLocal->RSN.pmkid_count * 4); |
| 4319 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4320 | } |
| 4321 | } |
| 4322 | } |
| 4323 | else if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4324 | (eCSR_AUTH_TYPE_WPA_PSK == authType)) |
| 4325 | { |
| 4326 | if(pIesLocal->WPA.present) |
| 4327 | { |
| 4328 | //Calculate the actual length |
| 4329 | nIeLen = 12 //OUI + version + multicast_cipher + unicast_cipher_count |
| 4330 | + pIesLocal->WPA.unicast_cipher_count * 4 //unicast_ciphers |
| 4331 | + 2 //auth_suite_count |
| 4332 | + pIesLocal->WPA.auth_suite_count * 4; //auth_suites |
| 4333 | // The WPA capabilities follows the Auth Suite (two octects)-- |
| 4334 | // this field is optional, and we always "send" zero, so just |
| 4335 | // remove it. This is consistent with our assumptions in the |
| 4336 | // frames compiler; c.f. bug 15234: |
| 4337 | //nIeLen doesn't count EID and length fields |
| 4338 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnRspIE, nIeLen + 2)))) |
| 4339 | { |
| 4340 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_WPA; |
| 4341 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4342 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 4343 | //Copy WPA OUI |
| 4344 | palCopyMemory(pMac->hHdd, pIeBuf, &csrWpaOui[1], 4); |
| 4345 | pIeBuf += 4; |
| 4346 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.version, 8 + |
| 4347 | pIesLocal->WPA.unicast_cipher_count * 4); |
| 4348 | pIeBuf += 8 + pIesLocal->WPA.unicast_cipher_count * 4; |
| 4349 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WPA.auth_suite_count, 2 + |
| 4350 | pIesLocal->WPA.auth_suite_count * 4); |
| 4351 | pIeBuf += pIesLocal->WPA.auth_suite_count * 4; |
| 4352 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4353 | } |
| 4354 | } |
| 4355 | } |
| 4356 | #ifdef FEATURE_WLAN_WAPI |
| 4357 | else if((eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4358 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType)) |
| 4359 | { |
| 4360 | if(pIesLocal->WAPI.present) |
| 4361 | { |
| 4362 | //Calculate the actual length |
| 4363 | nIeLen = 4 //version + akm_suite_count |
| 4364 | + pIesLocal->WAPI.akm_suite_count * 4 // akm_suites |
| 4365 | + 2 //pwise_cipher_suite_count |
| 4366 | + pIesLocal->WAPI.unicast_cipher_suite_count * 4 //pwise_cipher_suites |
| 4367 | + 6; //gp_cipher_suite + preauth + reserved |
| 4368 | if( pIesLocal->WAPI.bkid_count ) |
| 4369 | { |
| 4370 | nIeLen += 2 + pIesLocal->WAPI.bkid_count * 4; //bkid |
| 4371 | } |
| 4372 | |
| 4373 | //nIeLen doesn't count EID and length fields |
| 4374 | if(HAL_STATUS_SUCCESS((status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiRspIE, nIeLen + 2)))) |
| 4375 | { |
| 4376 | pSession->pWapiRspIE[0] = DOT11F_EID_WAPI; |
| 4377 | pSession->pWapiRspIE[1] = (tANI_U8)nIeLen; |
| 4378 | pIeBuf = pSession->pWapiRspIE + 2; |
| 4379 | //copy upto akm_suite_count |
| 4380 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.version, 4); |
| 4381 | pIeBuf += 4; |
| 4382 | if( pIesLocal->WAPI.akm_suite_count ) |
| 4383 | { |
| 4384 | //copy akm_suites |
| 4385 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.akm_suites, |
| 4386 | pIesLocal->WAPI.akm_suite_count * 4); |
| 4387 | pIeBuf += pIesLocal->WAPI.akm_suite_count * 4; |
| 4388 | } |
| 4389 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.unicast_cipher_suite_count, 2); |
| 4390 | pIeBuf += 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4391 | if( pIesLocal->WAPI.unicast_cipher_suite_count ) |
| 4392 | { |
| 4393 | //copy pwise_cipher_suites |
| 4394 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.unicast_cipher_suites, |
| 4395 | pIesLocal->WAPI.unicast_cipher_suite_count * 4); |
| 4396 | pIeBuf += pIesLocal->WAPI.unicast_cipher_suite_count * 4; |
| 4397 | } |
| 4398 | //gp_cipher_suite + preauth + reserved + bkid_count |
| 4399 | palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.multicast_cipher_suite, 8); |
| 4400 | pIeBuf += 8; |
| 4401 | if( pIesLocal->WAPI.bkid_count ) |
| 4402 | { |
| 4403 | //copy akm_suites |
| 4404 | palCopyMemory(pMac->hHdd, pIeBuf, pIesLocal->WAPI.bkid, pIesLocal->WAPI.bkid_count * 4); |
| 4405 | pIeBuf += pIesLocal->WAPI.bkid_count * 4; |
| 4406 | } |
| 4407 | pSession->nWapiRspIeLength = nIeLen + 2; |
| 4408 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4409 | } |
| 4410 | } |
| 4411 | #endif /* FEATURE_WLAN_WAPI */ |
| 4412 | if( !pIes ) |
| 4413 | { |
| 4414 | //locally allocated |
| 4415 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 4416 | } |
| 4417 | } |
| 4418 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4419 | return (status); |
| 4420 | } |
| 4421 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4422 | static void csrCheckAndUpdateACWeight( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIEs ) |
| 4423 | { |
| 4424 | v_U8_t bACWeights[WLANTL_MAX_AC]; |
| 4425 | v_U8_t paramBk, paramBe, paramVi, paramVo; |
| 4426 | v_BOOL_t fWeightChange = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4427 | //Compare two ACs' EDCA parameters, from low to high (BK, BE, VI, VO) |
| 4428 | //The "formula" is, if lower AC's AIFSN+CWMin is bigger than a fixed amount |
| 4429 | //of the higher AC one, make the higher AC has the same weight as the lower AC. |
| 4430 | //This doesn't address the case where the lower AC needs a real higher weight |
| 4431 | if( pIEs->WMMParams.present ) |
| 4432 | { |
| 4433 | //no change to the lowest ones |
| 4434 | bACWeights[WLANTL_AC_BK] = pMac->roam.ucACWeights[WLANTL_AC_BK]; |
| 4435 | bACWeights[WLANTL_AC_BE] = pMac->roam.ucACWeights[WLANTL_AC_BE]; |
| 4436 | bACWeights[WLANTL_AC_VI] = pMac->roam.ucACWeights[WLANTL_AC_VI]; |
| 4437 | bACWeights[WLANTL_AC_VO] = pMac->roam.ucACWeights[WLANTL_AC_VO]; |
| 4438 | paramBk = pIEs->WMMParams.acbk_aifsn + pIEs->WMMParams.acbk_acwmin; |
| 4439 | paramBe = pIEs->WMMParams.acbe_aifsn + pIEs->WMMParams.acbe_acwmin; |
| 4440 | paramVi = pIEs->WMMParams.acvi_aifsn + pIEs->WMMParams.acvi_acwmin; |
| 4441 | paramVo = pIEs->WMMParams.acvo_aifsn + pIEs->WMMParams.acvo_acwmin; |
| 4442 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramBe) ) |
| 4443 | { |
| 4444 | bACWeights[WLANTL_AC_BE] = bACWeights[WLANTL_AC_BK]; |
| 4445 | fWeightChange = VOS_TRUE; |
| 4446 | } |
| 4447 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVi) ) |
| 4448 | { |
| 4449 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BK]; |
| 4450 | fWeightChange = VOS_TRUE; |
| 4451 | } |
| 4452 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVi) ) |
| 4453 | { |
| 4454 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BE]; |
| 4455 | fWeightChange = VOS_TRUE; |
| 4456 | } |
| 4457 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVo) ) |
| 4458 | { |
| 4459 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BK]; |
| 4460 | fWeightChange = VOS_TRUE; |
| 4461 | } |
| 4462 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVo) ) |
| 4463 | { |
| 4464 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BE]; |
| 4465 | fWeightChange = VOS_TRUE; |
| 4466 | } |
| 4467 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramVi, paramVo) ) |
| 4468 | { |
| 4469 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_VI]; |
| 4470 | fWeightChange = VOS_TRUE; |
| 4471 | } |
| 4472 | if(fWeightChange) |
| 4473 | { |
| 4474 | smsLog(pMac, LOGE, FL(" change AC weights (%d-%d-%d-%d)\n"), bACWeights[0], bACWeights[1], |
| 4475 | bACWeights[2], bACWeights[3]); |
| 4476 | WLANTL_SetACWeights(pMac->roam.gVosContext, bACWeights); |
| 4477 | } |
| 4478 | } |
| 4479 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4480 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4481 | //Returns whether the current association is a 11r assoc or not |
| 4482 | tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac) |
| 4483 | { |
| 4484 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4485 | return csrNeighborRoamIs11rAssoc(pMac); |
| 4486 | #else |
| 4487 | return eANI_BOOLEAN_FALSE; |
| 4488 | #endif |
| 4489 | } |
| 4490 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4491 | #ifdef FEATURE_WLAN_CCX |
| 4492 | //Returns whether the current association is a CCX assoc or not |
| 4493 | tANI_BOOLEAN csrRoamIsCCXAssoc(tpAniSirGlobal pMac) |
| 4494 | { |
| 4495 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 4496 | return csrNeighborRoamIsCCXAssoc(pMac); |
| 4497 | #else |
| 4498 | return eANI_BOOLEAN_FALSE; |
| 4499 | #endif |
| 4500 | } |
| 4501 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4502 | #ifdef FEATURE_WLAN_LFR |
| 4503 | //Returns whether "Legacy Fast Roaming" is currently enabled...or not |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4504 | tANI_BOOLEAN csrRoamIsFastRoamEnabled(tpAniSirGlobal pMac, tANI_U32 sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4505 | { |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4506 | tCsrRoamSession *pSession = NULL; |
| 4507 | |
| 4508 | if (CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 4509 | { |
| 4510 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4511 | if (NULL != pSession->pCurRoamProfile) |
| 4512 | { |
| 4513 | if (pSession->pCurRoamProfile->csrPersona != VOS_STA_MODE) |
| 4514 | { |
| 4515 | return eANI_BOOLEAN_FALSE; |
| 4516 | } |
| 4517 | } |
| 4518 | } |
| 4519 | |
Madan Mohan Koyyalamudi | 9ce36ec | 2012-10-15 16:03:17 -0700 | [diff] [blame] | 4520 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled && |
Madan Mohan Koyyalamudi | 393a434 | 2012-10-15 16:07:09 -0700 | [diff] [blame] | 4521 | (!csrIsConcurrentSessionRunning(pMac))); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4522 | } |
| 4523 | #endif |
| 4524 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4525 | //Return true means the command can be release, else not |
| 4526 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 4527 | eCsrRoamCompleteResult Result, void *Context ) |
| 4528 | { |
| 4529 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
| 4530 | tSirBssDescription *pSirBssDesc = NULL; |
| 4531 | tSirMacAddr BroadcastMac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 4532 | tCsrScanResult *pScanResult = NULL; |
| 4533 | tCsrRoamInfo roamInfo; |
| 4534 | sme_QosAssocInfo assocInfo; |
| 4535 | sme_QosCsrEventIndType ind_qos;//indication for QoS module in SME |
| 4536 | tANI_U8 acm_mask = 0; //HDD needs the ACM mask in the assoc rsp callback |
| 4537 | tDot11fBeaconIEs *pIes = NULL; |
| 4538 | tANI_U32 sessionId = pCommand->sessionId; |
| 4539 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4540 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4541 | eRoamCmdStatus roamStatus; |
| 4542 | eCsrRoamResult roamResult; |
| 4543 | eHalStatus status; |
| 4544 | tANI_U32 key_timeout_interval = 0; |
| 4545 | #ifdef WLAN_SOFTAP_FEATURE |
| 4546 | tSirSmeStartBssRsp *pSmeStartBssRsp = NULL; |
| 4547 | #endif |
| 4548 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4549 | if(!pSession) |
| 4550 | { |
| 4551 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4552 | return eANI_BOOLEAN_FALSE; |
| 4553 | } |
| 4554 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4555 | smsLog( pMac, LOG1, FL("Processing ROAM results...\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4556 | switch( Result ) |
| 4557 | { |
| 4558 | case eCsrJoinSuccess: |
| 4559 | // reset the IDLE timer |
| 4560 | // !! |
| 4561 | // !! fall through to the next CASE statement here is intentional !! |
| 4562 | // !! |
| 4563 | case eCsrReassocSuccess: |
| 4564 | if(eCsrReassocSuccess == Result) |
| 4565 | { |
| 4566 | ind_qos = SME_QOS_CSR_REASSOC_COMPLETE; |
| 4567 | } |
| 4568 | else |
| 4569 | { |
| 4570 | ind_qos = SME_QOS_CSR_ASSOC_COMPLETE; |
| 4571 | } |
| 4572 | // Success Join Response from LIM. Tell NDIS we are connected and save the |
| 4573 | // Connected state... |
| 4574 | smsLog(pMac, LOGW, FL("receives association indication\n")); |
| 4575 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 4576 | //always free the memory here |
| 4577 | if(pSession->pWpaRsnRspIE) |
| 4578 | { |
| 4579 | pSession->nWpaRsnRspIeLength = 0; |
| 4580 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE); |
| 4581 | pSession->pWpaRsnRspIE = NULL; |
| 4582 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4583 | #ifdef FEATURE_WLAN_WAPI |
| 4584 | if(pSession->pWapiRspIE) |
| 4585 | { |
| 4586 | pSession->nWapiRspIeLength = 0; |
| 4587 | palFreeMemory(pMac->hHdd, pSession->pWapiRspIE); |
| 4588 | pSession->pWapiRspIE = NULL; |
| 4589 | } |
| 4590 | #endif /* FEATURE_WLAN_WAPI */ |
| 4591 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 4592 | //Reset counter so no join retry is needed. |
| 4593 | pSession->maxRetryCount = 0; |
| 4594 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 4595 | #endif |
| 4596 | /* This creates problem since we have not saved the connected profile. |
| 4597 | So moving this after saving the profile |
| 4598 | */ |
| 4599 | //csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED ); |
| 4600 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 4601 | { |
| 4602 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
| 4603 | } |
| 4604 | else |
| 4605 | { |
| 4606 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED; |
| 4607 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4608 | //Use the last connected bssdesc for reassoc-ing to the same AP. |
| 4609 | //NOTE: What to do when reassoc to a different AP??? |
| 4610 | if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) || |
| 4611 | (eCsrSmeIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ) |
| 4612 | { |
| 4613 | pSirBssDesc = pSession->pConnectBssDesc; |
| 4614 | if(pSirBssDesc) |
| 4615 | { |
| 4616 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 4617 | } |
| 4618 | } |
| 4619 | else |
| 4620 | { |
| 4621 | |
| 4622 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 4623 | { |
| 4624 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4625 | if(pScanResult != NULL) |
| 4626 | { |
| 4627 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 4628 | //this can be NULL |
| 4629 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 4630 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 4631 | } |
| 4632 | } |
| 4633 | } |
| 4634 | if( pSirBssDesc ) |
| 4635 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4636 | roamInfo.staId = HAL_STA_INVALID_IDX; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4637 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 4638 | //Save WPA/RSN IE |
| 4639 | csrRoamSaveSecurityRspIE(pMac, sessionId, pProfile->negotiatedAuthType, pSirBssDesc, pIes); |
| 4640 | #ifdef FEATURE_WLAN_CCX |
| 4641 | roamInfo.isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
| 4642 | #endif |
| 4643 | |
| 4644 | // csrRoamStateChange also affects sub-state. Hence, csrRoamStateChange happens first and then |
| 4645 | // substate change. |
| 4646 | // Moving even save profile above so that below mentioned conditon is also met. |
| 4647 | // JEZ100225: Moved to after saving the profile. Fix needed in main/latest |
| 4648 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4649 | // Make sure the Set Context is issued before link indication to NDIS. After link indication is |
| 4650 | // made to NDIS, frames could start flowing. If we have not set context with LIM, the frames |
| 4651 | // will be dropped for the security context may not be set properly. |
| 4652 | // |
| 4653 | // this was causing issues in the 2c_wlan_wep WHQL test when the SetContext was issued after the link |
| 4654 | // indication. (Link Indication happens in the profFSMSetConnectedInfra call). |
| 4655 | // |
| 4656 | // this reordering was done on titan_prod_usb branch and is being replicated here. |
| 4657 | // |
| 4658 | |
| 4659 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && |
| 4660 | !pProfile->bWPSAssociation) |
| 4661 | { |
| 4662 | // Issue the set Context request to LIM to establish the Unicast STA context |
| 4663 | if( !HAL_STATUS_SUCCESS( csrRoamIssueSetContextReq( pMac, sessionId, |
| 4664 | pProfile->negotiatedUCEncryptionType, |
| 4665 | pSirBssDesc, &(pSirBssDesc->bssId), |
| 4666 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ) ) ) // NO keys... these key parameters don't matter. |
| 4667 | { |
| 4668 | smsLog( pMac, LOGE, FL(" Set context for unicast fail\n") ); |
| 4669 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 4670 | } |
| 4671 | // Issue the set Context request to LIM to establish the Broadcast STA context |
| 4672 | csrRoamIssueSetContextReq( pMac, sessionId, pProfile->negotiatedMCEncryptionType, |
| 4673 | pSirBssDesc, &BroadcastMac, |
| 4674 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 4675 | } |
| 4676 | else |
| 4677 | { |
| 4678 | //Need to wait for supplicant authtication |
| 4679 | roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4680 | //Set the subestate to WaitForKey in case authentiation is needed |
| 4681 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId ); |
| 4682 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4683 | if(pProfile->bWPSAssociation) |
| 4684 | { |
| 4685 | key_timeout_interval = CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD; |
| 4686 | } |
| 4687 | else |
| 4688 | { |
| 4689 | key_timeout_interval = CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD; |
| 4690 | } |
| 4691 | |
| 4692 | //Save sessionId in case of timeout |
| 4693 | pMac->roam.WaitForKeyTimerInfo.sessionId = (tANI_U8)sessionId; |
| 4694 | //This time should be long enough for the rest of the process plus setting key |
| 4695 | if(!HAL_STATUS_SUCCESS( csrRoamStartWaitForKeyTimer( pMac, key_timeout_interval ) ) ) |
| 4696 | { |
| 4697 | //Reset our state so nothting is blocked. |
| 4698 | smsLog( pMac, LOGE, FL(" Failed to start pre-auth timer\n") ); |
| 4699 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 4700 | } |
| 4701 | } |
| 4702 | |
| 4703 | assocInfo.pBssDesc = pSirBssDesc; //could be NULL |
| 4704 | assocInfo.pProfile = pProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4705 | if(Context) |
| 4706 | { |
| 4707 | tSirSmeJoinRsp *pJoinRsp = (tSirSmeJoinRsp *)Context; |
| 4708 | tANI_U32 len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4709 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 4710 | len = pJoinRsp->assocReqLength + pJoinRsp->assocRspLength + pJoinRsp->beaconLength; |
| 4711 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4712 | len += pJoinRsp->parsedRicRspLen; |
| 4713 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4714 | #ifdef FEATURE_WLAN_CCX |
| 4715 | len += pJoinRsp->tspecIeLen; |
| 4716 | #endif |
| 4717 | if(len) |
| 4718 | { |
| 4719 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 4720 | (void **)&pSession->connectedInfo.pbFrames, len))) |
| 4721 | { |
| 4722 | if(HAL_STATUS_SUCCESS( palCopyMemory(pMac->hHdd, |
| 4723 | pSession->connectedInfo.pbFrames, pJoinRsp->frames, len) )) |
| 4724 | { |
| 4725 | pSession->connectedInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 4726 | pSession->connectedInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 4727 | pSession->connectedInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 4728 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4729 | pSession->connectedInfo.nRICRspLength = pJoinRsp->parsedRicRspLen; |
| 4730 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4731 | #ifdef FEATURE_WLAN_CCX |
| 4732 | pSession->connectedInfo.nTspecIeLength = pJoinRsp->tspecIeLen; |
| 4733 | #endif |
| 4734 | roamInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 4735 | roamInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 4736 | roamInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 4737 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 4738 | } |
| 4739 | else |
| 4740 | { |
| 4741 | smsLog(pMac, LOGE, "%s: Copying of memory failed for %d bytes !!!\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4742 | __func__, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4743 | palFreeMemory( pMac->hHdd, pSession->connectedInfo.pbFrames ); |
| 4744 | pSession->connectedInfo.pbFrames = NULL; |
| 4745 | } |
| 4746 | } |
| 4747 | } |
| 4748 | if(pCommand->u.roamCmd.fReassoc) |
| 4749 | { |
| 4750 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 4751 | } |
| 4752 | pSession->connectedInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 4753 | roamInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 4754 | roamInfo.ucastSig = ( tANI_U8 )pJoinRsp->ucastSig; |
| 4755 | roamInfo.bcastSig = ( tANI_U8 )pJoinRsp->bcastSig; |
| 4756 | } |
| 4757 | else |
| 4758 | { |
| 4759 | if(pCommand->u.roamCmd.fReassoc) |
| 4760 | { |
| 4761 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 4762 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 4763 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 4764 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 4765 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 4766 | } |
| 4767 | } |
| 4768 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4769 | // Indicate SME-QOS with reassoc success event, only after |
| 4770 | // copying the frames |
| 4771 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, ind_qos, &assocInfo); |
| 4772 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4773 | roamInfo.pBssDesc = pSirBssDesc; |
| 4774 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4775 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4776 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4777 | acm_mask = sme_QosGetACMMask(pMac, pSirBssDesc, NULL); |
| 4778 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 4779 | pSession->connectedProfile.acm_mask = acm_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4780 | #ifdef FEATURE_WLAN_UAPSD_FW_TRG_FRAMES |
| 4781 | //start UAPSD if uapsd_mask is not 0 because HDD will configure for trigger frame |
| 4782 | //It may be better to let QoS do this???? |
| 4783 | if( pSession->connectedProfile.modifyProfileFields.uapsd_mask ) |
| 4784 | { |
| 4785 | smsLog(pMac, LOGE, " uapsd_mask (0x%X) set, request UAPSD now\n", |
| 4786 | pSession->connectedProfile.modifyProfileFields.uapsd_mask); |
| 4787 | pmcStartUapsd( pMac, NULL, NULL ); |
| 4788 | } |
| 4789 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4790 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 4791 | if( pSession->bRefAssocStartCnt > 0 ) |
| 4792 | { |
| 4793 | pSession->bRefAssocStartCnt--; |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 4794 | //Remove this code once SLM_Sessionization is supported |
| 4795 | //BMPS_WORKAROUND_NOT_NEEDED |
| 4796 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4797 | { |
| 4798 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 4799 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4800 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 4801 | } |
| 4802 | |
| 4803 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_NONE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4804 | // reset the PMKID candidate list |
| 4805 | csrResetPMKIDCandidateList( pMac, sessionId ); |
| 4806 | //Update TL's AC weight base on the current EDCA parameters |
| 4807 | //These parameters may change in the course of the connection, that sictuation |
| 4808 | //is not taken care here. This change is mainly to address a WIFI WMM test where |
| 4809 | //BE has a equal or higher TX priority than VI. |
| 4810 | //We only do this for infra link |
| 4811 | if( csrIsConnStateConnectedInfra(pMac, sessionId ) && pIes ) |
| 4812 | { |
| 4813 | csrCheckAndUpdateACWeight(pMac, pIes); |
| 4814 | } |
| 4815 | #ifdef FEATURE_WLAN_WAPI |
| 4816 | // reset the BKID candidate list |
| 4817 | csrResetBKIDCandidateList( pMac, sessionId ); |
| 4818 | #endif /* FEATURE_WLAN_WAPI */ |
| 4819 | } |
| 4820 | else |
| 4821 | { |
| 4822 | smsLog(pMac, LOGW, " Roam command doesn't have a BSS desc\n"); |
| 4823 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4824 | csrScanCancelIdleScan(pMac); |
| 4825 | //Not to signal link up because keys are yet to be set. |
| 4826 | //The linkup function will overwrite the sub-state that we need to keep at this point. |
| 4827 | if( !CSR_IS_WAIT_FOR_KEY(pMac, sessionId) ) |
| 4828 | { |
| 4829 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 4830 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4831 | //Check if BMPS is required and start the BMPS retry timer. Timer period is large |
| 4832 | //enough to let security and DHCP handshake succeed before entry into BMPS |
| 4833 | if (pmcShouldBmpsTimerRun(pMac)) |
| 4834 | { |
| 4835 | if (pmcStartTrafficTimer(pMac, BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP) |
| 4836 | != eHAL_STATUS_SUCCESS) |
| 4837 | { |
| 4838 | smsLog(pMac, LOGP, FL("Cannot start BMPS Retry timer")); |
| 4839 | } |
| 4840 | smsLog(pMac, LOG2, FL("BMPS Retry Timer already running or started")); |
| 4841 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4842 | break; |
| 4843 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4844 | case eCsrStartBssSuccess: |
| 4845 | // on the StartBss Response, LIM is returning the Bss Description that we |
| 4846 | // are beaconing. Add this Bss Description to our scan results and |
| 4847 | // chain the Profile to this Bss Description. On a Start BSS, there was no |
| 4848 | // detected Bss description (no partner) so we issued the Start Bss to |
| 4849 | // start the Ibss without any Bss description. Lim was kind enough to return |
| 4850 | // the Bss Description that we start beaconing for the newly started Ibss. |
| 4851 | smsLog(pMac, LOG2, FL("receives start BSS ok indication\n")); |
| 4852 | status = eHAL_STATUS_FAILURE; |
| 4853 | #ifdef WLAN_SOFTAP_FEATURE |
| 4854 | pSmeStartBssRsp = (tSirSmeStartBssRsp *)Context; |
| 4855 | #endif |
| 4856 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 4857 | if( CSR_IS_IBSS( pProfile ) ) |
| 4858 | { |
| 4859 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 4860 | } |
| 4861 | #ifdef WLAN_SOFTAP_FEATURE |
| 4862 | else if (CSR_IS_INFRA_AP(pProfile)) |
| 4863 | { |
| 4864 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 4865 | } |
| 4866 | #endif |
| 4867 | else |
| 4868 | { |
| 4869 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 4870 | } |
| 4871 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 4872 | { |
| 4873 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
| 4874 | #ifdef WLAN_SOFTAP_FEATURE |
| 4875 | pSirBssDesc = &pSmeStartBssRsp->bssDescription; |
| 4876 | #else |
| 4877 | pSirBssDesc = (tSirBssDescription *)Context; |
| 4878 | #endif |
| 4879 | if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs( pMac, pSirBssDesc, &pIes )) ) |
| 4880 | { |
| 4881 | smsLog(pMac, LOG2, FL("cannot parse IBSS IEs\n")); |
| 4882 | roamInfo.pBssDesc = pSirBssDesc; |
| 4883 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 4884 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4885 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_START_FAILED ); |
| 4886 | break; |
| 4887 | } |
| 4888 | #ifdef WLAN_SOFTAP_FEATURE |
| 4889 | if (!CSR_IS_INFRA_AP(pProfile)) |
| 4890 | #endif |
| 4891 | { |
| 4892 | pScanResult = csrScanAppendBssDescription( pMac, pSirBssDesc, pIes ); |
| 4893 | } |
| 4894 | csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
| 4895 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 4896 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 4897 | if(pSirBssDesc) |
| 4898 | { |
| 4899 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 4900 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pSirBssDesc->bssId, sizeof(tCsrBssid)); |
| 4901 | } |
| 4902 | //We are doen with the IEs so free it |
| 4903 | palFreeMemory(pMac->hHdd, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4904 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 4905 | { |
| 4906 | vos_log_ibss_pkt_type *pIbssLog; |
| 4907 | tANI_U32 bi; |
| 4908 | |
| 4909 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 4910 | if(pIbssLog) |
| 4911 | { |
| 4912 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 4913 | { |
| 4914 | //We start the IBSS (didn't find any matched IBSS out there) |
| 4915 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_RSP; |
| 4916 | } |
| 4917 | else |
| 4918 | { |
| 4919 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_RSP; |
| 4920 | } |
| 4921 | if(pSirBssDesc) |
| 4922 | { |
| 4923 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pSirBssDesc->bssId, 6); |
| 4924 | pIbssLog->operatingChannel = pSirBssDesc->channelId; |
| 4925 | } |
| 4926 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 4927 | { |
| 4928 | //***U8 is not enough for beacon interval |
| 4929 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 4930 | } |
| 4931 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 4932 | } |
| 4933 | } |
| 4934 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 4935 | //Only set context for non-WDS_STA. We don't even need it for WDS_AP. But since the encryption |
| 4936 | //is WPA2-PSK so it won't matter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4937 | #ifdef WLAN_SOFTAP_FEATURE |
| 4938 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && !CSR_IS_INFRA_AP( pSession->pCurRoamProfile )) |
| 4939 | { |
| 4940 | #else |
| 4941 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType )) |
| 4942 | { |
| 4943 | #endif |
| 4944 | // Issue the set Context request to LIM to establish the Broadcast STA context for the Ibss. |
| 4945 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 4946 | pProfile->negotiatedMCEncryptionType, |
| 4947 | pSirBssDesc, &BroadcastMac, |
| 4948 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 4949 | } |
| 4950 | } |
| 4951 | else |
| 4952 | { |
| 4953 | //Keep the state to eCSR_ROAMING_STATE_JOINING |
| 4954 | //Need to send join_req. |
| 4955 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 4956 | { |
| 4957 | if((pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link))) |
| 4958 | { |
| 4959 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 4960 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 4961 | // Set the roaming substate to 'join attempt'... |
| 4962 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 4963 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4964 | } |
| 4965 | } |
| 4966 | else |
| 4967 | { |
| 4968 | smsLog( pMac, LOGE, " StartBSS for WDS station with no BssDesc\n" ); |
| 4969 | VOS_ASSERT( 0 ); |
| 4970 | } |
| 4971 | } |
| 4972 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 4973 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 4974 | //trigger the connection start indication in Vista |
| 4975 | if( !CSR_IS_JOIN_TO_IBSS( pProfile ) ) |
| 4976 | { |
| 4977 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 4978 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 4979 | if( CSR_IS_WDS( pProfile ) ) |
| 4980 | { |
| 4981 | roamStatus = eCSR_ROAM_WDS_IND; |
| 4982 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 4983 | } |
| 4984 | #ifdef WLAN_SOFTAP_FEATURE |
| 4985 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 4986 | { |
| 4987 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 4988 | roamResult = eCSR_ROAM_RESULT_INFRA_STARTED; |
| 4989 | } |
| 4990 | #endif |
| 4991 | |
| 4992 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 4993 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 4994 | //trigger the connection start indication in Vista |
| 4995 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 4996 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4997 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4998 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 4999 | { |
| 5000 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5001 | roamInfo.pBssDesc = pSirBssDesc; |
| 5002 | } |
| 5003 | #ifdef WLAN_SOFTAP_FEATURE |
| 5004 | roamInfo.staId = (tANI_U8)pSmeStartBssRsp->staId; |
| 5005 | #endif |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5006 | //Remove this code once SLM_Sessionization is supported |
| 5007 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5008 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5009 | ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5010 | { |
| 5011 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5012 | } |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5013 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5014 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5015 | } |
| 5016 | |
| 5017 | csrScanCancelIdleScan(pMac); |
| 5018 | //Only use this timer for ibss. BAP has its own timer for WDS |
| 5019 | if( CSR_IS_IBSS( pProfile) && CSR_INVALID_SCANRESULT_HANDLE != pCommand->u.roamCmd.hBSSList) |
| 5020 | { |
| 5021 | //start the join IBSS timer |
| 5022 | csrRoamStartIbssJoinTimer(pMac, sessionId, CSR_IBSS_JOIN_TIMEOUT_PERIOD); //interval |
| 5023 | pSession->ibss_join_pending = TRUE; |
| 5024 | } |
| 5025 | if( HAL_STATUS_SUCCESS( status ) ) |
| 5026 | { |
| 5027 | //Already sent join_req for the WDS station |
| 5028 | fReleaseCommand = eANI_BOOLEAN_FALSE; |
| 5029 | } |
| 5030 | else if( CSR_IS_WDS_STA( pProfile ) ) |
| 5031 | { |
| 5032 | //need to send stop BSS because we fail to send join_req |
| 5033 | csrRoamIssueDisassociateCmd( pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 5034 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5035 | eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_STOPPED ); |
| 5036 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5037 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5038 | case eCsrStartBssFailure: |
| 5039 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5040 | { |
| 5041 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5042 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5043 | if(pIbssLog) |
| 5044 | { |
| 5045 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 5046 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5047 | } |
| 5048 | } |
| 5049 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5050 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5051 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5052 | if( CSR_IS_WDS( pProfile ) ) |
| 5053 | { |
| 5054 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5055 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5056 | } |
| 5057 | #ifdef WLAN_SOFTAP_FEATURE |
| 5058 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5059 | { |
| 5060 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5061 | roamResult = eCSR_ROAM_RESULT_INFRA_START_FAILED; |
| 5062 | } |
| 5063 | #endif |
| 5064 | if(Context) |
| 5065 | { |
| 5066 | pSirBssDesc = (tSirBssDescription *)Context; |
| 5067 | } |
| 5068 | else |
| 5069 | { |
| 5070 | pSirBssDesc = NULL; |
| 5071 | } |
| 5072 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5073 | roamInfo.pBssDesc = pSirBssDesc; |
| 5074 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5075 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5076 | csrSetDefaultDot11Mode( pMac ); |
| 5077 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5078 | case eCsrSilentlyStopRoaming: |
| 5079 | // We are here because we try to start the same IBSS |
| 5080 | //No message to PE |
| 5081 | // return the roaming state to Joined. |
| 5082 | smsLog(pMac, LOGW, FL("receives silently roaming indication\n")); |
| 5083 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
| 5084 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 5085 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5086 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5087 | if( roamInfo.pBssDesc ) |
| 5088 | { |
| 5089 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid)); |
| 5090 | } |
| 5091 | //Since there is no change in the current state, simply pass back no result otherwise |
| 5092 | //HDD may be mistakenly mark to disconnected state. |
| 5093 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5094 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5095 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5096 | case eCsrSilentlyStopRoamingSaveState: |
| 5097 | //We are here because we try to connect to the same AP |
| 5098 | //No message to PE |
| 5099 | smsLog(pMac, LOGW, FL("receives silently stop roaming indication\n")); |
| 5100 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
| 5101 | |
| 5102 | //to aviod resetting the substate to NONE |
| 5103 | pMac->roam.curState[sessionId] = eCSR_ROAMING_STATE_JOINED; |
| 5104 | //No need to change substate to wai_for_key because there is no state change |
| 5105 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5106 | if( roamInfo.pBssDesc ) |
| 5107 | { |
| 5108 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid)); |
| 5109 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5110 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5111 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5112 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5113 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5114 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5115 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5116 | roamInfo.staId = pSession->connectedInfo.staId; |
| 5117 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5118 | #if defined(VOSS_ENABLED) |
| 5119 | VOS_ASSERT( roamInfo.staId != 0 ); |
| 5120 | #endif |
| 5121 | pSession->bRefAssocStartCnt--; |
| 5122 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5123 | eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5124 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_ASSOCIATED, eANI_BOOLEAN_TRUE); |
| 5125 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5126 | case eCsrReassocFailure: |
| 5127 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5128 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_REASSOC_FAILURE, NULL); |
| 5129 | #endif |
| 5130 | case eCsrJoinWdsFailure: |
| 5131 | smsLog(pMac, LOGW, FL("failed to join WDS\n")); |
| 5132 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5133 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5134 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5135 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5136 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5137 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5138 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5139 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5140 | eCSR_ROAM_WDS_IND, |
| 5141 | eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED); |
| 5142 | //Need to issue stop_bss |
| 5143 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5144 | case eCsrJoinFailure: |
| 5145 | case eCsrNothingToJoin: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5146 | case eCsrJoinFailureDueToConcurrency: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5147 | default: |
| 5148 | { |
| 5149 | smsLog(pMac, LOGW, FL("receives no association indication\n")); |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 5150 | smsLog(pMac, LOG1, FL("Assoc ref count %d\n"), |
| 5151 | pSession->bRefAssocStartCnt); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5152 | if( CSR_IS_INFRASTRUCTURE( &pSession->connectedProfile ) || |
| 5153 | CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, sessionId ) ) |
| 5154 | { |
| 5155 | //do not free for the other profiles as we need to send down stop BSS later |
| 5156 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5157 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5158 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5159 | csrSetDefaultDot11Mode( pMac ); |
| 5160 | } |
| 5161 | |
| 5162 | switch( pCommand->u.roamCmd.roamReason ) |
| 5163 | { |
| 5164 | // If this transition is because of an 802.11 OID, then we transition |
| 5165 | // back to INIT state so we sit waiting for more OIDs to be issued and |
| 5166 | // we don't start the IDLE timer. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5167 | case eCsrSmeIssuedFTReassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5168 | case eCsrSmeIssuedAssocToSimilarAP: |
| 5169 | case eCsrHddIssued: |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 5170 | case eCsrSmeIssuedDisassocForHandoff: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5171 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5172 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 5173 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5174 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5175 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5176 | /* Defeaturize this later if needed */ |
| 5177 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5178 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 5179 | if (csrRoamIsHandoffInProgress(pMac)) |
| 5180 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5181 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 5182 | csrNeighborRoamIndicateConnect(pMac, (tANI_U8)sessionId, VOS_STATUS_E_FAILURE); |
| 5183 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5184 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5185 | if(pSession->bRefAssocStartCnt > 0) |
| 5186 | { |
| 5187 | pSession->bRefAssocStartCnt--; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5188 | if(eCsrJoinFailureDueToConcurrency == Result) |
| 5189 | { |
| 5190 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5191 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5192 | eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL); |
| 5193 | } |
| 5194 | else |
| 5195 | { |
| 5196 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5197 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5198 | eCSR_ROAM_RESULT_FAILURE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5199 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5200 | } |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5201 | else |
| 5202 | { |
| 5203 | /* bRefAssocStartCnt is not incremented when |
| 5204 | * eRoamState == eCsrStopRoamingDueToConcurrency |
| 5205 | * in csrRoamJoinNextBss API. so handle this in |
| 5206 | * else case by sending assoc failure |
| 5207 | */ |
| 5208 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5209 | pCommand->u.scanCmd.roamId, |
| 5210 | eCSR_ROAM_ASSOCIATION_FAILURE, |
| 5211 | eCSR_ROAM_RESULT_FAILURE); |
| 5212 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5213 | smsLog(pMac, LOG1, FL(" roam(reason %d) failed\n"), pCommand->u.roamCmd.roamReason); |
| 5214 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5215 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5216 | #endif |
| 5217 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5218 | csrScanStartIdleScan(pMac); |
| 5219 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5220 | //For WDS STA. To fix the issue where the WDS AP side may be too busy by |
| 5221 | //BT activity and not able to recevie WLAN traffic. Retry the join |
| 5222 | if( CSR_IS_WDS_STA(pProfile) ) |
| 5223 | { |
| 5224 | csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD); |
| 5225 | } |
| 5226 | #endif |
| 5227 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5228 | case eCsrHddIssuedReassocToSameAP: |
| 5229 | case eCsrSmeIssuedReassocToSameAP: |
| 5230 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5231 | |
| 5232 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5233 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5234 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5235 | #endif |
| 5236 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5237 | csrScanStartIdleScan(pMac); |
| 5238 | break; |
| 5239 | case eCsrForcedDisassoc: |
| 5240 | case eCsrForcedDeauth: |
| 5241 | case eCsrSmeIssuedIbssJoinFailure: |
| 5242 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5243 | |
| 5244 | if(eCsrSmeIssuedIbssJoinFailure == pCommand->u.roamCmd.roamReason) |
| 5245 | { |
| 5246 | // Notify HDD that IBSS join failed |
| 5247 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 5248 | } |
| 5249 | else |
| 5250 | { |
| 5251 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5252 | pCommand->u.roamCmd.roamId, |
| 5253 | eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5254 | } |
| 5255 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5256 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5257 | #endif |
| 5258 | csrRoamLinkDown(pMac, sessionId); |
| 5259 | csrScanStartIdleScan(pMac); |
| 5260 | break; |
| 5261 | case eCsrForcedIbssLeave: |
| 5262 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5263 | pCommand->u.roamCmd.roamId, |
| 5264 | eCSR_ROAM_IBSS_LEAVE, |
| 5265 | eCSR_ROAM_RESULT_IBSS_STOP); |
| 5266 | break; |
| 5267 | case eCsrForcedDisassocMICFailure: |
| 5268 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5269 | |
| 5270 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_MIC_FAILURE); |
| 5271 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5272 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 5273 | #endif |
| 5274 | csrScanStartIdleScan(pMac); |
| 5275 | break; |
| 5276 | #ifdef WLAN_SOFTAP_FEATURE |
| 5277 | case eCsrStopBss: |
| 5278 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5279 | pCommand->u.roamCmd.roamId, |
| 5280 | eCSR_ROAM_INFRA_IND, |
| 5281 | eCSR_ROAM_RESULT_INFRA_STOPPED); |
| 5282 | break; |
| 5283 | case eCsrForcedDisassocSta: |
| 5284 | case eCsrForcedDeauthSta: |
| 5285 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId); |
| 5286 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 5287 | { |
| 5288 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5289 | if (!pSession) |
| 5290 | break; |
| 5291 | |
| 5292 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 5293 | { |
| 5294 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5295 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, |
| 5296 | pCommand->u.roamCmd.peerMac, sizeof(tSirMacAddr)); |
| 5297 | roamInfo.reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 5298 | roamInfo.statusCode = eSIR_SME_SUCCESS; |
| 5299 | status = csrRoamCallCallback(pMac, sessionId, |
| 5300 | &roamInfo, pCommand->u.roamCmd.roamId, |
| 5301 | eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 5302 | } |
| 5303 | } |
| 5304 | break; |
| 5305 | #endif |
| 5306 | case eCsrLostLink1: |
| 5307 | // if lost link roam1 failed, then issue lost link Scan2 ... |
| 5308 | csrScanRequestLostLink2(pMac, sessionId); |
| 5309 | break; |
| 5310 | case eCsrLostLink2: |
| 5311 | // if lost link roam2 failed, then issue lost link scan3 ... |
| 5312 | csrScanRequestLostLink3(pMac, sessionId); |
| 5313 | break; |
| 5314 | case eCsrLostLink3: |
| 5315 | default: |
| 5316 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5317 | |
| 5318 | //We are done with one round of lostlink roaming here |
| 5319 | csrScanHandleFailedLostlink3(pMac, sessionId); |
| 5320 | break; |
| 5321 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5322 | break; |
| 5323 | } |
| 5324 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5325 | return ( fReleaseCommand ); |
| 5326 | } |
| 5327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5328 | eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext) |
| 5329 | { |
| 5330 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5331 | return (status); |
| 5332 | } |
| 5333 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5334 | eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile) |
| 5335 | { |
| 5336 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5337 | tANI_U32 size = 0; |
| 5338 | |
| 5339 | do |
| 5340 | { |
| 5341 | palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile)); |
| 5342 | if(pSrcProfile->BSSIDs.numOfBSSIDs) |
| 5343 | { |
| 5344 | size = sizeof(tCsrBssid) * pSrcProfile->BSSIDs.numOfBSSIDs; |
| 5345 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, size); |
| 5346 | if(!HAL_STATUS_SUCCESS(status)) |
| 5347 | { |
| 5348 | break; |
| 5349 | } |
| 5350 | pDstProfile->BSSIDs.numOfBSSIDs = pSrcProfile->BSSIDs.numOfBSSIDs; |
| 5351 | palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->BSSIDs.bssid, size); |
| 5352 | } |
| 5353 | if(pSrcProfile->SSIDs.numOfSSIDs) |
| 5354 | { |
| 5355 | size = sizeof(tCsrSSIDInfo) * pSrcProfile->SSIDs.numOfSSIDs; |
| 5356 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, size); |
| 5357 | if(!HAL_STATUS_SUCCESS(status)) |
| 5358 | { |
| 5359 | break; |
| 5360 | } |
| 5361 | pDstProfile->SSIDs.numOfSSIDs = pSrcProfile->SSIDs.numOfSSIDs; |
| 5362 | palCopyMemory(pMac->hHdd, pDstProfile->SSIDs.SSIDList, pSrcProfile->SSIDs.SSIDList, size); |
| 5363 | } |
| 5364 | if(pSrcProfile->nWPAReqIELength) |
| 5365 | { |
| 5366 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength); |
| 5367 | if(!HAL_STATUS_SUCCESS(status)) |
| 5368 | { |
| 5369 | break; |
| 5370 | } |
| 5371 | pDstProfile->nWPAReqIELength = pSrcProfile->nWPAReqIELength; |
| 5372 | palCopyMemory(pMac->hHdd, pDstProfile->pWPAReqIE, pSrcProfile->pWPAReqIE, pSrcProfile->nWPAReqIELength); |
| 5373 | } |
| 5374 | if(pSrcProfile->nRSNReqIELength) |
| 5375 | { |
| 5376 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength); |
| 5377 | if(!HAL_STATUS_SUCCESS(status)) |
| 5378 | { |
| 5379 | break; |
| 5380 | } |
| 5381 | pDstProfile->nRSNReqIELength = pSrcProfile->nRSNReqIELength; |
| 5382 | palCopyMemory(pMac->hHdd, pDstProfile->pRSNReqIE, pSrcProfile->pRSNReqIE, pSrcProfile->nRSNReqIELength); |
| 5383 | } |
| 5384 | #ifdef FEATURE_WLAN_WAPI |
| 5385 | if(pSrcProfile->nWAPIReqIELength) |
| 5386 | { |
| 5387 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength); |
| 5388 | if(!HAL_STATUS_SUCCESS(status)) |
| 5389 | { |
| 5390 | break; |
| 5391 | } |
| 5392 | pDstProfile->nWAPIReqIELength = pSrcProfile->nWAPIReqIELength; |
| 5393 | palCopyMemory(pMac->hHdd, pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength); |
| 5394 | } |
| 5395 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5396 | if(pSrcProfile->nAddIEScanLength) |
| 5397 | { |
| 5398 | status = palAllocateMemory(pMac->hHdd, |
| 5399 | (void **)&pDstProfile->pAddIEScan, pSrcProfile->nAddIEScanLength); |
| 5400 | if(!HAL_STATUS_SUCCESS(status)) |
| 5401 | { |
| 5402 | break; |
| 5403 | } |
| 5404 | pDstProfile->nAddIEScanLength = pSrcProfile->nAddIEScanLength; |
| 5405 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEScan, pSrcProfile->pAddIEScan, |
| 5406 | pSrcProfile->nAddIEScanLength); |
| 5407 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5408 | if(pSrcProfile->nAddIEAssocLength) |
| 5409 | { |
| 5410 | status = palAllocateMemory(pMac->hHdd, |
| 5411 | (void **)&pDstProfile->pAddIEAssoc, pSrcProfile->nAddIEAssocLength); |
| 5412 | if(!HAL_STATUS_SUCCESS(status)) |
| 5413 | { |
| 5414 | break; |
| 5415 | } |
| 5416 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
| 5417 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 5418 | pSrcProfile->nAddIEAssocLength); |
| 5419 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5420 | if(pSrcProfile->ChannelInfo.ChannelList) |
| 5421 | { |
| 5422 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); |
| 5423 | if(!HAL_STATUS_SUCCESS(status)) |
| 5424 | { |
| 5425 | break; |
| 5426 | } |
| 5427 | pDstProfile->ChannelInfo.numOfChannels = pSrcProfile->ChannelInfo.numOfChannels; |
| 5428 | palCopyMemory(pMac->hHdd, pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels); |
| 5429 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5430 | pDstProfile->AuthType = pSrcProfile->AuthType; |
| 5431 | pDstProfile->EncryptionType = pSrcProfile->EncryptionType; |
| 5432 | pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType; |
| 5433 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->negotiatedUCEncryptionType; |
| 5434 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->negotiatedMCEncryptionType; |
| 5435 | pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType; |
| 5436 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 5437 | pDstProfile->phyMode = pSrcProfile->phyMode; |
| 5438 | pDstProfile->csrPersona = pSrcProfile->csrPersona; |
| 5439 | |
| 5440 | #ifdef FEATURE_WLAN_WAPI |
| 5441 | if(csrIsProfileWapi(pSrcProfile)) |
| 5442 | { |
| 5443 | if(pDstProfile->phyMode & eCSR_DOT11_MODE_11n) |
| 5444 | { |
| 5445 | pDstProfile->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 5446 | } |
| 5447 | } |
| 5448 | #endif /* FEATURE_WLAN_WAPI */ |
| 5449 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 5450 | /*Save the WPS info*/ |
| 5451 | pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation; |
| 5452 | pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5453 | pDstProfile->beaconInterval = pSrcProfile->beaconInterval; |
| 5454 | #ifdef WLAN_SOFTAP_FEATURE |
| 5455 | pDstProfile->privacy = pSrcProfile->privacy; |
| 5456 | pDstProfile->fwdWPSPBCProbeReq = pSrcProfile->fwdWPSPBCProbeReq; |
| 5457 | pDstProfile->csr80211AuthType = pSrcProfile->csr80211AuthType; |
| 5458 | pDstProfile->dtimPeriod = pSrcProfile->dtimPeriod; |
| 5459 | pDstProfile->ApUapsdEnable = pSrcProfile->ApUapsdEnable; |
| 5460 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->SSIDs.SSIDList[0].ssidHidden; |
| 5461 | pDstProfile->protEnabled = pSrcProfile->protEnabled; |
| 5462 | pDstProfile->obssProtEnabled = pSrcProfile->obssProtEnabled; |
| 5463 | pDstProfile->cfg_protection = pSrcProfile->cfg_protection; |
| 5464 | pDstProfile->wps_state = pSrcProfile->wps_state; |
| 5465 | pDstProfile->ieee80211d = pSrcProfile->ieee80211d; |
| 5466 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5467 | palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5468 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5469 | if (pSrcProfile->MDID.mdiePresent) |
| 5470 | { |
| 5471 | pDstProfile->MDID.mdiePresent = 1; |
| 5472 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 5473 | } |
| 5474 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5475 | }while(0); |
| 5476 | |
| 5477 | if(!HAL_STATUS_SUCCESS(status)) |
| 5478 | { |
| 5479 | csrReleaseProfile(pMac, pDstProfile); |
| 5480 | pDstProfile = NULL; |
| 5481 | } |
| 5482 | |
| 5483 | return (status); |
| 5484 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5485 | eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile ) |
| 5486 | { |
| 5487 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5488 | tCsrRoamConnectedProfile *pSrcProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 5489 | do |
| 5490 | { |
| 5491 | palZeroMemory(pMac->hHdd, pDstProfile, sizeof(tCsrRoamProfile)); |
| 5492 | if(pSrcProfile->bssid) |
| 5493 | { |
| 5494 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 5495 | if(!HAL_STATUS_SUCCESS(status)) |
| 5496 | { |
| 5497 | break; |
| 5498 | } |
| 5499 | pDstProfile->BSSIDs.numOfBSSIDs = 1; |
| 5500 | palCopyMemory(pMac->hHdd, pDstProfile->BSSIDs.bssid, pSrcProfile->bssid, sizeof(tCsrBssid)); |
| 5501 | } |
| 5502 | if(pSrcProfile->SSID.ssId) |
| 5503 | { |
| 5504 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->SSIDs.SSIDList, sizeof(tCsrSSIDInfo)); |
| 5505 | if(!HAL_STATUS_SUCCESS(status)) |
| 5506 | { |
| 5507 | break; |
| 5508 | } |
| 5509 | pDstProfile->SSIDs.numOfSSIDs = 1; |
| 5510 | pDstProfile->SSIDs.SSIDList[0].handoffPermitted = pSrcProfile->handoffPermitted; |
| 5511 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->ssidHidden; |
| 5512 | palCopyMemory(pMac->hHdd, &pDstProfile->SSIDs.SSIDList[0].SSID, &pSrcProfile->SSID, sizeof(tSirMacSSid)); |
| 5513 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 5514 | if(pSrcProfile->nAddIEAssocLength) |
| 5515 | { |
| 5516 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->pAddIEAssoc, pSrcProfile->nAddIEAssocLength); |
| 5517 | if(!HAL_STATUS_SUCCESS(status)) |
| 5518 | { |
| 5519 | smsLog( pMac, LOGE, FL(" failed to allocate memory for additional IEs \n") ); |
| 5520 | break; |
| 5521 | } |
| 5522 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
| 5523 | palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 5524 | pSrcProfile->nAddIEAssocLength); |
| 5525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5526 | status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, 1); |
| 5527 | if(!HAL_STATUS_SUCCESS(status)) |
| 5528 | { |
| 5529 | break; |
| 5530 | } |
| 5531 | pDstProfile->ChannelInfo.numOfChannels = 1; |
| 5532 | pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5533 | pDstProfile->AuthType.numEntries = 1; |
| 5534 | pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType; |
| 5535 | pDstProfile->negotiatedAuthType = pSrcProfile->AuthType; |
| 5536 | pDstProfile->EncryptionType.numEntries = 1; |
| 5537 | pDstProfile->EncryptionType.encryptionType[0] = pSrcProfile->EncryptionType; |
| 5538 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->EncryptionType; |
| 5539 | pDstProfile->mcEncryptionType.numEntries = 1; |
| 5540 | pDstProfile->mcEncryptionType.encryptionType[0] = pSrcProfile->mcEncryptionType; |
| 5541 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->mcEncryptionType; |
| 5542 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 5543 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 5544 | palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys)); |
| 5545 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5546 | if (pSrcProfile->MDID.mdiePresent) |
| 5547 | { |
| 5548 | pDstProfile->MDID.mdiePresent = 1; |
| 5549 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 5550 | } |
| 5551 | #endif |
| 5552 | |
| 5553 | }while(0); |
| 5554 | |
| 5555 | if(!HAL_STATUS_SUCCESS(status)) |
| 5556 | { |
| 5557 | csrReleaseProfile(pMac, pDstProfile); |
| 5558 | pDstProfile = NULL; |
| 5559 | } |
| 5560 | |
| 5561 | return (status); |
| 5562 | } |
| 5563 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5564 | eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5565 | tScanResultHandle hBSSList, |
| 5566 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate, |
| 5567 | tANI_BOOLEAN fClearScan) |
| 5568 | { |
| 5569 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5570 | tSmeCmd *pCommand; |
| 5571 | |
| 5572 | pCommand = csrGetCommandBuffer(pMac); |
| 5573 | if(NULL == pCommand) |
| 5574 | { |
| 5575 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 5576 | status = eHAL_STATUS_RESOURCES; |
| 5577 | } |
| 5578 | else |
| 5579 | { |
| 5580 | if( fClearScan ) |
| 5581 | { |
| 5582 | csrScanCancelIdleScan(pMac); |
| 5583 | csrScanAbortMacScanNotForConnect(pMac); |
| 5584 | } |
| 5585 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 5586 | if(NULL == pProfile) |
| 5587 | { |
| 5588 | //We can roam now |
| 5589 | //Since pProfile is NULL, we need to build our own profile, set everything to default |
| 5590 | //We can only support open and no encryption |
| 5591 | pCommand->u.roamCmd.roamProfile.AuthType.numEntries = 1; |
| 5592 | pCommand->u.roamCmd.roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5593 | pCommand->u.roamCmd.roamProfile.EncryptionType.numEntries = 1; |
| 5594 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 5595 | pCommand->u.roamCmd.roamProfile.csrPersona = VOS_STA_MODE; |
| 5596 | } |
| 5597 | else |
| 5598 | { |
| 5599 | //make a copy of the profile |
| 5600 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 5601 | if(HAL_STATUS_SUCCESS(status)) |
| 5602 | { |
| 5603 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 5604 | } |
| 5605 | } |
| 5606 | pCommand->command = eSmeCommandRoam; |
| 5607 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5608 | pCommand->u.roamCmd.hBSSList = hBSSList; |
| 5609 | pCommand->u.roamCmd.roamId = roamId; |
| 5610 | pCommand->u.roamCmd.roamReason = reason; |
| 5611 | //We need to free the BssList when the command is done |
| 5612 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_TRUE; |
| 5613 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5614 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 5615 | FL("CSR PERSONA=%d"), |
| 5616 | pCommand->u.roamCmd.roamProfile.csrPersona); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5617 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 5618 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5619 | { |
| 5620 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 5621 | csrReleaseCommandRoam( pMac, pCommand ); |
| 5622 | } |
| 5623 | } |
| 5624 | |
| 5625 | return (status); |
| 5626 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5627 | eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5628 | tCsrRoamModifyProfileFields *pMmodProfileFields, |
| 5629 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 5630 | { |
| 5631 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5632 | tSmeCmd *pCommand; |
| 5633 | |
| 5634 | pCommand = csrGetCommandBuffer(pMac); |
| 5635 | if(NULL == pCommand) |
| 5636 | { |
| 5637 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 5638 | status = eHAL_STATUS_RESOURCES; |
| 5639 | } |
| 5640 | else |
| 5641 | { |
| 5642 | csrScanCancelIdleScan(pMac); |
| 5643 | csrScanAbortMacScanNotForConnect(pMac); |
| 5644 | if(pProfile) |
| 5645 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5646 | //This is likely trying to reassoc to different profile |
| 5647 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 5648 | //make a copy of the profile |
| 5649 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 5650 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5651 | } |
| 5652 | else |
| 5653 | { |
| 5654 | status = csrRoamCopyConnectedProfile(pMac, sessionId, &pCommand->u.roamCmd.roamProfile); |
| 5655 | //how to update WPA/WPA2 info in roamProfile?? |
| 5656 | pCommand->u.roamCmd.roamProfile.uapsd_mask = pMmodProfileFields->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5657 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5658 | if(HAL_STATUS_SUCCESS(status)) |
| 5659 | { |
| 5660 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 5661 | } |
| 5662 | pCommand->command = eSmeCommandRoam; |
| 5663 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5664 | pCommand->u.roamCmd.roamId = roamId; |
| 5665 | pCommand->u.roamCmd.roamReason = reason; |
| 5666 | //We need to free the BssList when the command is done |
| 5667 | //For reassoc there is no BSS list, so the boolean set to false |
| 5668 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 5669 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 5670 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5671 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 5672 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5673 | { |
| 5674 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 5675 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5676 | csrReleaseCommandRoam( pMac, pCommand ); |
| 5677 | } |
| 5678 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5679 | return (status); |
| 5680 | } |
| 5681 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 5682 | eHalStatus csrRoamEnqueuePreauth(tpAniSirGlobal pMac, tANI_U32 sessionId, tpSirBssDescription pBssDescription, |
| 5683 | eCsrRoamReason reason, tANI_BOOLEAN fImmediate) |
| 5684 | // , eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 5685 | { |
| 5686 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5687 | tSmeCmd *pCommand; |
| 5688 | |
| 5689 | pCommand = csrGetCommandBuffer(pMac); |
| 5690 | if(NULL == pCommand) |
| 5691 | { |
| 5692 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 5693 | status = eHAL_STATUS_RESOURCES; |
| 5694 | } |
| 5695 | else |
| 5696 | { |
| 5697 | if(pBssDescription) |
| 5698 | { |
| 5699 | //copy over the parameters we need later |
| 5700 | pCommand->command = eSmeCommandRoam; |
| 5701 | pCommand->sessionId = (tANI_U8)sessionId; |
| 5702 | pCommand->u.roamCmd.roamReason = reason; |
| 5703 | //this is the important parameter |
| 5704 | //in this case we are using this field for the "next" BSS |
| 5705 | pCommand->u.roamCmd.pLastRoamBss = pBssDescription; |
| 5706 | status = csrQueueSmeCommand(pMac, pCommand, fImmediate); |
| 5707 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 5708 | { |
| 5709 | smsLog( pMac, LOGE, FL(" fail to enqueue preauth command, status = %d\n"), status ); |
| 5710 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 5711 | } |
| 5712 | } |
| 5713 | else |
| 5714 | { |
| 5715 | //Return failure |
| 5716 | status = eHAL_STATUS_RESOURCES; |
| 5717 | } |
| 5718 | } |
| 5719 | return (status); |
| 5720 | } |
| 5721 | |
| 5722 | eHalStatus csrRoamDequeuePreauth(tpAniSirGlobal pMac) |
| 5723 | { |
| 5724 | tListElem *pEntry; |
| 5725 | tSmeCmd *pCommand; |
| 5726 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 5727 | if ( pEntry ) |
| 5728 | { |
| 5729 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 5730 | if ( (eSmeCommandRoam == pCommand->command) && |
| 5731 | (eCsrPerformPreauth == pCommand->u.roamCmd.roamReason)) |
| 5732 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 5733 | smsLog( pMac, LOG1, FL("DQ-Command = %d, Reason = %d"), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 5734 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 5735 | if (csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK )) { |
| 5736 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 5737 | } |
| 5738 | } else { |
| 5739 | smsLog( pMac, LOGE, FL("Command = %d, Reason = %d \n"), |
| 5740 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 5741 | } |
| 5742 | } |
| 5743 | else { |
| 5744 | smsLog( pMac, LOGE, FL("pEntry NULL for eWNI_SME_FT_PRE_AUTH_RSP\n")); |
| 5745 | } |
| 5746 | smeProcessPendingQueue( pMac ); |
| 5747 | return eHAL_STATUS_SUCCESS; |
| 5748 | } |
| 5749 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5750 | eHalStatus csrRoamConnectWithBSSList(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5751 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 5752 | { |
| 5753 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5754 | tScanResultHandle hBSSList; |
| 5755 | tANI_U32 roamId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5756 | status = csrScanCopyResultList(pMac, hBssListIn, &hBSSList); |
| 5757 | if(HAL_STATUS_SUCCESS(status)) |
| 5758 | { |
| 5759 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 5760 | if(pRoamId) |
| 5761 | { |
| 5762 | *pRoamId = roamId; |
| 5763 | } |
| 5764 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 5765 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 5766 | if(!HAL_STATUS_SUCCESS(status)) |
| 5767 | { |
| 5768 | smsLog(pMac, LOGE, FL("failed to start a join process\n")); |
| 5769 | csrScanResultPurge(pMac, hBSSList); |
| 5770 | } |
| 5771 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5772 | return (status); |
| 5773 | } |
| 5774 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5775 | eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5776 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 5777 | { |
| 5778 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5779 | tScanResultHandle hBSSList; |
| 5780 | tCsrScanResultFilter *pScanFilter; |
| 5781 | tANI_U32 roamId = 0; |
| 5782 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_FALSE; |
| 5783 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5784 | if (NULL == pProfile) |
| 5785 | { |
| 5786 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 5787 | return eHAL_STATUS_FAILURE; |
| 5788 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5789 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d\n"), |
| 5790 | pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5791 | if( CSR_IS_WDS( pProfile ) && |
| 5792 | !HAL_STATUS_SUCCESS( status = csrIsBTAMPAllowed( pMac, pProfile->operationChannel ) ) ) |
| 5793 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 5794 | smsLog(pMac, LOGE, FL("Request for BT AMP connection failed, channel requested is different than infra = %d\n"), |
| 5795 | pProfile->operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5796 | return status; |
| 5797 | } |
| 5798 | csrRoamCancelRoaming(pMac, sessionId); |
| 5799 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 5800 | csrScanCancelIdleScan(pMac); |
| 5801 | //Only abort the scan if it is not used for other roam/connect purpose |
| 5802 | csrScanAbortMacScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5803 | #ifdef WLAN_SOFTAP_FEATURE |
| 5804 | if (!vos_concurrent_sessions_running() && (VOS_STA_SAP_MODE == pProfile->csrPersona))//In case of AP mode we do not want idle mode scan |
| 5805 | { |
| 5806 | csrScanDisable(pMac); |
| 5807 | } |
| 5808 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5809 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 5810 | //Check whether ssid changes |
| 5811 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 5812 | { |
| 5813 | if(pProfile->SSIDs.numOfSSIDs && !csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 5814 | { |
| 5815 | csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 5816 | } |
| 5817 | } |
| 5818 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5819 | pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; |
| 5820 | #endif |
| 5821 | if(CSR_INVALID_SCANRESULT_HANDLE != hBssListIn) |
| 5822 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 5823 | smsLog(pMac, LOG1, FL("is called with BSSList\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5824 | status = csrRoamConnectWithBSSList(pMac, sessionId, pProfile, hBssListIn, pRoamId); |
| 5825 | if(pRoamId) |
| 5826 | { |
| 5827 | roamId = *pRoamId; |
| 5828 | } |
| 5829 | if(!HAL_STATUS_SUCCESS(status)) |
| 5830 | { |
| 5831 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5832 | } |
| 5833 | } |
| 5834 | else |
| 5835 | { |
| 5836 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 5837 | if(HAL_STATUS_SUCCESS(status)) |
| 5838 | { |
| 5839 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 5840 | //Try to connect to any BSS |
| 5841 | if(NULL == pProfile) |
| 5842 | { |
| 5843 | //No encryption |
| 5844 | pScanFilter->EncryptionType.numEntries = 1; |
| 5845 | pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 5846 | }//we don't have a profile |
| 5847 | else |
| 5848 | { |
| 5849 | //Here is the profile we need to connect to |
| 5850 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 5851 | }//We have a profile |
| 5852 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 5853 | if(pRoamId) |
| 5854 | { |
| 5855 | *pRoamId = roamId; |
| 5856 | } |
| 5857 | |
| 5858 | if(HAL_STATUS_SUCCESS(status)) |
| 5859 | { |
| 5860 | /*Save the WPS info*/ |
| 5861 | if(NULL != pProfile) |
| 5862 | { |
| 5863 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
| 5864 | } |
| 5865 | else |
| 5866 | { |
| 5867 | pScanFilter->bWPSAssociation = 0; |
| 5868 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5869 | do |
| 5870 | { |
| 5871 | if( (pProfile && CSR_IS_WDS_AP( pProfile ) ) |
| 5872 | #ifdef WLAN_SOFTAP_FEATURE |
| 5873 | || (pProfile && CSR_IS_INFRA_AP ( pProfile )) |
| 5874 | #endif |
| 5875 | ) |
| 5876 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 5877 | //This can be started right away |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5878 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 5879 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 5880 | if(!HAL_STATUS_SUCCESS(status)) |
| 5881 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 5882 | smsLog(pMac, LOGE, FL(" CSR failed to issue start BSS command with status = 0x%08X\n"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5883 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5884 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 5885 | else |
| 5886 | { |
| 5887 | smsLog(pMac, LOG1, FL("Connect request to proceed for AMP/SoftAP mode")); |
| 5888 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5889 | break; |
| 5890 | } |
| 5891 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 5892 | smsLog(pMac, LOG1, "************ csrScanGetResult Status ********* %d\n", status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5893 | if(HAL_STATUS_SUCCESS(status)) |
| 5894 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5895 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 5896 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 5897 | if(!HAL_STATUS_SUCCESS(status)) |
| 5898 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 5899 | smsLog(pMac, LOGE, FL(" CSR failed to issue connect command with status = 0x%08X\n"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5900 | csrScanResultPurge(pMac, hBSSList); |
| 5901 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5902 | } |
| 5903 | }//Have scan result |
| 5904 | else if(NULL != pProfile) |
| 5905 | { |
| 5906 | //Check whether it is for start ibss |
| 5907 | if(CSR_IS_START_IBSS(pProfile)) |
| 5908 | { |
| 5909 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 5910 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 5911 | if(!HAL_STATUS_SUCCESS(status)) |
| 5912 | { |
| 5913 | smsLog(pMac, LOGE, " CSR failed to issue startIBSS command with status = 0x%08X\n", status); |
| 5914 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5915 | } |
| 5916 | } |
| 5917 | else |
| 5918 | { |
| 5919 | //scan for this SSID |
| 5920 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId); |
| 5921 | if(!HAL_STATUS_SUCCESS(status)) |
| 5922 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 5923 | smsLog(pMac, LOGE, FL(" CSR failed to issue SSID scan command with status = 0x%08X\n"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5924 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5925 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 5926 | else |
| 5927 | { |
| 5928 | smsLog(pMac, LOG1, FL("SSID scan requested for Infra connect req")); |
| 5929 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | } |
| 5931 | } |
| 5932 | else |
| 5933 | { |
| 5934 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 5935 | } |
| 5936 | } while (0); |
| 5937 | if(NULL != pProfile) |
| 5938 | { |
| 5939 | //we need to free memory for filter if profile exists |
| 5940 | csrFreeScanFilter(pMac, pScanFilter); |
| 5941 | } |
| 5942 | }//Got the scan filter from profile |
| 5943 | |
| 5944 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 5945 | }//allocated memory for pScanFilter |
| 5946 | }//No Bsslist coming in |
| 5947 | //tell the caller if we fail to trigger a join request |
| 5948 | if( fCallCallback ) |
| 5949 | { |
| 5950 | csrRoamCallCallback(pMac, sessionId, NULL, roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 5951 | } |
| 5952 | |
| 5953 | return (status); |
| 5954 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5955 | eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 5956 | tCsrRoamModifyProfileFields modProfileFields, |
| 5957 | tANI_U32 *pRoamId) |
| 5958 | { |
| 5959 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5960 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_TRUE; |
| 5961 | tANI_U32 roamId = 0; |
| 5962 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5963 | if (NULL == pProfile) |
| 5964 | { |
| 5965 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 5966 | return eHAL_STATUS_FAILURE; |
| 5967 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5968 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d\n"), pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
| 5969 | csrRoamCancelRoaming(pMac, sessionId); |
| 5970 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 5971 | csrScanCancelIdleScan(pMac); |
| 5972 | csrScanAbortMacScanNotForConnect(pMac); |
| 5973 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssuedReassocToSameAP); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5974 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 5975 | { |
| 5976 | if(pProfile) |
| 5977 | { |
| 5978 | if(pProfile->SSIDs.numOfSSIDs && |
| 5979 | csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 5980 | { |
| 5981 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 5982 | } |
| 5983 | else |
| 5984 | { |
| 5985 | smsLog(pMac, LOG1, FL("Not connected to the same SSID asked in the profile\n")); |
| 5986 | } |
| 5987 | } |
| 5988 | else if(!palEqualMemory(pMac->hHdd, &modProfileFields, |
| 5989 | &pSession->connectedProfile.modifyProfileFields, |
| 5990 | sizeof(tCsrRoamModifyProfileFields))) |
| 5991 | { |
| 5992 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 5993 | } |
| 5994 | else |
| 5995 | { |
| 5996 | smsLog(pMac, LOG1, FL("Either the profile is NULL or none of the fields " |
| 5997 | "in tCsrRoamModifyProfileFields got modified\n")); |
| 5998 | } |
| 5999 | } |
| 6000 | else |
| 6001 | { |
| 6002 | smsLog(pMac, LOG1, FL("Not connected! No need to reassoc\n")); |
| 6003 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6004 | if(!fCallCallback) |
| 6005 | { |
| 6006 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6007 | if(pRoamId) |
| 6008 | { |
| 6009 | *pRoamId = roamId; |
| 6010 | } |
| 6011 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6012 | status = csrRoamIssueReassoc(pMac, sessionId, pProfile, &modProfileFields, |
| 6013 | eCsrHddIssuedReassocToSameAP, roamId, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6014 | } |
| 6015 | else |
| 6016 | { |
| 6017 | status = csrRoamCallCallback(pMac, sessionId, NULL, roamId, |
| 6018 | eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6019 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6020 | return status; |
| 6021 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6022 | eHalStatus csrRoamJoinLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6023 | { |
| 6024 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6025 | tScanResultHandle hBSSList = NULL; |
| 6026 | tCsrScanResultFilter *pScanFilter = NULL; |
| 6027 | tANI_U32 roamId; |
| 6028 | tCsrRoamProfile *pProfile = NULL; |
| 6029 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6030 | |
| 6031 | if(!pSession) |
| 6032 | { |
| 6033 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6034 | return eHAL_STATUS_FAILURE; |
| 6035 | } |
| 6036 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6037 | do |
| 6038 | { |
| 6039 | if(pSession->pCurRoamProfile) |
| 6040 | { |
| 6041 | csrScanCancelIdleScan(pMac); |
| 6042 | csrScanAbortMacScanNotForConnect(pMac); |
| 6043 | //We have to make a copy of pCurRoamProfile because it will be free inside csrRoamIssueConnect |
| 6044 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile, sizeof(tCsrRoamProfile)); |
| 6045 | if(!HAL_STATUS_SUCCESS(status)) |
| 6046 | break; |
| 6047 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile)); |
| 6048 | status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile); |
| 6049 | if(!HAL_STATUS_SUCCESS(status)) |
| 6050 | break; |
| 6051 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6052 | if(!HAL_STATUS_SUCCESS(status)) |
| 6053 | { |
| 6054 | break; |
| 6055 | } |
| 6056 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 6057 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6058 | if(!HAL_STATUS_SUCCESS(status)) |
| 6059 | { |
| 6060 | break; |
| 6061 | } |
| 6062 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6063 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 6064 | if(HAL_STATUS_SUCCESS(status)) |
| 6065 | { |
| 6066 | //we want to put the last connected BSS to the very beginning, if possible |
| 6067 | csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList); |
| 6068 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6069 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6070 | if(!HAL_STATUS_SUCCESS(status)) |
| 6071 | { |
| 6072 | csrScanResultPurge(pMac, hBSSList); |
| 6073 | break; |
| 6074 | } |
| 6075 | } |
| 6076 | else |
| 6077 | { |
| 6078 | //Do a scan on this profile |
| 6079 | //scan for this SSID only in case the AP suppresses SSID |
| 6080 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId); |
| 6081 | if(!HAL_STATUS_SUCCESS(status)) |
| 6082 | { |
| 6083 | break; |
| 6084 | } |
| 6085 | } |
| 6086 | }//We have a profile |
| 6087 | else |
| 6088 | { |
| 6089 | smsLog(pMac, LOGW, FL("cannot find a roaming profile\n")); |
| 6090 | break; |
| 6091 | } |
| 6092 | }while(0); |
| 6093 | if(pScanFilter) |
| 6094 | { |
| 6095 | csrFreeScanFilter(pMac, pScanFilter); |
| 6096 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 6097 | } |
| 6098 | if(NULL != pProfile) |
| 6099 | { |
| 6100 | csrReleaseProfile(pMac, pProfile); |
| 6101 | palFreeMemory(pMac->hHdd, pProfile); |
| 6102 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6103 | return (status); |
| 6104 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6105 | eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6106 | { |
| 6107 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6108 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6109 | { |
| 6110 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6111 | if(HAL_STATUS_SUCCESS(status)) |
| 6112 | { |
| 6113 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6114 | } |
| 6115 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6116 | return (status); |
| 6117 | } |
| 6118 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6119 | eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6120 | { |
| 6121 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6122 | smsLog(pMac, LOGW, FL("is called\n")); |
| 6123 | csrRoamCancelRoaming(pMac, sessionId); |
| 6124 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6125 | if(csrIsConnStateDisconnected(pMac, sessionId)) |
| 6126 | { |
| 6127 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6128 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6129 | return (status); |
| 6130 | } |
| 6131 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6132 | eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure ) |
| 6133 | { |
| 6134 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6135 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
| 6136 | eCsrRoamSubState NewSubstate; |
| 6137 | tANI_U32 sessionId = pCommand->sessionId; |
| 6138 | |
| 6139 | // change state to 'Roaming'... |
| 6140 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 6141 | |
| 6142 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 6143 | { |
| 6144 | // If we are in an IBSS, then stop the IBSS... |
| 6145 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6146 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6147 | } |
| 6148 | else if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6149 | { |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 6150 | smsLog(pMac, LOG1, FL(" restore AC weights (%d-%d-%d-%d)\n"), pMac->roam.ucACWeights[0], pMac->roam.ucACWeights[1], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6151 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 6152 | //Restore AC weight in case we change it |
| 6153 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 6154 | // in Infrasturcture, we need to disassociate from the Infrastructure network... |
| 6155 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED; |
| 6156 | if(eCsrSmeIssuedDisassocForHandoff == pCommand->u.roamCmd.roamReason) |
| 6157 | { |
| 6158 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF; |
| 6159 | } |
| 6160 | if( fDisassoc ) |
| 6161 | { |
| 6162 | status = csrRoamIssueDisassociate( pMac, sessionId, NewSubstate, fMICFailure ); |
| 6163 | } |
| 6164 | else |
| 6165 | { |
| 6166 | status = csrRoamIssueDeauth( pMac, sessionId, eCSR_ROAM_SUBSTATE_DEAUTH_REQ ); |
| 6167 | } |
| 6168 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6169 | } |
| 6170 | else if ( csrIsConnStateWds( pMac, sessionId ) ) |
| 6171 | { |
| 6172 | if( CSR_IS_WDS_AP( &pMac->roam.roamSession[sessionId].connectedProfile ) ) |
| 6173 | { |
| 6174 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6175 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6176 | } |
| 6177 | //This has to be WDS station |
| 6178 | else if( csrIsConnStateConnectedWds( pMac, sessionId ) ) //This has to be WDS station |
| 6179 | { |
| 6180 | |
| 6181 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 6182 | if( fDisassoc ) |
| 6183 | { |
| 6184 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 6185 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, fMICFailure ); |
| 6186 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6187 | } |
| 6188 | } |
| 6189 | } else { |
| 6190 | // we got a dis-assoc request while not connected to any peer |
| 6191 | // just complete the command |
| 6192 | fComplete = eANI_BOOLEAN_TRUE; |
| 6193 | status = eHAL_STATUS_FAILURE; |
| 6194 | } |
| 6195 | if(fComplete) |
| 6196 | { |
| 6197 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6198 | } |
| 6199 | |
| 6200 | if(HAL_STATUS_SUCCESS(status)) |
| 6201 | { |
| 6202 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6203 | { |
| 6204 | //Set the state to disconnect here |
| 6205 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 6206 | } |
| 6207 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6208 | else |
| 6209 | { |
| 6210 | smsLog(pMac, LOGW, FL(" failed with status %d"), status); |
| 6211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6212 | return (status); |
| 6213 | } |
| 6214 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6215 | /* This is been removed from latest code base */ |
| 6216 | /* |
| 6217 | static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 6218 | { |
| 6219 | eHalStatus status; |
| 6220 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6221 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING ); |
| 6222 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6223 | return ( status ); |
| 6224 | } |
| 6225 | */ |
| 6226 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6227 | eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason ) |
| 6228 | { |
| 6229 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6230 | tSmeCmd *pCommand; |
| 6231 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6232 | do |
| 6233 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6234 | smsLog( pMac, LOG1, FL(" reason = %d"), reason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6235 | pCommand = csrGetCommandBuffer( pMac ); |
| 6236 | if ( !pCommand ) |
| 6237 | { |
| 6238 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 6239 | status = eHAL_STATUS_RESOURCES; |
| 6240 | break; |
| 6241 | } |
| 6242 | //Change the substate in case it is wait-for-key |
| 6243 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 6244 | { |
| 6245 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6246 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 6247 | } |
| 6248 | pCommand->command = eSmeCommandRoam; |
| 6249 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6250 | switch ( reason ) |
| 6251 | { |
| 6252 | case eCSR_DISCONNECT_REASON_MIC_ERROR: |
| 6253 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocMICFailure; |
| 6254 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6255 | case eCSR_DISCONNECT_REASON_DEAUTH: |
| 6256 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauth; |
| 6257 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6258 | case eCSR_DISCONNECT_REASON_HANDOFF: |
| 6259 | fHighPriority = eANI_BOOLEAN_TRUE; |
| 6260 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff; |
| 6261 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6262 | case eCSR_DISCONNECT_REASON_UNSPECIFIED: |
| 6263 | case eCSR_DISCONNECT_REASON_DISASSOC: |
| 6264 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 6265 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6266 | case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE: |
| 6267 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedIbssJoinFailure; |
| 6268 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6269 | case eCSR_DISCONNECT_REASON_IBSS_LEAVE: |
| 6270 | pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave; |
| 6271 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6272 | default: |
| 6273 | break; |
| 6274 | } |
| 6275 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6276 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6277 | { |
| 6278 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 6279 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6280 | } |
| 6281 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6282 | return( status ); |
| 6283 | } |
| 6284 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6285 | eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority ) |
| 6286 | { |
| 6287 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6288 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6289 | pCommand = csrGetCommandBuffer( pMac ); |
| 6290 | if ( NULL != pCommand ) |
| 6291 | { |
| 6292 | //Change the substate in case it is wait-for-key |
| 6293 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 6294 | { |
| 6295 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6296 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 6297 | } |
| 6298 | pCommand->command = eSmeCommandRoam; |
| 6299 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6300 | pCommand->u.roamCmd.roamReason = eCsrStopBss; |
| 6301 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6302 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6303 | { |
| 6304 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 6305 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6306 | } |
| 6307 | } |
| 6308 | else |
| 6309 | { |
| 6310 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 6311 | status = eHAL_STATUS_RESOURCES; |
| 6312 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6313 | return ( status ); |
| 6314 | } |
| 6315 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6316 | eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 6317 | { |
| 6318 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6319 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6320 | |
| 6321 | if(!pSession) |
| 6322 | { |
| 6323 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6324 | return eHAL_STATUS_FAILURE; |
| 6325 | } |
| 6326 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6327 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6328 | //Stop te retry |
| 6329 | pSession->maxRetryCount = 0; |
| 6330 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 6331 | #endif |
| 6332 | //Not to call cancel roaming here |
| 6333 | //Only issue disconnect when necessary |
| 6334 | if(csrIsConnStateConnected(pMac, sessionId) || csrIsBssTypeIBSS(pSession->connectedProfile.BSSType) |
| 6335 | || csrIsBssTypeWDS(pSession->connectedProfile.BSSType) |
| 6336 | || csrIsRoamCommandWaitingForSession(pMac, sessionId) ) |
| 6337 | |
| 6338 | { |
| 6339 | smsLog(pMac, LOG2, FL("called\n")); |
| 6340 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, reason); |
| 6341 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6342 | return (status); |
| 6343 | } |
| 6344 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6345 | eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 6346 | { |
| 6347 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6348 | |
| 6349 | if(!pSession) |
| 6350 | { |
| 6351 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6352 | return eHAL_STATUS_FAILURE; |
| 6353 | } |
| 6354 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6355 | csrRoamCancelRoaming(pMac, sessionId); |
| 6356 | pSession->ibss_join_pending = FALSE; |
| 6357 | csrRoamStopIbssJoinTimer(pMac, sessionId); |
| 6358 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrForcedDisassoc); |
| 6359 | |
| 6360 | return (csrRoamDisconnectInternal(pMac, sessionId, reason)); |
| 6361 | } |
| 6362 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6363 | eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6364 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes) |
| 6365 | { |
| 6366 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6367 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 6368 | tANI_U8 index; |
| 6369 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 6370 | tCsrRoamConnectedProfile *pConnectProfile = &pSession->connectedProfile; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6371 | |
| 6372 | if(!pSession) |
| 6373 | { |
| 6374 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6375 | return eHAL_STATUS_FAILURE; |
| 6376 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6377 | |
| 6378 | palZeroMemory(pMac->hHdd, &pSession->connectedProfile, sizeof(tCsrRoamConnectedProfile)); |
| 6379 | pConnectProfile->AuthType = pProfile->negotiatedAuthType; |
| 6380 | pConnectProfile->AuthInfo = pProfile->AuthType; |
| 6381 | pConnectProfile->CBMode = pProfile->CBMode; //*** this may not be valid |
| 6382 | pConnectProfile->EncryptionType = pProfile->negotiatedUCEncryptionType; |
| 6383 | pConnectProfile->EncryptionInfo = pProfile->EncryptionType; |
| 6384 | pConnectProfile->mcEncryptionType = pProfile->negotiatedMCEncryptionType; |
| 6385 | pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType; |
| 6386 | pConnectProfile->BSSType = pProfile->BSSType; |
| 6387 | pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask; |
| 6388 | pConnectProfile->operationChannel = pSirBssDesc->channelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6389 | pConnectProfile->beaconInterval = pSirBssDesc->beaconInterval; |
| 6390 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6391 | palCopyMemory(pMac->hHdd, &pConnectProfile->Keys, &pProfile->Keys, sizeof(tCsrKeys)); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6392 | /* saving the addional IE`s like Hot spot indication element and extended capabilities */ |
| 6393 | if(pProfile->nAddIEAssocLength) |
| 6394 | { |
| 6395 | status = palAllocateMemory(pMac->hHdd, |
| 6396 | (void **)&pConnectProfile->pAddIEAssoc, pProfile->nAddIEAssocLength); |
| 6397 | if(!HAL_STATUS_SUCCESS(status)) |
| 6398 | { |
| 6399 | smsLog(pMac, LOGE, FL("Failed to allocate memory for additional IEs")) ; |
| 6400 | return eHAL_STATUS_FAILURE; |
| 6401 | } |
| 6402 | pConnectProfile->nAddIEAssocLength = pProfile->nAddIEAssocLength; |
| 6403 | palCopyMemory(pMac->hHdd, pConnectProfile->pAddIEAssoc, pProfile->pAddIEAssoc, |
| 6404 | pProfile->nAddIEAssocLength); |
| 6405 | } |
| 6406 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6407 | //Save bssid |
| 6408 | csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid); |
| 6409 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6410 | if (pSirBssDesc->mdiePresent) |
| 6411 | { |
| 6412 | pConnectProfile->MDID.mdiePresent = 1; |
| 6413 | pConnectProfile->MDID.mobilityDomain = (pSirBssDesc->mdie[1] << 8) | (pSirBssDesc->mdie[0]); |
| 6414 | } |
| 6415 | #endif |
| 6416 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6417 | if ((csrIsProfileCCX(pProfile) || |
| 6418 | ((pIesTemp->CCXVersion.present) |
| 6419 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 6420 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 6421 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 6422 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
| 6423 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
| 6424 | && (!(csrIsProfile11r( pProfile ))) |
| 6425 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6426 | { |
| 6427 | pConnectProfile->isCCXAssoc = 1; |
| 6428 | } |
| 6429 | #endif |
| 6430 | //save ssid |
| 6431 | if( NULL == pIesTemp ) |
| 6432 | { |
| 6433 | status = csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp); |
| 6434 | } |
| 6435 | if(HAL_STATUS_SUCCESS(status)) |
| 6436 | { |
| 6437 | if(pIesTemp->SSID.present) |
| 6438 | { |
| 6439 | pConnectProfile->SSID.length = pIesTemp->SSID.num_ssid; |
| 6440 | palCopyMemory(pMac->hHdd, pConnectProfile->SSID.ssId, |
| 6441 | pIesTemp->SSID.ssid, pIesTemp->SSID.num_ssid); |
| 6442 | } |
| 6443 | |
| 6444 | //Save the bss desc |
| 6445 | status = csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 6446 | |
| 6447 | if( CSR_IS_QOS_BSS(pIesTemp) || pIesTemp->HTCaps.present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6448 | { |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 6449 | //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] | 6450 | pConnectProfile->qap = TRUE; |
| 6451 | } |
| 6452 | else |
| 6453 | { |
| 6454 | pConnectProfile->qap = FALSE; |
| 6455 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6456 | if ( NULL == pIes ) |
| 6457 | { |
| 6458 | //Free memory if it allocated locally |
| 6459 | palFreeMemory(pMac->hHdd, pIesTemp); |
| 6460 | } |
| 6461 | } |
| 6462 | //Save Qos connection |
| 6463 | pConnectProfile->qosConnection = pMac->roam.roamSession[sessionId].fWMMConnection; |
| 6464 | |
| 6465 | if(!HAL_STATUS_SUCCESS(status)) |
| 6466 | { |
| 6467 | csrFreeConnectBssDesc(pMac, sessionId); |
| 6468 | } |
| 6469 | for(index = 0; index < pProfile->SSIDs.numOfSSIDs; index++) |
| 6470 | { |
| 6471 | if((pProfile->SSIDs.SSIDList[index].SSID.length == pConnectProfile->SSID.length) && |
| 6472 | palEqualMemory(pMac->hHdd, pProfile->SSIDs.SSIDList[index].SSID.ssId, |
| 6473 | pConnectProfile->SSID.ssId, pConnectProfile->SSID.length)) |
| 6474 | { |
| 6475 | pConnectProfile->handoffPermitted = pProfile->SSIDs.SSIDList[index].handoffPermitted; |
| 6476 | break; |
| 6477 | } |
| 6478 | pConnectProfile->handoffPermitted = FALSE; |
| 6479 | } |
| 6480 | |
| 6481 | return (status); |
| 6482 | } |
| 6483 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6484 | static void csrRoamJoinRspProcessor( tpAniSirGlobal pMac, tSirSmeJoinRsp *pSmeJoinRsp ) |
| 6485 | { |
| 6486 | tListElem *pEntry = NULL; |
| 6487 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6488 | //The head of the active list is the request we sent |
| 6489 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6490 | if(pEntry) |
| 6491 | { |
| 6492 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6493 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6494 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 6495 | { |
| 6496 | if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason) |
| 6497 | { |
| 6498 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6499 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 6500 | #endif |
| 6501 | } |
| 6502 | csrRoamComplete( pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp ); |
| 6503 | } |
| 6504 | else |
| 6505 | { |
| 6506 | tANI_U32 roamId = 0; |
| 6507 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6508 | if(!pSession) |
| 6509 | { |
| 6510 | smsLog(pMac, LOGE, FL(" session %d not found "), pSmeJoinRsp->sessionId); |
| 6511 | return; |
| 6512 | } |
| 6513 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6514 | |
| 6515 | //The head of the active list is the request we sent |
| 6516 | //Try to get back the same profile and roam again |
| 6517 | if(pCommand) |
| 6518 | { |
| 6519 | roamId = pCommand->u.roamCmd.roamId; |
| 6520 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6521 | pSession->joinFailStatusCode.statusCode = pSmeJoinRsp->statusCode; |
| 6522 | pSession->joinFailStatusCode.reasonCode = pSmeJoinRsp->protStatusCode; |
| 6523 | smsLog( pMac, LOGW, "SmeJoinReq failed with statusCode= 0x%08lX [%d]\n", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); |
| 6524 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 6525 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 6526 | if (csrRoamIsHandoffInProgress(pMac)) |
| 6527 | { |
| 6528 | csrRoamCallCallback(pMac, pSmeJoinRsp->sessionId, NULL, roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 6529 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 6530 | csrNeighborRoamIndicateConnect(pMac, pSmeJoinRsp->sessionId, VOS_STATUS_E_FAILURE); |
| 6531 | } |
| 6532 | #endif |
| 6533 | if (pCommand) |
| 6534 | { |
| 6535 | if(CSR_IS_WDS_STA( &pCommand->u.roamCmd.roamProfile )) |
| 6536 | { |
| 6537 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 6538 | pSession->connectedProfile.BSSType = eCSR_BSS_TYPE_WDS_STA; |
| 6539 | csrRoamReissueRoamCommand(pMac); |
| 6540 | } |
| 6541 | else if( CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) ) |
| 6542 | { |
| 6543 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6544 | } |
| 6545 | else |
| 6546 | { |
| 6547 | csrRoam(pMac, pCommand); |
| 6548 | } |
| 6549 | } |
| 6550 | else |
| 6551 | { |
| 6552 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6553 | } |
| 6554 | } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */ |
| 6555 | } |
| 6556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6557 | eHalStatus csrRoamIssueJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 6558 | tDot11fBeaconIEs *pIes, |
| 6559 | tCsrRoamProfile *pProfile, tANI_U32 roamId ) |
| 6560 | { |
| 6561 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6562 | smsLog( pMac, LOG1, "Attempting to Join Bssid= %02x-%02x-%02x-%02x-%02x-%02x\n", |
| 6563 | pSirBssDesc->bssId[ 0 ],pSirBssDesc->bssId[ 1 ],pSirBssDesc->bssId[ 2 ], |
| 6564 | pSirBssDesc->bssId[ 3 ],pSirBssDesc->bssId[ 4 ],pSirBssDesc->bssId[ 5 ] ); |
| 6565 | |
| 6566 | // Set the roaming substate to 'join attempt'... |
| 6567 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6568 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 6569 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6570 | return (status); |
| 6571 | } |
| 6572 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6573 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 6574 | tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile) |
| 6575 | { |
| 6576 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6577 | // Set the roaming substate to 'join attempt'... |
| 6578 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId ); |
| 6579 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 6580 | smsLog(pMac, LOGE, FL(" calling csrSendJoinReqMsg (eWNI_SME_REASSOC_REQ)\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6581 | |
| 6582 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 6583 | return csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_REASSOC_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6584 | } |
| 6585 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6586 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac) |
| 6587 | { |
| 6588 | tListElem *pEntry; |
| 6589 | tSmeCmd *pCommand; |
| 6590 | tCsrRoamInfo roamInfo; |
| 6591 | tANI_U32 sessionId; |
| 6592 | tCsrRoamSession *pSession; |
| 6593 | |
| 6594 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6595 | if(pEntry) |
| 6596 | { |
| 6597 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6598 | if ( eSmeCommandRoam == pCommand->command ) |
| 6599 | { |
| 6600 | sessionId = pCommand->sessionId; |
| 6601 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6602 | |
| 6603 | if(!pSession) |
| 6604 | { |
| 6605 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6606 | return; |
| 6607 | } |
| 6608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6609 | if( pCommand->u.roamCmd.fStopWds ) |
| 6610 | { |
| 6611 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 6612 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 6613 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 6614 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 6615 | #ifdef WLAN_SOFTAP_FEATURE |
| 6616 | if (CSR_IS_WDS(&pSession->connectedProfile)){ |
| 6617 | #endif |
| 6618 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 6619 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 6620 | eCSR_ROAM_WDS_IND, |
| 6621 | eCSR_ROAM_RESULT_WDS_DISASSOCIATED); |
| 6622 | #ifdef WLAN_SOFTAP_FEATURE |
| 6623 | }else if (CSR_IS_INFRA_AP(&pSession->connectedProfile)){ |
| 6624 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 6625 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 6626 | eCSR_ROAM_INFRA_IND, |
| 6627 | eCSR_ROAM_RESULT_INFRA_DISASSOCIATED); |
| 6628 | } |
| 6629 | |
| 6630 | #endif |
| 6631 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6632 | if( !HAL_STATUS_SUCCESS( csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ) ) ) |
| 6633 | { |
| 6634 | smsLog(pMac, LOGE, " Failed to reissue stop_bss command for WDS after disassociated\n"); |
| 6635 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6636 | } |
| 6637 | } |
| 6638 | else if(eCsrStopRoaming == csrRoamJoinNextBss(pMac, pCommand, eANI_BOOLEAN_TRUE)) |
| 6639 | { |
| 6640 | smsLog(pMac, LOGW, " Failed to reissue join command after disassociated\n"); |
| 6641 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6642 | } |
| 6643 | } |
| 6644 | else |
| 6645 | { |
| 6646 | smsLog(pMac, LOGW, " Command is not roaming after disassociated\n"); |
| 6647 | } |
| 6648 | } |
| 6649 | else |
| 6650 | { |
| 6651 | smsLog(pMac, LOGE, " Disassoc rsp cannot continue because no command is available\n"); |
| 6652 | } |
| 6653 | } |
| 6654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6655 | tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6656 | { |
| 6657 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 6658 | tListElem *pEntry; |
| 6659 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | //alwasy lock active list before locking pending list |
| 6661 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 6662 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 6663 | if(pEntry) |
| 6664 | { |
| 6665 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6666 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 6667 | { |
| 6668 | fRet = eANI_BOOLEAN_TRUE; |
| 6669 | } |
| 6670 | } |
| 6671 | if(eANI_BOOLEAN_FALSE == fRet) |
| 6672 | { |
| 6673 | csrLLLock(&pMac->sme.smeCmdPendingList); |
| 6674 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK); |
| 6675 | while(pEntry) |
| 6676 | { |
| 6677 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6678 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 6679 | { |
| 6680 | fRet = eANI_BOOLEAN_TRUE; |
| 6681 | break; |
| 6682 | } |
| 6683 | pEntry = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK); |
| 6684 | } |
| 6685 | csrLLUnlock(&pMac->sme.smeCmdPendingList); |
| 6686 | } |
| 6687 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6688 | return (fRet); |
| 6689 | } |
| 6690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6691 | tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac) |
| 6692 | { |
| 6693 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 6694 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6695 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 6696 | { |
| 6697 | if( CSR_IS_SESSION_VALID( pMac, i ) && ( fRet = csrIsRoamCommandWaitingForSession( pMac, i ) ) ) |
| 6698 | { |
| 6699 | break; |
| 6700 | } |
| 6701 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6702 | return ( fRet ); |
| 6703 | } |
| 6704 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6705 | tANI_BOOLEAN csrIsCommandWaiting(tpAniSirGlobal pMac) |
| 6706 | { |
| 6707 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6708 | //alwasy lock active list before locking pending list |
| 6709 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 6710 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 6711 | if(eANI_BOOLEAN_FALSE == fRet) |
| 6712 | { |
| 6713 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK); |
| 6714 | } |
| 6715 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6716 | return (fRet); |
| 6717 | } |
| 6718 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6719 | tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac ) |
| 6720 | { |
| 6721 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 6722 | tListElem *pEntry; |
| 6723 | tCsrCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6724 | //alwasy lock active list before locking pending list |
| 6725 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 6726 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 6727 | if( pEntry ) |
| 6728 | { |
| 6729 | pCommand = GET_BASE_ADDR(pEntry, tCsrCmd, Link); |
| 6730 | if( ( eCsrRoamCommandScan == pCommand->command ) && |
| 6731 | ( ( eCsrScanForSsid == pCommand->u.scanCmd.reason ) || |
| 6732 | ( eCsrScanForCapsChange == pCommand->u.scanCmd.reason ) || |
| 6733 | ( eCsrScanP2PFindPeer == pCommand->u.scanCmd.reason ) ) ) |
| 6734 | { |
| 6735 | fRet = eANI_BOOLEAN_TRUE; |
| 6736 | } |
| 6737 | } |
| 6738 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6739 | return (fRet); |
| 6740 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6741 | eHalStatus csrRoamIssueReassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 6742 | { |
| 6743 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6744 | tSmeCmd *pCommand = NULL; |
| 6745 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_TRUE; |
| 6746 | tANI_BOOLEAN fRemoveCmd = FALSE; |
| 6747 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6748 | // Delete the old assoc command. All is setup for reassoc to be serialized |
| 6749 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 6750 | if ( pEntry ) |
| 6751 | { |
| 6752 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 6753 | if ( !pCommand ) |
| 6754 | { |
| 6755 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 6756 | return eHAL_STATUS_RESOURCES; |
| 6757 | } |
| 6758 | if ( eSmeCommandRoam == pCommand->command ) |
| 6759 | { |
| 6760 | if (pCommand->u.roamCmd.roamReason == eCsrSmeIssuedAssocToSimilarAP) |
| 6761 | { |
| 6762 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 6763 | } |
| 6764 | else |
| 6765 | { |
| 6766 | smsLog( pMac, LOGE, FL(" Unexpected active roam command present \n") ); |
| 6767 | } |
| 6768 | if (fRemoveCmd == FALSE) |
| 6769 | { |
| 6770 | // Implies we did not get the serialized assoc command we |
| 6771 | // were expecting |
| 6772 | pCommand = NULL; |
| 6773 | } |
| 6774 | } |
| 6775 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6776 | if(NULL == pCommand) |
| 6777 | { |
| 6778 | smsLog( pMac, LOGE, FL(" fail to get command buffer as expected based on previous connect roam command\n") ); |
| 6779 | return eHAL_STATUS_RESOURCES; |
| 6780 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6781 | do |
| 6782 | { |
| 6783 | //Change the substate in case it is wait-for-key |
| 6784 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 6785 | { |
| 6786 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6787 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 6788 | } |
| 6789 | pCommand->command = eSmeCommandRoam; |
| 6790 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6791 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedFTReassoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6792 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6793 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6794 | { |
| 6795 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 6796 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6797 | } |
| 6798 | } while( 0 ); |
| 6799 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6800 | return( status ); |
| 6801 | } |
| 6802 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ) |
| 6803 | { |
| 6804 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 6805 | tCsrScanResult *pScanResult = NULL; |
| 6806 | tSirBssDescription *pBssDesc = NULL; |
| 6807 | tSmeCmd *pCommand = NULL; |
| 6808 | tANI_U32 sessionId; |
| 6809 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6810 | if(NULL == pEntry) |
| 6811 | { |
| 6812 | smsLog(pMac, LOGW, " CFG_CNF with active list empty\n"); |
| 6813 | return; |
| 6814 | } |
| 6815 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 6816 | sessionId = pCommand->sessionId; |
| 6817 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6818 | |
| 6819 | if(!pSession) |
| 6820 | { |
| 6821 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6822 | return; |
| 6823 | } |
| 6824 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6825 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 6826 | { |
| 6827 | //the roaming is cancelled. Simply complete the command |
| 6828 | smsLog(pMac, LOGW, FL(" Roam command cancelled\n")); |
| 6829 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 6830 | } |
| 6831 | else |
| 6832 | { |
| 6833 | if ( CCM_IS_RESULT_SUCCESS(result) ) |
| 6834 | { |
| 6835 | smsLog(pMac, LOG2, "Cfg sequence complete\n"); |
| 6836 | // Successfully set the configuration parameters for the new Bss. Attempt to |
| 6837 | // join the roaming Bss. |
| 6838 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 6839 | { |
| 6840 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 6841 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 6842 | } |
| 6843 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) || |
| 6844 | CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) |
| 6845 | #ifdef WLAN_SOFTAP_FEATURE |
| 6846 | || CSR_IS_INFRA_AP(&pCommand->u.roamCmd.roamProfile) |
| 6847 | #endif |
| 6848 | ) |
| 6849 | { |
| 6850 | if(!HAL_STATUS_SUCCESS(csrRoamIssueStartBss( pMac, sessionId, |
| 6851 | &pSession->bssParams, &pCommand->u.roamCmd.roamProfile, |
| 6852 | pBssDesc, pCommand->u.roamCmd.roamId ))) |
| 6853 | { |
| 6854 | smsLog(pMac, LOGW, " CSR start BSS failed\n"); |
| 6855 | //We need to complete the command |
| 6856 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 6857 | } |
| 6858 | } |
| 6859 | else |
| 6860 | { |
| 6861 | if (!pCommand->u.roamCmd.pRoamBssEntry) |
| 6862 | { |
| 6863 | smsLog(pMac, LOGW, " pRoamBssEntry is NULL\n"); |
| 6864 | //We need to complete the command |
| 6865 | csrRoamComplete(pMac, eCsrJoinFailure, NULL); |
| 6866 | return; |
| 6867 | } |
| 6868 | // If we are roaming TO an Infrastructure BSS... |
| 6869 | VOS_ASSERT(pScanResult != NULL); |
| 6870 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 6871 | { |
| 6872 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6873 | if(pIesLocal || (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 6874 | { |
| 6875 | // ..and currently in an Infrastructure connection.... |
| 6876 | if( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 6877 | { |
| 6878 | // ...and the SSIDs are equal, then we Reassoc. |
| 6879 | if ( csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, |
| 6880 | pIesLocal ) ) |
| 6881 | // ..and currently in an infrastructure connection |
| 6882 | { |
| 6883 | // then issue a Reassoc. |
| 6884 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
| 6885 | csrRoamIssueReassociate( pMac, sessionId, pBssDesc, pIesLocal, |
| 6886 | &pCommand->u.roamCmd.roamProfile ); |
| 6887 | } |
| 6888 | else |
| 6889 | { |
| 6890 | |
| 6891 | // otherwise, we have to issue a new Join request to LIM because we disassociated from the |
| 6892 | // previously associated AP. |
| 6893 | if(!HAL_STATUS_SUCCESS(csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 6894 | pIesLocal, |
| 6895 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ))) |
| 6896 | { |
| 6897 | //try something else |
| 6898 | csrRoam( pMac, pCommand ); |
| 6899 | } |
| 6900 | } |
| 6901 | } |
| 6902 | else |
| 6903 | { |
| 6904 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6905 | |
| 6906 | /* We need to come with other way to figure out that this is because of HO in BMP |
| 6907 | The below API will be only available for Android as it uses a different HO algorithm */ |
| 6908 | /* Reassoc request will be used only for CCX and 11r handoff whereas other legacy roaming should |
| 6909 | * use join request */ |
| 6910 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6911 | if (csrRoamIsHandoffInProgress(pMac) && |
| 6912 | csrRoamIs11rAssoc(pMac)) |
| 6913 | { |
| 6914 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 6915 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 6916 | } |
| 6917 | else |
| 6918 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6919 | #ifdef FEATURE_WLAN_CCX |
| 6920 | if (csrRoamIsHandoffInProgress(pMac) && |
| 6921 | csrRoamIsCCXAssoc(pMac)) |
| 6922 | { |
| 6923 | // Now serialize the reassoc command. |
| 6924 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 6925 | } |
| 6926 | else |
| 6927 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6928 | #ifdef FEATURE_WLAN_LFR |
| 6929 | if (csrRoamIsHandoffInProgress(pMac) && |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 6930 | csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6931 | { |
| 6932 | // Now serialize the reassoc command. |
| 6933 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 6934 | } |
| 6935 | else |
| 6936 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6937 | // else we are not connected and attempting to Join. Issue the |
| 6938 | // Join request. |
| 6939 | { |
| 6940 | status = csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 6941 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), |
| 6942 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ); |
| 6943 | } |
| 6944 | if(!HAL_STATUS_SUCCESS(status)) |
| 6945 | { |
| 6946 | //try something else |
| 6947 | csrRoam( pMac, pCommand ); |
| 6948 | } |
| 6949 | } |
| 6950 | if( !pScanResult->Result.pvIes ) |
| 6951 | { |
| 6952 | //Locally allocated |
| 6953 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 6954 | } |
| 6955 | } |
| 6956 | }//if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 6957 | else |
| 6958 | { |
| 6959 | smsLog(pMac, LOGW, FL(" found BSSType mismatching the one in BSS description\n")); |
| 6960 | } |
| 6961 | }//else |
| 6962 | }//if ( WNI_CFG_SUCCESS == result ) |
| 6963 | else |
| 6964 | { |
| 6965 | // In the event the configuration failed, for infra let the roam processor |
| 6966 | //attempt to join something else... |
| 6967 | if( pCommand->u.roamCmd.pRoamBssEntry && CSR_IS_INFRASTRUCTURE( &pCommand->u.roamCmd.roamProfile ) ) |
| 6968 | { |
| 6969 | csrRoam(pMac, pCommand); |
| 6970 | } |
| 6971 | else |
| 6972 | { |
| 6973 | //We need to complete the command |
| 6974 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) ) |
| 6975 | { |
| 6976 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 6977 | } |
| 6978 | else |
| 6979 | { |
| 6980 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6981 | } |
| 6982 | } |
| 6983 | } |
| 6984 | }//we have active entry |
| 6985 | } |
| 6986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6987 | static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp ) |
| 6988 | { |
| 6989 | //No one is sending eWNI_SME_AUTH_REQ to PE. |
| 6990 | smsLog(pMac, LOGW, FL("is no-op\n")); |
| 6991 | if ( eSIR_SME_SUCCESS == pSmeAuthRsp->statusCode ) |
| 6992 | { |
| 6993 | smsLog( pMac, LOGW, "CSR SmeAuthReq Successful\n" ); |
| 6994 | // Successfully authenticated with a new Bss. Attempt to stop the current Bss and |
| 6995 | // join the new one... |
| 6996 | /***pBssDesc = profGetRoamingBssDesc( pAdapter, &pHddProfile ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6997 | roamStopNetwork( pAdapter, &pBssDesc->SirBssDescription );***/ |
| 6998 | } |
| 6999 | else { |
| 7000 | smsLog( pMac, LOGW, "CSR SmeAuthReq failed with statusCode= 0x%08lX [%d]\n", pSmeAuthRsp->statusCode, pSmeAuthRsp->statusCode ); |
| 7001 | /***profHandleLostLinkAfterReset(pAdapter); |
| 7002 | // In the event the authenticate fails, let the roam processor attempt to join something else... |
| 7003 | roamRoam( pAdapter );***/ |
| 7004 | } |
| 7005 | } |
| 7006 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7007 | static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSmeJoinRsp pSmeJoinRsp ) |
| 7008 | { |
| 7009 | eCsrRoamCompleteResult result; |
| 7010 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 7011 | tCsrRoamInfo roamInfo; |
| 7012 | tANI_U32 roamId = 0; |
| 7013 | |
| 7014 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 7015 | { |
| 7016 | smsLog( pMac, LOGW, "CSR SmeReassocReq Successful\n" ); |
| 7017 | result = eCsrReassocSuccess; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7018 | /* Defeaturize this part later if needed */ |
| 7019 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7020 | /* Since the neighbor roam algorithm uses reassoc req for handoff instead of join, |
| 7021 | * we need the response contents while processing the result in csrRoamProcessResults() */ |
| 7022 | if (csrRoamIsHandoffInProgress(pMac)) |
| 7023 | { |
| 7024 | /* Need to dig more on indicating events to SME QoS module */ |
| 7025 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 7026 | csrRoamComplete( pMac, result, pSmeJoinRsp); |
| 7027 | } |
| 7028 | else |
| 7029 | #endif |
| 7030 | { |
| 7031 | csrRoamComplete( pMac, result, NULL ); |
| 7032 | } |
| 7033 | } |
| 7034 | /* Should we handle this similar to handling the join failure? Is it ok |
| 7035 | * to call csrRoamComplete() with state as CsrJoinFailure */ |
| 7036 | else |
| 7037 | { |
| 7038 | smsLog( pMac, LOGW, "CSR SmeReassocReq failed with statusCode= 0x%08lX [%d]\n", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); |
| 7039 | result = eCsrReassocFailure; |
| 7040 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7041 | if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) || |
| 7042 | (eSIR_SME_FT_REASSOC_FAILURE == pSmeJoinRsp->statusCode)) |
| 7043 | { |
| 7044 | // Inform HDD to turn off FT flag in HDD |
| 7045 | if (pNeighborRoamInfo) |
| 7046 | { |
| 7047 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7048 | csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, |
| 7049 | &roamInfo, roamId, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
Madan Mohan Koyyalamudi | 5777216 | 2012-10-18 19:46:14 -0700 | [diff] [blame] | 7050 | /* |
| 7051 | * Since the above callback sends a disconnect |
| 7052 | * to HDD, we should clean-up our state |
| 7053 | * machine as well to be in sync with the upper |
| 7054 | * layers. There is no need to send a disassoc |
| 7055 | * since: 1) we will never reassoc to the current |
| 7056 | * AP in LFR, and 2) there is no need to issue a |
| 7057 | * disassoc to the AP with which we were trying |
| 7058 | * to reassoc. |
| 7059 | */ |
| 7060 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7061 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7062 | } |
| 7063 | } |
| 7064 | #endif |
| 7065 | // In the event that the Reassociation fails, then we need to Disassociate the current association and keep |
| 7066 | // roaming. Note that we will attempt to Join the AP instead of a Reassoc since we may have attempted a |
| 7067 | // 'Reassoc to self', which AP's that don't support Reassoc will force a Disassoc. |
| 7068 | //The disassoc rsp message will remove the command from active list |
| 7069 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, pSmeJoinRsp->sessionId, |
| 7070 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE ))) |
| 7071 | { |
| 7072 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7073 | } |
| 7074 | } |
| 7075 | } |
| 7076 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7077 | static void csrRoamRoamingStateStopBssRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSmeRsp) |
| 7078 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7079 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7080 | { |
| 7081 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7082 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 7083 | if(pIbssLog) |
| 7084 | { |
| 7085 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_RSP; |
| 7086 | if(eSIR_SME_SUCCESS != pSmeRsp->statusCode) |
| 7087 | { |
| 7088 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 7089 | } |
| 7090 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 7091 | } |
| 7092 | } |
| 7093 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7094 | pMac->roam.roamSession[pSmeRsp->sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7095 | if(CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, pSmeRsp->sessionId)) |
| 7096 | { |
| 7097 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7098 | } |
| 7099 | else if(CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId)) |
| 7100 | { |
| 7101 | csrRoamReissueRoamCommand(pMac); |
| 7102 | } |
| 7103 | } |
| 7104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7105 | void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeRsp ) |
| 7106 | { |
| 7107 | tSirResultCodes statusCode; |
| 7108 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7109 | tScanResultHandle hBSSList; |
| 7110 | tANI_BOOLEAN fCallCallback, fRemoveCmd; |
| 7111 | eHalStatus status; |
| 7112 | tCsrRoamInfo roamInfo; |
| 7113 | tCsrScanResultFilter *pScanFilter = NULL; |
| 7114 | tANI_U32 roamId = 0; |
| 7115 | tCsrRoamProfile *pCurRoamProfile = NULL; |
| 7116 | tListElem *pEntry = NULL; |
| 7117 | tSmeCmd *pCommand = NULL; |
| 7118 | #endif |
| 7119 | tANI_U32 sessionId; |
| 7120 | tCsrRoamSession *pSession; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7121 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7122 | tSirSmeDisassocRsp SmeDisassocRsp; |
| 7123 | |
| 7124 | csrSerDesUnpackDiassocRsp((tANI_U8 *)pSmeRsp, &SmeDisassocRsp); |
| 7125 | sessionId = SmeDisassocRsp.sessionId; |
| 7126 | statusCode = SmeDisassocRsp.statusCode; |
| 7127 | |
| 7128 | smsLog( pMac, LOG2, "csrRoamRoamingStateDisassocRspProcessor sessionId %d\n", sessionId); |
| 7129 | |
| 7130 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 7131 | { |
| 7132 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7133 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7134 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7135 | |
| 7136 | if(!pSession) |
| 7137 | { |
| 7138 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7139 | return; |
| 7140 | } |
| 7141 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7142 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) ) |
| 7143 | { |
| 7144 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7145 | } |
| 7146 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, sessionId ) || |
| 7147 | CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, sessionId ) ) |
| 7148 | { |
| 7149 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7150 | { |
| 7151 | smsLog( pMac, LOG2, "CSR SmeDisassocReq force disassociated Successfully\n" ); |
| 7152 | //A callback to HDD will be issued from csrRoamComplete so no need to do anything here |
| 7153 | } |
| 7154 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7155 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7156 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId ) ) |
| 7157 | { |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7158 | smsLog( pMac, LOGE, "CSR SmeDisassocReq due to HO on session %d\n", sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7159 | #if defined (WLAN_FEATURE_NEIGHBOR_ROAMING) |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7160 | /* |
| 7161 | * First ensure if the roam profile is in the scan cache. |
| 7162 | * If not, post a reassoc failure and disconnect. |
| 7163 | */ |
| 7164 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 7165 | if(HAL_STATUS_SUCCESS(status)) |
| 7166 | { |
| 7167 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 7168 | status = csrRoamPrepareFilterFromProfile(pMac, |
| 7169 | &pMac->roam.neighborRoamInfo.csrNeighborRoamProfile, pScanFilter); |
| 7170 | if(!HAL_STATUS_SUCCESS(status)) |
| 7171 | { |
| 7172 | smsLog(pMac, LOGE, "%s: failed to prepare scan filter with status %d", |
| 7173 | __func__, status); |
| 7174 | goto POST_ROAM_FAILURE; |
| 7175 | } |
| 7176 | else |
| 7177 | { |
| 7178 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 7179 | if (!HAL_STATUS_SUCCESS(status)) |
| 7180 | { |
| 7181 | smsLog( pMac, LOGE,"%s: csrScanGetResult failed with status %d", |
| 7182 | __func__, status); |
| 7183 | goto POST_ROAM_FAILURE; |
| 7184 | } |
| 7185 | } |
| 7186 | } |
| 7187 | else |
| 7188 | { |
| 7189 | smsLog( pMac, LOGE,"%s: alloc for pScanFilter failed with status %d", |
| 7190 | __func__, status); |
| 7191 | goto POST_ROAM_FAILURE; |
| 7192 | } |
| 7193 | |
| 7194 | /* |
| 7195 | * After ensuring that the roam profile is in the scan result list, |
| 7196 | * dequeue the command from the active list. |
| 7197 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7198 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 7199 | if ( pEntry ) |
| 7200 | { |
| 7201 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7202 | /* If the head of the queue is Active and it is a ROAM command, remove |
| 7203 | * and put this on the Free queue. |
| 7204 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7205 | if ( eSmeCommandRoam == pCommand->command ) |
| 7206 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7207 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7208 | /* |
| 7209 | * we need to process the result first before removing it from active list |
| 7210 | * because state changes still happening insides roamQProcessRoamResults so |
| 7211 | * no other roam command should be issued. |
| 7212 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7213 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 7214 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 7215 | { |
| 7216 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 7217 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 7218 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7219 | if( fRemoveCmd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7220 | csrReleaseCommandRoam( pMac, pCommand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7221 | else |
| 7222 | { |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7223 | smsLog( pMac, LOGE, "%s: fail to remove cmd reason %d\n", |
| 7224 | __func__, pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7225 | } |
| 7226 | } |
| 7227 | else |
| 7228 | { |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7229 | smsLog( pMac, LOGE, "%s: roam command not active\n", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7230 | } |
| 7231 | } |
| 7232 | else |
| 7233 | { |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7234 | smsLog( pMac, LOGE, "%s: NO commands are active\n", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7235 | } |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7236 | |
| 7237 | /* Notify HDD about handoff and provide the BSSID too */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7238 | roamInfo.reasonCode = eCsrRoamReasonBetterAP; |
| 7239 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7240 | palCopyMemory(pMac->hHdd, roamInfo.bssid, |
| 7241 | pMac->roam.neighborRoamInfo.csrNeighborRoamProfile.BSSIDs.bssid, |
| 7242 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7243 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7244 | csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, |
| 7245 | eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7246 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7247 | /* Copy the connected profile to apply the same for this connection as well */ |
| 7248 | if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 7249 | (void **)&pCurRoamProfile, sizeof(tCsrRoamProfile)))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7250 | { |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7251 | palZeroMemory(pMac->hHdd, pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 7252 | csrRoamCopyProfile(pMac, pCurRoamProfile, pSession->pCurRoamProfile); |
| 7253 | //make sure to put it at the head of the cmd queue |
| 7254 | status = csrRoamIssueConnect(pMac, sessionId, pCurRoamProfile, |
| 7255 | hBSSList, eCsrSmeIssuedAssocToSimilarAP, |
| 7256 | roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE); |
| 7257 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7258 | if(!HAL_STATUS_SUCCESS(status)) |
| 7259 | { |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7260 | smsLog( pMac, LOGE,"%s: csrRoamIssueConnect failed with status %d", |
| 7261 | __func__, status); |
| 7262 | fCallCallback = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7263 | } |
| 7264 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7265 | /* Notify sub-modules like QoS etc. that handoff happening */ |
| 7266 | sme_QosCsrEventInd(pMac, sessionId, SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL); |
| 7267 | palFreeMemory(pMac->hHdd, pCurRoamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7268 | csrFreeScanFilter(pMac, pScanFilter); |
| 7269 | palFreeMemory( pMac->hHdd, pScanFilter ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7270 | return; |
| 7271 | } |
| 7272 | |
| 7273 | POST_ROAM_FAILURE: |
| 7274 | if (pScanFilter) |
| 7275 | { |
| 7276 | csrFreeScanFilter(pMac, pScanFilter); |
| 7277 | palFreeMemory( pMac->hHdd, pScanFilter ); |
| 7278 | } |
| 7279 | if (pCurRoamProfile) |
| 7280 | palFreeMemory(pMac->hHdd, pCurRoamProfile); |
| 7281 | |
| 7282 | /* Inform the upper layers that the reassoc failed */ |
| 7283 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7284 | csrRoamCallCallback(pMac, sessionId, |
| 7285 | &roamInfo, 0, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
| 7286 | |
| 7287 | /* |
| 7288 | * Issue a disassoc request so that PE/LIM uses this to clean-up the FT session. |
| 7289 | * Upon success, we would re-enter this routine after receiving the disassoc |
| 7290 | * response and will fall into the reassoc fail sub-state. And, eventually |
| 7291 | * call csrRoamComplete which would remove the roam command from SME active |
| 7292 | * queue. |
| 7293 | */ |
| 7294 | if (!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate(pMac, sessionId, |
| 7295 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE))) |
| 7296 | { |
| 7297 | smsLog( pMac, LOGE,"%s: csrRoamIssueDisassociate failed with status %d", |
| 7298 | __func__, status); |
| 7299 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7300 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7301 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7302 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7303 | } //else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) ) |
| 7304 | else if ( CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, sessionId ) ) |
| 7305 | { |
| 7306 | // Disassoc due to Reassoc failure falls into this codepath.... |
| 7307 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7308 | } |
| 7309 | else |
| 7310 | { |
| 7311 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7312 | { |
| 7313 | // Successfully disassociated from the 'old' Bss... |
| 7314 | // |
| 7315 | // We get Disassociate response in three conditions. |
| 7316 | // - First is the case where we are disasociating from an Infra Bss to start an IBSS. |
| 7317 | // - Second is the when we are disassociating from an Infra Bss to join an IBSS or a new |
| 7318 | // Infrastructure network. |
| 7319 | // - Third is where we are doing an Infra to Infra roam between networks with different |
| 7320 | // SSIDs. In all cases, we set the new Bss configuration here and attempt to join |
| 7321 | |
| 7322 | smsLog( pMac, LOG2, "CSR SmeDisassocReq disassociated Successfully\n" ); |
| 7323 | } |
| 7324 | else |
| 7325 | { |
| 7326 | smsLog( pMac, LOGE, "SmeDisassocReq failed with statusCode= 0x%08lX\n", statusCode ); |
| 7327 | } |
| 7328 | //We are not done yet. Get the data and continue roaming |
| 7329 | csrRoamReissueRoamCommand(pMac); |
| 7330 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7331 | } |
| 7332 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7333 | static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp ) |
| 7334 | { |
| 7335 | tSirResultCodes statusCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7336 | //No one is sending eWNI_SME_DEAUTH_REQ to PE. |
| 7337 | smsLog(pMac, LOGW, FL("is no-op\n")); |
| 7338 | statusCode = csrGetDeAuthRspStatusCode( pSmeRsp ); |
| 7339 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 7340 | { |
| 7341 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7342 | } |
| 7343 | else |
| 7344 | { |
| 7345 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7346 | { |
| 7347 | // Successfully deauth from the 'old' Bss... |
| 7348 | // |
| 7349 | smsLog( pMac, LOG2, "CSR SmeDeauthReq disassociated Successfully\n" ); |
| 7350 | } |
| 7351 | else |
| 7352 | { |
| 7353 | smsLog( pMac, LOGW, "SmeDeauthReq failed with statusCode= 0x%08lX\n", statusCode ); |
| 7354 | } |
| 7355 | //We are not done yet. Get the data and continue roaming |
| 7356 | csrRoamReissueRoamCommand(pMac); |
| 7357 | } |
| 7358 | } |
| 7359 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7360 | static void csrRoamRoamingStateStartBssRspProcessor( tpAniSirGlobal pMac, tSirSmeStartBssRsp *pSmeStartBssRsp ) |
| 7361 | { |
| 7362 | eCsrRoamCompleteResult result; |
| 7363 | |
| 7364 | if ( eSIR_SME_SUCCESS == pSmeStartBssRsp->statusCode ) |
| 7365 | { |
| 7366 | smsLog( pMac, LOGW, "SmeStartBssReq Successful\n" ); |
| 7367 | result = eCsrStartBssSuccess; |
| 7368 | } |
| 7369 | else |
| 7370 | { |
| 7371 | smsLog( pMac, LOGW, "SmeStartBssReq failed with statusCode= 0x%08lX\n", pSmeStartBssRsp->statusCode ); |
| 7372 | //Let csrRoamComplete decide what to do |
| 7373 | result = eCsrStartBssFailure; |
| 7374 | } |
| 7375 | #ifdef WLAN_SOFTAP_FEATURE |
| 7376 | csrRoamComplete( pMac, result, pSmeStartBssRsp); |
| 7377 | #else |
| 7378 | csrRoamComplete( pMac, result, &pSmeStartBssRsp->bssDescription ); |
| 7379 | #endif |
| 7380 | } |
| 7381 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7382 | /* |
| 7383 | We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of strucutres. |
| 7384 | It depends on how the message is constructed. If the message is sent by limSendSmeRsp, |
| 7385 | the pMsgBuf is only a generic response and can only be used as pointer to tSirSmeRsp. |
| 7386 | For the messages where sender allocates memory for specific structures, then it can be |
| 7387 | cast accordingly. |
| 7388 | */ |
| 7389 | void csrRoamingStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 7390 | { |
| 7391 | tSirSmeRsp *pSmeRsp; |
| 7392 | tSmeIbssPeerInd *pIbssPeerInd; |
| 7393 | tCsrRoamInfo roamInfo; |
| 7394 | // TODO Session Id need to be acquired in this function |
| 7395 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7396 | pSmeRsp = (tSirSmeRsp *)pMsgBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7397 | smsLog( pMac, LOG2, "Message %d[0x%04X] received in substate %d\n", |
| 7398 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 7399 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
| 7400 | #if defined ANI_PRODUCT_TYPE_AP |
| 7401 | pSmeRsp->messageType = pal_be16_to_cpu(pSmeRsp->messageType); |
| 7402 | pSmeRsp->length = pal_be16_to_cpu(pSmeRsp->length); |
| 7403 | pSmeRsp->statusCode = pal_be32_to_cpu(pSmeRsp->statusCode); |
| 7404 | #else |
| 7405 | pSmeRsp->messageType = (pSmeRsp->messageType); |
| 7406 | pSmeRsp->length = (pSmeRsp->length); |
| 7407 | pSmeRsp->statusCode = (pSmeRsp->statusCode); |
| 7408 | #endif |
| 7409 | switch (pSmeRsp->messageType) |
| 7410 | { |
| 7411 | |
| 7412 | case eWNI_SME_JOIN_RSP: // in Roaming state, process the Join response message... |
| 7413 | if (CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, pSmeRsp->sessionId)) |
| 7414 | { |
| 7415 | //We sent a JOIN_REQ |
| 7416 | csrRoamJoinRspProcessor( pMac, (tSirSmeJoinRsp *)pSmeRsp ); |
| 7417 | } |
| 7418 | break; |
| 7419 | |
| 7420 | case eWNI_SME_AUTH_RSP: // or the Authenticate response message... |
| 7421 | if (CSR_IS_ROAM_SUBSTATE_AUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 7422 | { |
| 7423 | //We sent a AUTH_REQ |
| 7424 | csrRoamRoamingStateAuthRspProcessor( pMac, (tSirSmeAuthRsp *)pSmeRsp ); |
| 7425 | } |
| 7426 | break; |
| 7427 | |
| 7428 | case eWNI_SME_REASSOC_RSP: // or the Reassociation response message... |
| 7429 | if (CSR_IS_ROAM_SUBSTATE_REASSOC_REQ( pMac, pSmeRsp->sessionId) ) |
| 7430 | { |
| 7431 | csrRoamRoamingStateReassocRspProcessor( pMac, (tpSirSmeJoinRsp )pSmeRsp ); |
| 7432 | } |
| 7433 | break; |
| 7434 | |
| 7435 | case eWNI_SME_STOP_BSS_RSP: // or the Stop Bss response message... |
| 7436 | { |
| 7437 | csrRoamRoamingStateStopBssRspProcessor(pMac, pSmeRsp); |
| 7438 | } |
| 7439 | break; |
| 7440 | |
| 7441 | case eWNI_SME_DISASSOC_RSP: // or the Disassociate response message... |
| 7442 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, pSmeRsp->sessionId ) || |
| 7443 | CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, pSmeRsp->sessionId ) || |
| 7444 | CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, pSmeRsp->sessionId ) || |
| 7445 | CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, pSmeRsp->sessionId ) || |
| 7446 | CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId ) || |
| 7447 | //HO |
| 7448 | CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, pSmeRsp->sessionId ) ) |
| 7449 | { |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 7450 | smsLog(pMac, LOG1, FL("eWNI_SME_DISASSOC_RSP subState = %d\n"), pMac->roam.curSubState[pSmeRsp->sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7451 | csrRoamRoamingStateDisassocRspProcessor( pMac, (tSirSmeDisassocRsp *)pSmeRsp ); |
| 7452 | } |
| 7453 | break; |
| 7454 | |
| 7455 | case eWNI_SME_DEAUTH_RSP: // or the Deauthentication response message... |
| 7456 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId ) ) |
| 7457 | { |
| 7458 | csrRoamRoamingStateDeauthRspProcessor( pMac, (tSirSmeDeauthRsp *)pSmeRsp ); |
| 7459 | } |
| 7460 | break; |
| 7461 | |
| 7462 | case eWNI_SME_START_BSS_RSP: // or the Start BSS response message... |
| 7463 | if (CSR_IS_ROAM_SUBSTATE_START_BSS_REQ( pMac, pSmeRsp->sessionId ) ) |
| 7464 | { |
| 7465 | csrRoamRoamingStateStartBssRspProcessor( pMac, (tSirSmeStartBssRsp *)pSmeRsp ); |
| 7466 | } |
| 7467 | break; |
| 7468 | |
| 7469 | case WNI_CFG_SET_CNF: // process the Config Confirm messages when we are in 'Config' substate... |
| 7470 | if ( CSR_IS_ROAM_SUBSTATE_CONFIG( pMac, pSmeRsp->sessionId ) ) |
| 7471 | { |
| 7472 | csrRoamingStateConfigCnfProcessor( pMac, ((tCsrCfgSetRsp *)pSmeRsp)->respStatus ); |
| 7473 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7474 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7475 | //In case CSR issues STOP_BSS, we need to tell HDD about peer departed becasue PE is removing them |
| 7476 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 7477 | pIbssPeerInd = (tSmeIbssPeerInd*)pSmeRsp; |
| 7478 | smsLog(pMac, LOGE, "CSR: Peer departed notification from LIM in joining state\n"); |
| 7479 | palZeroMemory( pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo) ); |
| 7480 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 7481 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 7482 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 7483 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 7484 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 7485 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 7486 | eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 7487 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7488 | default: |
| 7489 | smsLog( pMac, LOG1, "Unexpected message type = %d[0x%X] received in substate %d\n", |
| 7490 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 7491 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
| 7492 | |
| 7493 | //If we are connected, check the link status change |
| 7494 | if(!csrIsConnStateDisconnected(pMac, sessionId)) |
| 7495 | { |
| 7496 | csrRoamCheckForLinkStatusChange( pMac, pSmeRsp ); |
| 7497 | } |
| 7498 | break; |
| 7499 | } |
| 7500 | } |
| 7501 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7502 | void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 7503 | { |
| 7504 | tSirSmeRsp *pSirMsg = (tSirSmeRsp *)pMsgBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7505 | switch (pSirMsg->messageType) |
| 7506 | { |
| 7507 | case eWNI_SME_GET_STATISTICS_RSP: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 7508 | smsLog( pMac, LOG2, FL("Stats rsp from PE\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7509 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 7510 | break; |
| 7511 | #ifdef WLAN_SOFTAP_FEATURE |
| 7512 | case eWNI_SME_UPPER_LAYER_ASSOC_CNF: |
| 7513 | { |
| 7514 | tCsrRoamSession *pSession; |
| 7515 | tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf; |
| 7516 | tCsrRoamInfo roamInfo; |
| 7517 | tCsrRoamInfo *pRoamInfo = NULL; |
| 7518 | tANI_U32 sessionId; |
| 7519 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7520 | smsLog( pMac, LOG1, FL("ASSOCIATION confirmation can be given to upper layer \n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7521 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 7522 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7523 | pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf; |
| 7524 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId ); |
| 7525 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7526 | |
| 7527 | if(!pSession) |
| 7528 | { |
| 7529 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7530 | return; |
| 7531 | } |
| 7532 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7533 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 7534 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7535 | pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid; |
| 7536 | pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length; |
| 7537 | pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7538 | pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length; |
| 7539 | pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7540 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, sizeof(tSirMacAddr)); |
| 7541 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7542 | pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7543 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) ) |
| 7544 | { |
| 7545 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED; |
| 7546 | pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq; |
| 7547 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 7548 | } |
| 7549 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 7550 | { |
| 7551 | vos_sleep( 100 ); |
| 7552 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta |
| 7553 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
| 7554 | } |
| 7555 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7556 | } |
| 7557 | break; |
| 7558 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7559 | default: |
| 7560 | csrRoamCheckForLinkStatusChange( pMac, pSirMsg ); |
| 7561 | break; |
| 7562 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7563 | } |
| 7564 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7565 | eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, |
| 7566 | tSirBssDescription *pBssDescription, |
| 7567 | tSirMacAddr *bssId, tANI_BOOLEAN addKey, |
| 7568 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 7569 | tANI_U8 keyId, tANI_U16 keyLength, |
| 7570 | tANI_U8 *pKey, tANI_U8 paeRole ) |
| 7571 | { |
| 7572 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7573 | tAniEdType edType; |
| 7574 | |
| 7575 | if(eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType) |
| 7576 | { |
| 7577 | EncryptType = eCSR_ENCRYPT_TYPE_NONE; //*** |
| 7578 | } |
| 7579 | |
| 7580 | edType = csrTranslateEncryptTypeToEdType( EncryptType ); |
| 7581 | |
| 7582 | // Allow 0 keys to be set for the non-WPA encrypt types... For WPA encrypt types, the num keys must be non-zero |
| 7583 | // or LIM will reject the set context (assumes the SET_CONTEXT does not occur until the keys are distrubuted). |
| 7584 | if ( CSR_IS_ENC_TYPE_STATIC( EncryptType ) || |
| 7585 | addKey ) |
| 7586 | { |
| 7587 | tCsrRoamSetKey setKey; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7588 | setKey.encType = EncryptType; |
| 7589 | setKey.keyDirection = aniKeyDirection; //Tx, Rx or Tx-and-Rx |
| 7590 | palCopyMemory( pMac->hHdd, &setKey.peerMac, bssId, sizeof(tCsrBssid) ); |
| 7591 | setKey.paeRole = paeRole; //0 for supplicant |
| 7592 | setKey.keyId = keyId; // Kye index |
| 7593 | setKey.keyLength = keyLength; |
| 7594 | if( keyLength ) |
| 7595 | { |
| 7596 | palCopyMemory( pMac->hHdd, setKey.Key, pKey, keyLength ); |
| 7597 | } |
| 7598 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, &setKey, 0 ); |
| 7599 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7600 | return (status); |
| 7601 | } |
| 7602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7603 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 7604 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 7605 | { |
| 7606 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 7607 | tSmeCmd *pCommand = NULL; |
| 7608 | #ifdef FEATURE_WLAN_CCX |
| 7609 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7610 | #endif /* FEATURE_WLAN_CCX */ |
| 7611 | |
| 7612 | do |
| 7613 | { |
| 7614 | pCommand = csrGetCommandBuffer(pMac); |
| 7615 | if(NULL == pCommand) |
| 7616 | { |
| 7617 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 7618 | status = eHAL_STATUS_RESOURCES; |
| 7619 | break; |
| 7620 | } |
| 7621 | pCommand->command = eSmeCommandSetKey; |
| 7622 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7623 | // validate the key length, Adjust if too long... |
| 7624 | // for static WEP the keys are not set thru' SetContextReq |
| 7625 | if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || |
| 7626 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ) ) |
| 7627 | { |
| 7628 | //KeyLength maybe 0 for static WEP |
| 7629 | if( pSetKey->keyLength ) |
| 7630 | { |
| 7631 | if ( pSetKey->keyLength < CSR_WEP40_KEY_LEN ) |
| 7632 | { |
| 7633 | smsLog( pMac, LOGW, "Invalid WEP40 keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7634 | break; |
| 7635 | } |
| 7636 | |
| 7637 | pCommand->u.setKeyCmd.keyLength = CSR_WEP40_KEY_LEN; |
| 7638 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP40_KEY_LEN ); |
| 7639 | } |
| 7640 | } |
| 7641 | else if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || |
| 7642 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ) ) |
| 7643 | { |
| 7644 | //KeyLength maybe 0 for static WEP |
| 7645 | if( pSetKey->keyLength ) |
| 7646 | { |
| 7647 | if ( pSetKey->keyLength < CSR_WEP104_KEY_LEN ) |
| 7648 | { |
| 7649 | smsLog( pMac, LOGW, "Invalid WEP104 keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7650 | break; |
| 7651 | } |
| 7652 | |
| 7653 | pCommand->u.setKeyCmd.keyLength = CSR_WEP104_KEY_LEN; |
| 7654 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WEP104_KEY_LEN ); |
| 7655 | } |
| 7656 | } |
| 7657 | else if ( eCSR_ENCRYPT_TYPE_TKIP == pSetKey->encType ) |
| 7658 | { |
| 7659 | if ( pSetKey->keyLength < CSR_TKIP_KEY_LEN ) |
| 7660 | { |
| 7661 | smsLog( pMac, LOGW, "Invalid TKIP keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7662 | break; |
| 7663 | } |
| 7664 | pCommand->u.setKeyCmd.keyLength = CSR_TKIP_KEY_LEN; |
| 7665 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_TKIP_KEY_LEN ); |
| 7666 | } |
| 7667 | else if ( eCSR_ENCRYPT_TYPE_AES == pSetKey->encType ) |
| 7668 | { |
| 7669 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 7670 | { |
| 7671 | smsLog( pMac, LOGW, "Invalid AES/CCMP keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7672 | break; |
| 7673 | } |
| 7674 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
| 7675 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN ); |
| 7676 | } |
| 7677 | #ifdef FEATURE_WLAN_WAPI |
| 7678 | else if ( eCSR_ENCRYPT_TYPE_WPI == pSetKey->encType ) |
| 7679 | { |
| 7680 | if ( pSetKey->keyLength < CSR_WAPI_KEY_LEN ) |
| 7681 | { |
| 7682 | smsLog( pMac, LOGW, "Invalid WAPI keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7683 | break; |
| 7684 | } |
| 7685 | pCommand->u.setKeyCmd.keyLength = CSR_WAPI_KEY_LEN; |
| 7686 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_WAPI_KEY_LEN ); |
| 7687 | } |
| 7688 | #endif /* FEATURE_WLAN_WAPI */ |
| 7689 | #ifdef FEATURE_WLAN_CCX |
| 7690 | else if ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 7691 | { |
| 7692 | if ( pSetKey->keyLength < CSR_KRK_KEY_LEN ) |
| 7693 | { |
| 7694 | smsLog( pMac, LOGW, "Invalid KRK keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7695 | break; |
| 7696 | } |
| 7697 | palCopyMemory( pMac->hHdd, pSession->ccxCckmInfo.krk, pSetKey->Key, CSR_KRK_KEY_LEN ); |
| 7698 | pSession->ccxCckmInfo.reassoc_req_num=1; |
| 7699 | pSession->ccxCckmInfo.krk_plumbed = eANI_BOOLEAN_TRUE; |
| 7700 | status = eHAL_STATUS_SUCCESS; |
| 7701 | break; |
| 7702 | } |
| 7703 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7704 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7705 | #ifdef WLAN_FEATURE_11W |
| 7706 | //Check for 11w BIP |
| 7707 | else if ( eCSR_ENCRYPT_TYPE_AES_CMAC == pSetKey->encType ) |
| 7708 | { |
| 7709 | tANI_U16 count = 0; |
| 7710 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 7711 | { |
| 7712 | smsLog( pMac, LOGW, "Invalid AES/CCMP keylength [= %d] in SetContext call\n", pSetKey->keyLength ); |
| 7713 | break; |
| 7714 | } |
| 7715 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
| 7716 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN ); |
| 7717 | } |
| 7718 | #endif |
| 7719 | status = eHAL_STATUS_SUCCESS; |
| 7720 | pCommand->u.setKeyCmd.roamId = roamId; |
| 7721 | pCommand->u.setKeyCmd.encType = pSetKey->encType; |
| 7722 | pCommand->u.setKeyCmd.keyDirection = pSetKey->keyDirection; //Tx, Rx or Tx-and-Rx |
| 7723 | palCopyMemory( pMac->hHdd, &pCommand->u.setKeyCmd.peerMac, &pSetKey->peerMac, sizeof(tCsrBssid) ); |
| 7724 | pCommand->u.setKeyCmd.paeRole = pSetKey->paeRole; //0 for supplicant |
| 7725 | pCommand->u.setKeyCmd.keyId = pSetKey->keyId; |
| 7726 | palCopyMemory( pMac->hHdd, pCommand->u.setKeyCmd.keyRsc, pSetKey->keyRsc, CSR_MAX_RSC_LEN ); |
| 7727 | //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 |
| 7728 | |
| 7729 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 7730 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7731 | { |
| 7732 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 7733 | } |
| 7734 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7735 | // Free the command if there has been a failure, or it is a |
| 7736 | // "local" operation like the set CCX CCKM KRK key. |
| 7737 | if( (!HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand )) |
| 7738 | #ifdef FEATURE_WLAN_CCX |
| 7739 | || ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 7740 | #endif /* FEATURE_WLAN_CCX */ |
| 7741 | ) |
| 7742 | { |
| 7743 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 7744 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7745 | return( status ); |
| 7746 | } |
| 7747 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7748 | eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 7749 | tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId ) |
| 7750 | { |
| 7751 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 7752 | tSmeCmd *pCommand = NULL; |
| 7753 | tANI_BOOLEAN fImediate = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7754 | do |
| 7755 | { |
| 7756 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 7757 | { |
| 7758 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key\n") ); |
| 7759 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 7760 | break; |
| 7761 | } |
| 7762 | pCommand = csrGetCommandBuffer(pMac); |
| 7763 | if(NULL == pCommand) |
| 7764 | { |
| 7765 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 7766 | status = eHAL_STATUS_RESOURCES; |
| 7767 | break; |
| 7768 | } |
| 7769 | pCommand->command = eSmeCommandRemoveKey; |
| 7770 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7771 | pCommand->u.removeKeyCmd.roamId = roamId; |
| 7772 | pCommand->u.removeKeyCmd.encType = pRemoveKey->encType; |
| 7773 | palCopyMemory( pMac->hHdd, &pCommand->u.removeKeyCmd.peerMac, &pRemoveKey->peerMac, sizeof(tSirMacAddr) ); |
| 7774 | pCommand->u.removeKeyCmd.keyId = pRemoveKey->keyId; |
| 7775 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7776 | { |
| 7777 | //in this case, put it to the end of the Q incase there is a set key pending. |
| 7778 | fImediate = eANI_BOOLEAN_FALSE; |
| 7779 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7780 | smsLog( pMac, LOGE, FL("keyType=%d, keyId=%d, PeerMac=%02x, %02x, %02x, %02x, %02x, %02x\n"), |
| 7781 | pRemoveKey->encType, pRemoveKey->keyId, |
| 7782 | pCommand->u.removeKeyCmd.peerMac[0], |
| 7783 | pCommand->u.removeKeyCmd.peerMac[1], |
| 7784 | pCommand->u.removeKeyCmd.peerMac[2], |
| 7785 | pCommand->u.removeKeyCmd.peerMac[3], |
| 7786 | pCommand->u.removeKeyCmd.peerMac[4], |
| 7787 | pCommand->u.removeKeyCmd.peerMac[5]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7788 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 7789 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7790 | { |
| 7791 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 7792 | break; |
| 7793 | } |
| 7794 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7795 | if( !HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand ) ) |
| 7796 | { |
| 7797 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 7798 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7799 | return (status ); |
| 7800 | } |
| 7801 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7802 | eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 7803 | { |
| 7804 | eHalStatus status; |
| 7805 | tANI_U8 numKeys = ( pCommand->u.setKeyCmd.keyLength ) ? 1 : 0; |
| 7806 | tAniEdType edType = csrTranslateEncryptTypeToEdType( pCommand->u.setKeyCmd.encType ); |
| 7807 | tANI_BOOLEAN fUnicast = ( pCommand->u.setKeyCmd.peerMac[0] == 0xFF ) ? eANI_BOOLEAN_FALSE : eANI_BOOLEAN_TRUE; |
| 7808 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7809 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7810 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7811 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7812 | if(eCSR_ENCRYPT_TYPE_NONE != edType) |
| 7813 | { |
| 7814 | palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 7815 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 7816 | { |
| 7817 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ; |
| 7818 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 7819 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 7820 | } |
| 7821 | else |
| 7822 | { |
| 7823 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_REQ; |
| 7824 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 7825 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 7826 | } |
| 7827 | palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 7828 | if(CSR_IS_ENC_TYPE_STATIC(edType)) |
| 7829 | { |
| 7830 | tANI_U32 defKeyId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7831 | //It has to be static WEP here |
| 7832 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, &defKeyId))) |
| 7833 | { |
| 7834 | setKeyEvent.keyId = (v_U8_t)defKeyId; |
| 7835 | } |
| 7836 | } |
| 7837 | else |
| 7838 | { |
| 7839 | setKeyEvent.keyId = pCommand->u.setKeyCmd.keyId; |
| 7840 | } |
| 7841 | setKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 7842 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 7843 | } |
| 7844 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7845 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 7846 | { |
| 7847 | status = csrSendMBSetContextReqMsg( pMac, sessionId, |
| 7848 | ( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac, |
| 7849 | numKeys, edType, fUnicast, pCommand->u.setKeyCmd.keyDirection, |
| 7850 | pCommand->u.setKeyCmd.keyId, pCommand->u.setKeyCmd.keyLength, |
| 7851 | pCommand->u.setKeyCmd.Key, pCommand->u.setKeyCmd.paeRole, |
| 7852 | pCommand->u.setKeyCmd.keyRsc); |
| 7853 | } |
| 7854 | else |
| 7855 | { |
| 7856 | smsLog( pMac, LOGW, FL(" cannot process not connected\n") ); |
| 7857 | //Set this status so the error handling take care of the case. |
| 7858 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 7859 | } |
| 7860 | if( !HAL_STATUS_SUCCESS(status) ) |
| 7861 | { |
| 7862 | smsLog( pMac, LOGE, FL(" error status %d\n"), status ); |
| 7863 | 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] | 7864 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7865 | if(eCSR_ENCRYPT_TYPE_NONE != edType) |
| 7866 | { |
| 7867 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 7868 | { |
| 7869 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 7870 | } |
| 7871 | else |
| 7872 | { |
| 7873 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 7874 | } |
| 7875 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 7876 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 7877 | } |
| 7878 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7879 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7880 | return ( status ); |
| 7881 | } |
| 7882 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7883 | eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 7884 | { |
| 7885 | eHalStatus status; |
| 7886 | tpSirSmeRemoveKeyReq pMsg = NULL; |
| 7887 | tANI_U16 wMsgLen = sizeof(tSirSmeRemoveKeyReq); |
| 7888 | tANI_U8 *p; |
| 7889 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7890 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7891 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7892 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7893 | palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 7894 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_REQ; |
| 7895 | removeKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 7896 | removeKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 7897 | palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 7898 | removeKeyEvent.keyId = pCommand->u.removeKeyCmd.keyId; |
| 7899 | removeKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 7900 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 7901 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7902 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 7903 | { |
| 7904 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, wMsgLen ); |
| 7905 | } |
| 7906 | else |
| 7907 | { |
| 7908 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key\n") ); |
| 7909 | //Set the error status so error handling kicks in below |
| 7910 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 7911 | } |
| 7912 | if( HAL_STATUS_SUCCESS( status ) ) |
| 7913 | { |
| 7914 | palZeroMemory(pMac->hHdd, pMsg, wMsgLen); |
| 7915 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REMOVEKEY_REQ); |
| 7916 | pMsg->length = pal_cpu_to_be16(wMsgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7917 | pMsg->sessionId = (tANI_U8)sessionId; |
| 7918 | pMsg->transactionId = 0; |
| 7919 | p = (tANI_U8 *)pMsg + sizeof(pMsg->messageType) + sizeof(pMsg->length) + |
| 7920 | sizeof(pMsg->sessionId) + sizeof(pMsg->transactionId); |
| 7921 | // bssId - copy from session Info |
| 7922 | palCopyMemory( pMac->hHdd, p, &pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 7923 | p += sizeof(tSirMacAddr); |
| 7924 | // peerMacAddr |
| 7925 | palCopyMemory( pMac->hHdd, p, pCommand->u.removeKeyCmd.peerMac, sizeof(tSirMacAddr) ); |
| 7926 | p += sizeof(tSirMacAddr); |
| 7927 | // edType |
| 7928 | *p = (tANI_U8)csrTranslateEncryptTypeToEdType( pCommand->u.removeKeyCmd.encType ); |
| 7929 | p++; |
| 7930 | // weptype |
| 7931 | if( ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pCommand->u.removeKeyCmd.encType ) || |
| 7932 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pCommand->u.removeKeyCmd.encType ) ) |
| 7933 | { |
| 7934 | *p = (tANI_U8)eSIR_WEP_STATIC; |
| 7935 | } |
| 7936 | else |
| 7937 | { |
| 7938 | *p = (tANI_U8)eSIR_WEP_DYNAMIC; |
| 7939 | } |
| 7940 | p++; |
| 7941 | //keyid |
| 7942 | *p = pCommand->u.removeKeyCmd.keyId; |
| 7943 | p++; |
| 7944 | *p = (pCommand->u.removeKeyCmd.peerMac[0] == 0xFF ) ? 0 : 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7945 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 7946 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7947 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7948 | { |
| 7949 | smsLog( pMac, LOGE, FL(" error status \n"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7950 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7951 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 7952 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7953 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 7954 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7955 | csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.removeKeyCmd.roamId, eCSR_ROAM_REMOVE_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE); |
| 7956 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7957 | return ( status ); |
| 7958 | } |
| 7959 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7960 | eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 7961 | { |
| 7962 | eHalStatus status; |
| 7963 | |
| 7964 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 7965 | { |
| 7966 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 7967 | } |
| 7968 | else |
| 7969 | { |
| 7970 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, pSetKey, roamId ); |
| 7971 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7972 | return ( status ); |
| 7973 | } |
| 7974 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7975 | /* |
| 7976 | Prepare a filter base on a profile for parsing the scan results. |
| 7977 | Upon successful return, caller MUST call csrFreeScanFilter on |
| 7978 | pScanFilter when it is done with the filter. |
| 7979 | */ |
| 7980 | eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 7981 | tCsrScanResultFilter *pScanFilter) |
| 7982 | { |
| 7983 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7984 | tANI_U32 size = 0; |
| 7985 | tANI_U8 index = 0; |
| 7986 | |
| 7987 | do |
| 7988 | { |
| 7989 | if(pProfile->BSSIDs.numOfBSSIDs) |
| 7990 | { |
| 7991 | size = sizeof(tCsrBssid) * pProfile->BSSIDs.numOfBSSIDs; |
| 7992 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, size); |
| 7993 | if(!HAL_STATUS_SUCCESS(status)) |
| 7994 | { |
| 7995 | break; |
| 7996 | } |
| 7997 | pScanFilter->BSSIDs.numOfBSSIDs = pProfile->BSSIDs.numOfBSSIDs; |
| 7998 | palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, pProfile->BSSIDs.bssid, size); |
| 7999 | } |
| 8000 | if(pProfile->SSIDs.numOfSSIDs) |
| 8001 | { |
| 8002 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 8003 | { |
| 8004 | pScanFilter->SSIDs.numOfSSIDs = pProfile->SSIDs.numOfSSIDs; |
| 8005 | } |
| 8006 | else |
| 8007 | { |
| 8008 | //For WDS station |
| 8009 | //We always use index 1 for self SSID. Index 0 for peer's SSID that we want to join |
| 8010 | pScanFilter->SSIDs.numOfSSIDs = 1; |
| 8011 | } |
| 8012 | size = sizeof(tCsrSSIDInfo) * pProfile->SSIDs.numOfSSIDs; |
| 8013 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, size); |
| 8014 | if(!HAL_STATUS_SUCCESS(status)) |
| 8015 | { |
| 8016 | break; |
| 8017 | } |
| 8018 | palCopyMemory(pMac->hHdd, pScanFilter->SSIDs.SSIDList, pProfile->SSIDs.SSIDList, size); |
| 8019 | } |
| 8020 | if(!pProfile->ChannelInfo.ChannelList || (pProfile->ChannelInfo.ChannelList[0] == 0) ) |
| 8021 | { |
| 8022 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8023 | pScanFilter->ChannelInfo.ChannelList = NULL; |
| 8024 | } |
| 8025 | else if(pProfile->ChannelInfo.numOfChannels) |
| 8026 | { |
| 8027 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->ChannelInfo.ChannelList, sizeof(*pScanFilter->ChannelInfo.ChannelList) * pProfile->ChannelInfo.numOfChannels); |
| 8028 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8029 | if(HAL_STATUS_SUCCESS(status)) |
| 8030 | { |
| 8031 | for(index = 0; index < pProfile->ChannelInfo.numOfChannels; index++) |
| 8032 | { |
| 8033 | if(csrRoamIsChannelValid(pMac, pProfile->ChannelInfo.ChannelList[index])) |
| 8034 | { |
| 8035 | pScanFilter->ChannelInfo.ChannelList[pScanFilter->ChannelInfo.numOfChannels] |
| 8036 | = pProfile->ChannelInfo.ChannelList[index]; |
| 8037 | pScanFilter->ChannelInfo.numOfChannels++; |
| 8038 | } |
| 8039 | else |
| 8040 | { |
| 8041 | smsLog(pMac, LOG1, FL("process a channel (%d) that is invalid\n"), pProfile->ChannelInfo.ChannelList[index]); |
| 8042 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8043 | } |
| 8044 | } |
| 8045 | else |
| 8046 | { |
| 8047 | break; |
| 8048 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8049 | } |
| 8050 | else |
| 8051 | { |
| 8052 | smsLog(pMac, LOGW, FL("Channel list empty\n")); |
| 8053 | status = eHAL_STATUS_FAILURE; |
| 8054 | break; |
| 8055 | } |
| 8056 | pScanFilter->uapsd_mask = pProfile->uapsd_mask; |
| 8057 | pScanFilter->authType = pProfile->AuthType; |
| 8058 | pScanFilter->EncryptionType = pProfile->EncryptionType; |
| 8059 | pScanFilter->mcEncryptionType = pProfile->mcEncryptionType; |
| 8060 | pScanFilter->BSSType = pProfile->BSSType; |
| 8061 | pScanFilter->phyMode = pProfile->phyMode; |
| 8062 | #ifdef FEATURE_WLAN_WAPI |
| 8063 | //check if user asked for WAPI with 11n or auto mode, in that case modify |
| 8064 | //the phymode to 11g |
| 8065 | if(csrIsProfileWapi(pProfile)) |
| 8066 | { |
| 8067 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_11n) |
| 8068 | { |
| 8069 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 8070 | } |
| 8071 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_AUTO) |
| 8072 | { |
| 8073 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_AUTO; |
| 8074 | } |
| 8075 | if(!pScanFilter->phyMode) |
| 8076 | { |
| 8077 | pScanFilter->phyMode = eCSR_DOT11_MODE_11g; |
| 8078 | } |
| 8079 | } |
| 8080 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8081 | /*Save the WPS info*/ |
| 8082 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8083 | if( pProfile->countryCode[0] ) |
| 8084 | { |
| 8085 | //This causes the matching function to use countryCode as one of the criteria. |
| 8086 | palCopyMemory( pMac->hHdd, pScanFilter->countryCode, pProfile->countryCode, |
| 8087 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 8088 | } |
| 8089 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8090 | if (pProfile->MDID.mdiePresent) |
| 8091 | { |
| 8092 | pScanFilter->MDID.mdiePresent = 1; |
| 8093 | pScanFilter->MDID.mobilityDomain = pProfile->MDID.mobilityDomain; |
| 8094 | } |
| 8095 | #endif |
| 8096 | |
| 8097 | }while(0); |
| 8098 | |
| 8099 | if(!HAL_STATUS_SUCCESS(status)) |
| 8100 | { |
| 8101 | csrFreeScanFilter(pMac, pScanFilter); |
| 8102 | } |
| 8103 | |
| 8104 | return(status); |
| 8105 | } |
| 8106 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8107 | tANI_BOOLEAN csrRoamIssueWmStatusChange( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8108 | eCsrRoamWmStatusChangeTypes Type, tSirSmeRsp *pSmeRsp ) |
| 8109 | { |
| 8110 | tANI_BOOLEAN fCommandQueued = eANI_BOOLEAN_FALSE; |
| 8111 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8112 | do |
| 8113 | { |
| 8114 | // Validate the type is ok... |
| 8115 | if ( ( eCsrDisassociated != Type ) && ( eCsrDeauthenticated != Type ) ) break; |
| 8116 | pCommand = csrGetCommandBuffer( pMac ); |
| 8117 | if ( !pCommand ) |
| 8118 | { |
| 8119 | smsLog( pMac, LOGE, FL(" fail to get command buffer\n") ); |
| 8120 | break; |
| 8121 | } |
| 8122 | //Change the substate in case it is waiting for key |
| 8123 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8124 | { |
| 8125 | csrRoamStopWaitForKeyTimer( pMac ); |
| 8126 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 8127 | } |
| 8128 | pCommand->command = eSmeCommandWmStatusChange; |
| 8129 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8130 | pCommand->u.wmStatusChangeCmd.Type = Type; |
| 8131 | if ( eCsrDisassociated == Type ) |
| 8132 | { |
| 8133 | palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg, pSmeRsp, |
| 8134 | sizeof( pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg ) ); |
| 8135 | } |
| 8136 | else |
| 8137 | { |
| 8138 | palCopyMemory( pMac->hHdd, &pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg, pSmeRsp, |
| 8139 | sizeof( pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg ) ); |
| 8140 | } |
| 8141 | if( HAL_STATUS_SUCCESS( csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE) ) ) |
| 8142 | { |
| 8143 | fCommandQueued = eANI_BOOLEAN_TRUE; |
| 8144 | } |
| 8145 | else |
| 8146 | { |
| 8147 | smsLog( pMac, LOGE, FL(" fail to send message \n") ); |
| 8148 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 8149 | } |
| 8150 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8151 | /* AP has issued Dissac/Deauth, Set the operating mode value to configured value */ |
| 8152 | csrSetDefaultDot11Mode( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8153 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8154 | return( fCommandQueued ); |
| 8155 | } |
| 8156 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8157 | static void csrUpdateRssi(tpAniSirGlobal pMac, void* pMsg) |
| 8158 | { |
| 8159 | v_S7_t rssi = 0; |
| 8160 | tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq*)pMsg; |
| 8161 | if(pGetRssiReq) |
| 8162 | { |
| 8163 | if(NULL != pGetRssiReq->pVosContext) |
| 8164 | { |
| 8165 | WLANTL_GetRssi(pGetRssiReq->pVosContext, pGetRssiReq->staId, &rssi); |
| 8166 | } |
| 8167 | else |
| 8168 | { |
| 8169 | smsLog( pMac, LOGE, FL("pGetRssiReq->pVosContext is NULL\n")); |
| 8170 | return; |
| 8171 | } |
| 8172 | |
| 8173 | if(NULL != pGetRssiReq->rssiCallback) |
| 8174 | { |
| 8175 | ((tCsrRssiCallback)(pGetRssiReq->rssiCallback))(rssi, pGetRssiReq->staId, pGetRssiReq->pDevContext); |
| 8176 | } |
| 8177 | else |
| 8178 | { |
| 8179 | smsLog( pMac, LOGE, FL("pGetRssiReq->rssiCallback is NULL\n")); |
| 8180 | return; |
| 8181 | } |
| 8182 | } |
| 8183 | else |
| 8184 | { |
| 8185 | smsLog( pMac, LOGE, FL("pGetRssiReq is NULL\n")); |
| 8186 | } |
| 8187 | return; |
| 8188 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8189 | static void csrRoamRssiIndHdlr(tpAniSirGlobal pMac, void* pMsg) |
| 8190 | { |
| 8191 | WLANTL_TlIndicationReq *pTlRssiInd = (WLANTL_TlIndicationReq*)pMsg; |
| 8192 | if(pTlRssiInd) |
| 8193 | { |
| 8194 | if(NULL != pTlRssiInd->tlCallback) |
| 8195 | { |
| 8196 | ((WLANTL_RSSICrossThresholdCBType)(pTlRssiInd->tlCallback)) |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 8197 | (pTlRssiInd->pAdapter, pTlRssiInd->rssiNotification, pTlRssiInd->pUserCtxt, pTlRssiInd->avgRssi); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8198 | } |
| 8199 | else |
| 8200 | { |
| 8201 | smsLog( pMac, LOGE, FL("pTlRssiInd->tlCallback is NULL\n")); |
| 8202 | } |
| 8203 | } |
| 8204 | else |
| 8205 | { |
| 8206 | smsLog( pMac, LOGE, FL("pTlRssiInd is NULL\n")); |
| 8207 | } |
| 8208 | return; |
| 8209 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8210 | |
| 8211 | void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) |
| 8212 | { |
| 8213 | tSirSmeAssocInd *pAssocInd; |
| 8214 | tSirSmeDisassocInd *pDisassocInd; |
| 8215 | tSirSmeDeauthInd *pDeauthInd; |
| 8216 | tSirSmeWmStatusChangeNtf *pStatusChangeMsg; |
| 8217 | tSirSmeNewBssInfo *pNewBss; |
| 8218 | tSmeIbssPeerInd *pIbssPeerInd; |
| 8219 | tSirMacAddr Broadcastaddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 8220 | tSirSmeApNewCaps *pApNewCaps; |
| 8221 | eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; |
| 8222 | eRoamCmdStatus roamStatus = eCSR_ROAM_FAILED; |
| 8223 | tCsrRoamInfo *pRoamInfo = NULL; |
| 8224 | tCsrRoamInfo roamInfo; |
| 8225 | eHalStatus status; |
| 8226 | tANI_U32 sessionId = CSR_SESSION_ID_INVALID; |
| 8227 | tCsrRoamSession *pSession = NULL; |
| 8228 | tpSirSmeSwitchChannelInd pSwitchChnInd; |
| 8229 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 8230 | #ifdef WLAN_SOFTAP_FEATURE |
| 8231 | tSmeCmd pCommand; |
| 8232 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8233 | #if defined ANI_PRODUCT_TYPE_AP |
| 8234 | pSirMsg->messageType = pal_be16_to_cpu(pSirMsg->messageType); |
| 8235 | pSirMsg->length = pal_be16_to_cpu(pSirMsg->length); |
| 8236 | pSirMsg->statusCode = pal_be32_to_cpu(pSirMsg->statusCode); |
| 8237 | #else |
| 8238 | pSirMsg->messageType = (pSirMsg->messageType); |
| 8239 | pSirMsg->length = (pSirMsg->length); |
| 8240 | pSirMsg->statusCode = (pSirMsg->statusCode); |
| 8241 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8242 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8243 | switch( pSirMsg->messageType ) |
| 8244 | { |
| 8245 | case eWNI_SME_ASSOC_IND: |
| 8246 | { |
| 8247 | tCsrRoamSession *pSession; |
| 8248 | smsLog( pMac, LOG1, FL("ASSOCIATION Indication from SME\n")); |
| 8249 | pAssocInd = (tSirSmeAssocInd *)pSirMsg; |
| 8250 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pAssocInd->bssId, &sessionId ); |
| 8251 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8252 | { |
| 8253 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 8254 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8255 | if(!pSession) |
| 8256 | { |
| 8257 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8258 | return; |
| 8259 | } |
| 8260 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8261 | pRoamInfo = &roamInfo; |
| 8262 | |
| 8263 | // Required for indicating the frames to upper layer |
| 8264 | pRoamInfo->assocReqLength = pAssocInd->assocReqLength; |
| 8265 | pRoamInfo->assocReqPtr = pAssocInd->assocReqPtr; |
| 8266 | |
| 8267 | pRoamInfo->beaconPtr = pAssocInd->beaconPtr; |
| 8268 | pRoamInfo->beaconLength = pAssocInd->beaconLength; |
| 8269 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 8270 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8271 | |
| 8272 | pRoamInfo->staId = (tANI_U8)pAssocInd->staId; |
| 8273 | pRoamInfo->rsnIELen = (tANI_U8)pAssocInd->rsnIE.length; |
| 8274 | pRoamInfo->prsnIE = pAssocInd->rsnIE.rsnIEdata; |
| 8275 | |
| 8276 | pRoamInfo->addIELen = (tANI_U8)pAssocInd->addIE.length; |
| 8277 | pRoamInfo->paddIE = pAssocInd->addIE.addIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8278 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8279 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pAssocInd->bssId, sizeof(tCsrBssid)); |
| 8280 | #ifdef WLAN_SOFTAP_FEATURE |
| 8281 | pRoamInfo->wmmEnabledSta = pAssocInd->wmmEnabledSta; |
| 8282 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 8283 | #endif |
| 8284 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
| 8285 | #ifdef WLAN_SOFTAP_FEATURE |
| 8286 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile)) |
| 8287 | { |
| 8288 | if( CSR_IS_ENC_TYPE_STATIC( pSession->pCurRoamProfile->negotiatedUCEncryptionType )) |
| 8289 | { |
| 8290 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->pCurRoamProfile->negotiatedUCEncryptionType, |
| 8291 | pSession->pConnectBssDesc, |
| 8292 | &(pRoamInfo->peerMac), |
| 8293 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 8294 | pRoamInfo->fAuthRequired = FALSE; |
| 8295 | } |
| 8296 | else |
| 8297 | { |
| 8298 | pRoamInfo->fAuthRequired = TRUE; |
| 8299 | } |
| 8300 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND); |
| 8301 | if (!HAL_STATUS_SUCCESS(status)) |
| 8302 | pRoamInfo->statusCode = eSIR_SME_ASSOC_REFUSED;// Refused due to Mac filtering |
| 8303 | } |
| 8304 | #endif |
| 8305 | /* Send Association completion message to PE */ |
| 8306 | status = csrSendAssocCnfMsg( pMac, pAssocInd, status );//Sta |
| 8307 | |
| 8308 | /* send a message to CSR itself just to avoid the EAPOL frames going |
| 8309 | * OTA before association response */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8310 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 8311 | { |
| 8312 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 8313 | } |
| 8314 | #ifdef WLAN_SOFTAP_FEATURE |
| 8315 | else if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) && (pRoamInfo->statusCode != eSIR_SME_ASSOC_REFUSED)) |
| 8316 | { |
| 8317 | pRoamInfo->fReassocReq = pAssocInd->reassocReq; |
| 8318 | //status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 8319 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 8320 | } |
| 8321 | #endif |
| 8322 | } |
| 8323 | } |
| 8324 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8325 | case eWNI_SME_DISASSOC_IND: |
| 8326 | smsLog( pMac, LOGE, FL("DISASSOCIATION Indication from MAC\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8327 | // Check if AP dis-associated us because of MIC failure. If so, |
| 8328 | // then we need to take action immediately and not wait till the |
| 8329 | // the WmStatusChange requests is pushed and processed |
| 8330 | pDisassocInd = (tSirSmeDisassocInd *)pSirMsg; |
| 8331 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDisassocInd->bssId, &sessionId ); |
| 8332 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8333 | { |
| 8334 | // If we are in neighbor preauth done state then on receiving |
| 8335 | // disassoc or deauth we dont roam instead we just disassoc |
| 8336 | // from current ap and then go to disconnected state |
| 8337 | // This happens for CCX and 11r FT connections ONLY. |
| 8338 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8339 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8340 | { |
| 8341 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8342 | } |
| 8343 | #endif |
| 8344 | #ifdef FEATURE_WLAN_CCX |
| 8345 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8346 | { |
| 8347 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8348 | } |
| 8349 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8350 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 8351 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8352 | { |
| 8353 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8354 | } |
| 8355 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8356 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8357 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8358 | if(!pSession) |
| 8359 | { |
| 8360 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8361 | return; |
| 8362 | } |
| 8363 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8364 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 8365 | { |
| 8366 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8367 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8368 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 8369 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 8370 | #endif |
| 8371 | csrRoamLinkDown(pMac, sessionId); |
| 8372 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDisassociated, pSirMsg ); |
| 8373 | #ifdef WLAN_SOFTAP_FEATURE |
| 8374 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 8375 | { |
| 8376 | |
| 8377 | pRoamInfo = &roamInfo; |
| 8378 | |
| 8379 | pRoamInfo->statusCode = pDisassocInd->statusCode; |
| 8380 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8381 | |
| 8382 | pRoamInfo->staId = (tANI_U8)pDisassocInd->staId; |
| 8383 | |
| 8384 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8385 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDisassocInd->bssId, sizeof(tCsrBssid)); |
| 8386 | |
| 8387 | 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] | 8388 | |
| 8389 | /* |
| 8390 | * STA/P2P client got disassociated so remove any pending deauth |
| 8391 | * commands in sme pending list |
| 8392 | */ |
| 8393 | pCommand.command = eSmeCommandRoam; |
| 8394 | pCommand.sessionId = (tANI_U8)sessionId; |
| 8395 | pCommand.u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 8396 | vos_mem_copy(pCommand.u.roamCmd.peerMac, pDisassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8397 | csrRoamRemoveDuplicateCommand(pMac, sessionId, &pCommand, eCsrForcedDeauthSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8398 | } |
| 8399 | #endif |
| 8400 | } |
| 8401 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8402 | case eWNI_SME_DEAUTH_IND: |
| 8403 | smsLog( pMac, LOG1, FL("DEAUTHENTICATION Indication from MAC\n")); |
| 8404 | pDeauthInd = (tpSirSmeDeauthInd)pSirMsg; |
| 8405 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDeauthInd->bssId, &sessionId ); |
| 8406 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8407 | { |
| 8408 | // If we are in neighbor preauth done state then on receiving |
| 8409 | // disassoc or deauth we dont roam instead we just disassoc |
| 8410 | // from current ap and then go to disconnected state |
| 8411 | // This happens for CCX and 11r FT connections ONLY. |
| 8412 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8413 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8414 | { |
| 8415 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8416 | } |
| 8417 | #endif |
| 8418 | #ifdef FEATURE_WLAN_CCX |
| 8419 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 8420 | { |
| 8421 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8422 | } |
| 8423 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8424 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 8425 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8426 | { |
| 8427 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 8428 | } |
| 8429 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8430 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8431 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8432 | if(!pSession) |
| 8433 | { |
| 8434 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8435 | return; |
| 8436 | } |
| 8437 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8438 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 8439 | { |
| 8440 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8441 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8442 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 8443 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 8444 | #endif |
| 8445 | csrRoamLinkDown(pMac, sessionId); |
| 8446 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDeauthenticated, pSirMsg ); |
| 8447 | #ifdef WLAN_SOFTAP_FEATURE |
| 8448 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 8449 | { |
| 8450 | |
| 8451 | pRoamInfo = &roamInfo; |
| 8452 | |
| 8453 | pRoamInfo->statusCode = pDeauthInd->statusCode; |
| 8454 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8455 | |
| 8456 | pRoamInfo->staId = (tANI_U8)pDeauthInd->staId; |
| 8457 | |
| 8458 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 8459 | palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pDeauthInd->bssId, sizeof(tCsrBssid)); |
| 8460 | |
| 8461 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DEAUTH_IND); |
| 8462 | } |
| 8463 | #endif |
| 8464 | } |
| 8465 | break; |
| 8466 | |
| 8467 | case eWNI_SME_SWITCH_CHL_REQ: // in case of STA, the SWITCH_CHANNEL originates from its AP |
| 8468 | smsLog( pMac, LOGW, FL("eWNI_SME_SWITCH_CHL_REQ from SME\n")); |
| 8469 | pSwitchChnInd = (tpSirSmeSwitchChannelInd)pSirMsg; |
| 8470 | //Update with the new channel id. |
| 8471 | //The channel id is hidden in the statusCode. |
| 8472 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pSwitchChnInd->bssId, &sessionId ); |
| 8473 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8474 | { |
| 8475 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8476 | if(!pSession) |
| 8477 | { |
| 8478 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8479 | return; |
| 8480 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8481 | pSession->connectedProfile.operationChannel = (tANI_U8)pSwitchChnInd->newChannelId; |
| 8482 | if(pSession->pConnectBssDesc) |
| 8483 | { |
| 8484 | pSession->pConnectBssDesc->channelId = (tANI_U8)pSwitchChnInd->newChannelId; |
| 8485 | } |
| 8486 | } |
| 8487 | break; |
| 8488 | |
| 8489 | case eWNI_SME_DEAUTH_RSP: |
| 8490 | smsLog( pMac, LOGW, FL("eWNI_SME_DEAUTH_RSP from SME\n")); |
| 8491 | #ifdef WLAN_SOFTAP_FEATURE |
| 8492 | { |
| 8493 | tSirSmeDeauthRsp* pDeauthRsp = (tSirSmeDeauthRsp *)pSirMsg; |
| 8494 | sessionId = pDeauthRsp->sessionId; |
| 8495 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 8496 | { |
| 8497 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8498 | if(!pSession) |
| 8499 | { |
| 8500 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8501 | return; |
| 8502 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8503 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 8504 | { |
| 8505 | pRoamInfo = &roamInfo; |
| 8506 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8507 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDeauthRsp->peerMacAddr, sizeof(tSirMacAddr)); |
| 8508 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 8509 | pRoamInfo->statusCode = pDeauthRsp->statusCode; |
| 8510 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 8511 | } |
| 8512 | } |
| 8513 | } |
| 8514 | #endif |
| 8515 | break; |
| 8516 | |
| 8517 | case eWNI_SME_DISASSOC_RSP: |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 8518 | /* session id is invalid here so cant use it to access the array curSubstate as index */ |
| 8519 | smsLog( pMac, LOGW, FL("eWNI_SME_DISASSOC_RSP from SME \n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8520 | #ifdef WLAN_SOFTAP_FEATURE |
| 8521 | { |
| 8522 | tSirSmeDisassocRsp *pDisassocRsp = (tSirSmeDisassocRsp *)pSirMsg; |
| 8523 | sessionId = pDisassocRsp->sessionId; |
| 8524 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 8525 | { |
| 8526 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8527 | if(!pSession) |
| 8528 | { |
| 8529 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8530 | return; |
| 8531 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8532 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 8533 | { |
| 8534 | pRoamInfo = &roamInfo; |
| 8535 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8536 | palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pDisassocRsp->peerMacAddr, sizeof(tSirMacAddr)); |
| 8537 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 8538 | pRoamInfo->statusCode = pDisassocRsp->statusCode; |
| 8539 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 8540 | } |
| 8541 | } |
| 8542 | } |
| 8543 | #endif |
| 8544 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8545 | case eWNI_SME_MIC_FAILURE_IND: |
| 8546 | { |
| 8547 | tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg; |
| 8548 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 8549 | eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8550 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8551 | { |
| 8552 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8553 | if(!pSession) |
| 8554 | { |
| 8555 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8556 | return; |
| 8557 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8558 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
| 8559 | palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8560 | secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR; |
| 8561 | secEvent.encryptionModeMulticast = |
| 8562 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8563 | secEvent.encryptionModeUnicast = |
| 8564 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8565 | secEvent.authMode = |
| 8566 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8567 | palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 8568 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 8569 | } |
| 8570 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8571 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pMicInd->bssId, &sessionId ); |
| 8572 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8573 | { |
| 8574 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 8575 | roamInfo.u.pMICFailureInfo = &pMicInd->info; |
| 8576 | pRoamInfo = &roamInfo; |
| 8577 | if(pMicInd->info.multicast) |
| 8578 | { |
| 8579 | result = eCSR_ROAM_RESULT_MIC_ERROR_GROUP; |
| 8580 | } |
| 8581 | else |
| 8582 | { |
| 8583 | result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
| 8584 | } |
| 8585 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_MIC_ERROR_IND, result); |
| 8586 | } |
| 8587 | } |
| 8588 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8589 | #ifdef WLAN_SOFTAP_FEATURE |
| 8590 | case eWNI_SME_WPS_PBC_PROBE_REQ_IND: |
| 8591 | { |
| 8592 | tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd)pSirMsg; |
| 8593 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8594 | smsLog( pMac, LOG1, FL("WPS PBC Probe request Indication from SME\n")); |
| 8595 | |
| 8596 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pProbeReqInd->bssId, &sessionId ); |
| 8597 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8598 | { |
| 8599 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 8600 | roamInfo.u.pWPSPBCProbeReq = &pProbeReqInd->WPSPBCProbeReq; |
| 8601 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_WPS_PBC_PROBE_REQ_IND, |
| 8602 | eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND); |
| 8603 | } |
| 8604 | } |
| 8605 | break; |
| 8606 | #endif |
| 8607 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8608 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 8609 | pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *)pSirMsg; |
| 8610 | switch( pStatusChangeMsg->statusChangeCode ) |
| 8611 | { |
| 8612 | case eSIR_SME_IBSS_ACTIVE: |
| 8613 | sessionId = csrFindIbssSession( pMac ); |
| 8614 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8615 | { |
| 8616 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8617 | if(!pSession) |
| 8618 | { |
| 8619 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8620 | return; |
| 8621 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8622 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED; |
| 8623 | if(pSession->pConnectBssDesc) |
| 8624 | { |
| 8625 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 8626 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 8627 | pRoamInfo = &roamInfo; |
| 8628 | } |
| 8629 | else |
| 8630 | { |
| 8631 | smsLog(pMac, LOGE, " CSR eSIR_SME_IBSS_NEW_PEER connected BSS is empty\n"); |
| 8632 | } |
| 8633 | result = eCSR_ROAM_RESULT_IBSS_CONNECT; |
| 8634 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 8635 | } |
| 8636 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8637 | case eSIR_SME_IBSS_INACTIVE: |
| 8638 | sessionId = csrFindIbssSession( pMac ); |
| 8639 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8640 | { |
| 8641 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8642 | if(!pSession) |
| 8643 | { |
| 8644 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8645 | return; |
| 8646 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8647 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 8648 | result = eCSR_ROAM_RESULT_IBSS_INACTIVE; |
| 8649 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 8650 | } |
| 8651 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8652 | case eSIR_SME_JOINED_NEW_BSS: // IBSS coalescing. |
| 8653 | sessionId = csrFindIbssSession( pMac ); |
| 8654 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8655 | { |
| 8656 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8657 | if(!pSession) |
| 8658 | { |
| 8659 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8660 | return; |
| 8661 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8662 | // update the connection state information |
| 8663 | pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8664 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8665 | { |
| 8666 | vos_log_ibss_pkt_type *pIbssLog; |
| 8667 | tANI_U32 bi; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8668 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 8669 | if(pIbssLog) |
| 8670 | { |
| 8671 | pIbssLog->eventId = WLAN_IBSS_EVENT_COALESCING; |
| 8672 | if(pNewBss) |
| 8673 | { |
| 8674 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pNewBss->bssId, 6); |
| 8675 | if(pNewBss->ssId.length) |
| 8676 | { |
| 8677 | palCopyMemory(pMac->hHdd, pIbssLog->ssid, pNewBss->ssId.ssId, pNewBss->ssId.length); |
| 8678 | } |
| 8679 | pIbssLog->operatingChannel = pNewBss->channelNumber; |
| 8680 | } |
| 8681 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 8682 | { |
| 8683 | //***U8 is not enough for beacon interval |
| 8684 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 8685 | } |
| 8686 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 8687 | } |
| 8688 | } |
| 8689 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8690 | csrRoamUpdateConnectedProfileFromNewBss( pMac, sessionId, pNewBss ); |
| 8691 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->connectedProfile.EncryptionType, |
| 8692 | pSession->pConnectBssDesc, |
| 8693 | &Broadcastaddr, |
| 8694 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); |
| 8695 | result = eCSR_ROAM_RESULT_IBSS_COALESCED; |
| 8696 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 8697 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, &pNewBss->bssId, sizeof(tCsrBssid)); |
| 8698 | pRoamInfo = &roamInfo; |
| 8699 | //This BSSID is th ereal BSSID, let's save it |
| 8700 | if(pSession->pConnectBssDesc) |
| 8701 | { |
| 8702 | palCopyMemory(pMac->hHdd, pSession->pConnectBssDesc->bssId, &pNewBss->bssId, sizeof(tCsrBssid)); |
| 8703 | } |
| 8704 | // Stop the join IBSS timer in case of join, for |
| 8705 | // genuine merge do nothing |
| 8706 | if(pSession->ibss_join_pending) |
| 8707 | { |
| 8708 | pSession->ibss_join_pending = FALSE; |
| 8709 | csrRoamStopIbssJoinTimer(pMac, sessionId); |
| 8710 | result = eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS; |
| 8711 | } |
| 8712 | } |
| 8713 | smsLog(pMac, LOGW, "CSR: eSIR_SME_JOINED_NEW_BSS received from PE\n"); |
| 8714 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8715 | // detection by LIM that the capabilities of the associated AP have changed. |
| 8716 | case eSIR_SME_AP_CAPS_CHANGED: |
| 8717 | pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps; |
| 8718 | smsLog(pMac, LOGW, "CSR handling eSIR_SME_AP_CAPS_CHANGED\n"); |
| 8719 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pApNewCaps->bssId, &sessionId ); |
| 8720 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8721 | { |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 8722 | if ((eCSR_ROAMING_STATE_JOINED == pMac->roam.curState[sessionId]) && |
| 8723 | ((eCSR_ROAM_SUBSTATE_JOINED_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
| 8724 | (eCSR_ROAM_SUBSTATE_JOINED_NON_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
| 8725 | (eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC == pMac->roam.curSubState[sessionId])) |
| 8726 | ) |
| 8727 | { |
| 8728 | csrScanForCapabilityChange( pMac, pApNewCaps ); |
| 8729 | result = eCSR_ROAM_RESULT_CAP_CHANGED; |
| 8730 | roamStatus = eCSR_ROAM_GEN_INFO; |
| 8731 | } |
| 8732 | else |
| 8733 | { |
| 8734 | smsLog(pMac, LOGW, |
| 8735 | "Skipping csrScanForCapabilityChange as " |
| 8736 | "CSR is in state %d and sub-state %d\n", |
| 8737 | pMac->roam.curState[sessionId], |
| 8738 | pMac->roam.curSubState[sessionId]); |
| 8739 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8740 | } |
| 8741 | break; |
| 8742 | |
| 8743 | default: |
| 8744 | roamStatus = eCSR_ROAM_FAILED; |
| 8745 | result = eCSR_ROAM_RESULT_NONE; |
| 8746 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8747 | } // end switch on statusChangeCode |
| 8748 | if(eCSR_ROAM_RESULT_NONE != result) |
| 8749 | { |
| 8750 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, roamStatus, result); |
| 8751 | } |
| 8752 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8753 | case eWNI_SME_IBSS_NEW_PEER_IND: |
| 8754 | pIbssPeerInd = (tSmeIbssPeerInd *)pSirMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8755 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8756 | { |
| 8757 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8758 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 8759 | if(pIbssLog) |
| 8760 | { |
| 8761 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_JOIN; |
| 8762 | palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
| 8763 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 8764 | } |
| 8765 | } |
| 8766 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8767 | sessionId = csrFindIbssSession( pMac ); |
| 8768 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8769 | { |
| 8770 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8771 | |
| 8772 | if(!pSession) |
| 8773 | { |
| 8774 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8775 | return; |
| 8776 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8777 | // Issue the set Context request to LIM to establish the Unicast STA context for the new peer... |
| 8778 | if(pSession->pConnectBssDesc) |
| 8779 | { |
| 8780 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 8781 | palCopyMemory(pMac->hHdd, &roamInfo.bssid, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
| 8782 | if(pIbssPeerInd->mesgLen > sizeof(tSmeIbssPeerInd)) |
| 8783 | { |
| 8784 | status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pbFrames, |
| 8785 | (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd))); |
| 8786 | if(HAL_STATUS_SUCCESS(status)) |
| 8787 | { |
| 8788 | roamInfo.nBeaconLength = (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd)); |
| 8789 | palCopyMemory(pMac->hHdd, roamInfo.pbFrames, ((tANI_U8 *)pIbssPeerInd) + sizeof(tSmeIbssPeerInd), |
| 8790 | roamInfo.nBeaconLength); |
| 8791 | } |
| 8792 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 8793 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 8794 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 8795 | status = palAllocateMemory(pMac->hHdd, (void **)&roamInfo.pBssDesc, |
| 8796 | pSession->pConnectBssDesc->length); |
| 8797 | if(HAL_STATUS_SUCCESS(status)) |
| 8798 | { |
| 8799 | palCopyMemory(pMac->hHdd, roamInfo.pBssDesc, pSession->pConnectBssDesc, |
| 8800 | pSession->pConnectBssDesc->length); |
| 8801 | } |
| 8802 | if(HAL_STATUS_SUCCESS(status)) |
| 8803 | { |
| 8804 | pRoamInfo = &roamInfo; |
| 8805 | } |
| 8806 | else |
| 8807 | { |
| 8808 | if(roamInfo.pbFrames) |
| 8809 | { |
| 8810 | palFreeMemory(pMac->hHdd, roamInfo.pbFrames); |
| 8811 | } |
| 8812 | if(roamInfo.pBssDesc) |
| 8813 | { |
| 8814 | palFreeMemory(pMac->hHdd, roamInfo.pBssDesc); |
| 8815 | } |
| 8816 | } |
| 8817 | } |
| 8818 | else |
| 8819 | { |
| 8820 | pRoamInfo = &roamInfo; |
| 8821 | } |
| 8822 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->connectedProfile.EncryptionType, |
| 8823 | pSession->pConnectBssDesc, |
| 8824 | &(pIbssPeerInd->peerAddr), |
| 8825 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 8826 | } |
| 8827 | else |
| 8828 | { |
| 8829 | smsLog(pMac, LOGW, " CSR eSIR_SME_IBSS_NEW_PEER connected BSS is empty\n"); |
| 8830 | } |
| 8831 | //send up the sec type for the new peer |
| 8832 | if (pRoamInfo) |
| 8833 | { |
| 8834 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 8835 | } |
| 8836 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, |
| 8837 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_NEW_PEER); |
| 8838 | if(pRoamInfo) |
| 8839 | { |
| 8840 | if(roamInfo.pbFrames) |
| 8841 | { |
| 8842 | palFreeMemory(pMac->hHdd, roamInfo.pbFrames); |
| 8843 | } |
| 8844 | if(roamInfo.pBssDesc) |
| 8845 | { |
| 8846 | palFreeMemory(pMac->hHdd, roamInfo.pBssDesc); |
| 8847 | } |
| 8848 | } |
| 8849 | } |
| 8850 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8851 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 8852 | pIbssPeerInd = (tSmeIbssPeerInd*)pSirMsg; |
| 8853 | sessionId = csrFindIbssSession( pMac ); |
| 8854 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 8855 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8856 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8857 | { |
| 8858 | vos_log_ibss_pkt_type *pIbssLog; |
| 8859 | |
| 8860 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 8861 | if(pIbssLog) |
| 8862 | { |
| 8863 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_LEAVE; |
| 8864 | if(pIbssPeerInd) |
| 8865 | { |
| 8866 | palCopyMemory(pMac->hHdd, pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
| 8867 | } |
| 8868 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 8869 | } |
| 8870 | } |
| 8871 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8872 | smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM\n"); |
| 8873 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 8874 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 8875 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
| 8876 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pIbssPeerInd->peerAddr, sizeof(tCsrBssid)); |
| 8877 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 8878 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 8879 | } |
| 8880 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8881 | case eWNI_SME_SETCONTEXT_RSP: |
| 8882 | { |
| 8883 | tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *)pSirMsg; |
| 8884 | tListElem *pEntry; |
| 8885 | tSmeCmd *pCommand; |
| 8886 | |
| 8887 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 8888 | if ( pEntry ) |
| 8889 | { |
| 8890 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 8891 | if ( eSmeCommandSetKey == pCommand->command ) |
| 8892 | { |
| 8893 | sessionId = pCommand->sessionId; |
| 8894 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8895 | |
| 8896 | if(!pSession) |
| 8897 | { |
| 8898 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8899 | return; |
| 8900 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8901 | |
| 8902 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8903 | if(eCSR_ENCRYPT_TYPE_NONE != pSession->connectedProfile.EncryptionType) |
| 8904 | { |
| 8905 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
| 8906 | palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 8907 | if( pRsp->peerMacAddr[0] & 0x01 ) |
| 8908 | { |
| 8909 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 8910 | } |
| 8911 | else |
| 8912 | { |
| 8913 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 8914 | } |
| 8915 | setKeyEvent.encryptionModeMulticast = |
| 8916 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8917 | setKeyEvent.encryptionModeUnicast = |
| 8918 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8919 | palCopyMemory( pMac->hHdd, setKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 8920 | setKeyEvent.authMode = |
| 8921 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8922 | if( eSIR_SUCCESS != pRsp->statusCode ) |
| 8923 | { |
| 8924 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 8925 | } |
| 8926 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8927 | } |
| 8928 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8929 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 8930 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 8931 | csrRoamStopWaitForKeyTimer( pMac ); |
| 8932 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8933 | //We are done with authentication, whethere succeed or not |
| 8934 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8935 | //We do it here because this linkup function is not called after association |
| 8936 | //when a key needs to be set. |
| 8937 | if( csrIsConnStateConnectedInfra(pMac, sessionId) ) |
| 8938 | { |
| 8939 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 8940 | } |
| 8941 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 8942 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8943 | { |
| 8944 | palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8945 | //Make sure we install the GTK before indicating to HDD as authenticated |
| 8946 | //This is to prevent broadcast packets go out after PTK and before GTK. |
| 8947 | if( palEqualMemory( pMac->hHdd, &Broadcastaddr, pRsp->peerMacAddr, |
| 8948 | sizeof(tSirMacAddr) ) ) |
| 8949 | { |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 8950 | #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE |
| 8951 | if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE) |
| 8952 | { |
| 8953 | tpSirSetActiveModeSetBncFilterReq pMsg; |
| 8954 | palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tSirSetActiveModeSetBncFilterReq)); |
| 8955 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_BCN_FILTER_REQ); |
| 8956 | pMsg->length = pal_cpu_to_be16(sizeof( tANI_U8)); |
| 8957 | pMsg->seesionId = sessionId; |
| 8958 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 8959 | } |
| 8960 | #endif |
| 8961 | result = eCSR_ROAM_RESULT_AUTHENTICATED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8962 | } |
| 8963 | else |
| 8964 | { |
| 8965 | result = eCSR_ROAM_RESULT_NONE; |
| 8966 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8967 | pRoamInfo = &roamInfo; |
| 8968 | } |
| 8969 | else |
| 8970 | { |
| 8971 | result = eCSR_ROAM_RESULT_FAILURE; |
| 8972 | smsLog( pMac, LOGE, "CSR: Roam Completion setkey command failed(%d) PeerMac %02X-%02X-%02X-%02X-%02X-%02X...\n", |
| 8973 | pRsp->statusCode, pRsp->peerMacAddr[0], pRsp->peerMacAddr[1], pRsp->peerMacAddr[2], |
| 8974 | pRsp->peerMacAddr[3], pRsp->peerMacAddr[4], pRsp->peerMacAddr[5] ); |
| 8975 | } |
| 8976 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 8977 | eCSR_ROAM_SET_KEY_COMPLETE, result); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8978 | // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS |
| 8979 | // can go ahead and initiate the TSPEC if any are pending |
| 8980 | 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] | 8981 | #ifdef FEATURE_WLAN_CCX |
| 8982 | //Send Adjacent AP repot to new AP. |
| 8983 | if (result == eCSR_ROAM_RESULT_AUTHENTICATED && |
| 8984 | pSession->isPrevApInfoValid && |
| 8985 | pSession->connectedProfile.isCCXAssoc) |
| 8986 | { |
| 8987 | #ifdef WLAN_FEATURE_VOWIFI |
| 8988 | csrCcxSendAdjacentApRepMsg(pMac, pSession); |
| 8989 | #endif |
| 8990 | pSession->isPrevApInfoValid = FALSE; |
| 8991 | } |
| 8992 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8993 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 8994 | { |
| 8995 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 8996 | } |
| 8997 | } |
| 8998 | else |
| 8999 | { |
| 9000 | smsLog( pMac, LOGE, "CSR: Roam Completion called but setkey command is not ACTIVE ...\n" ); |
| 9001 | } |
| 9002 | } |
| 9003 | else |
| 9004 | { |
| 9005 | smsLog( pMac, LOGE, "CSR: SetKey Completion called but NO commands are ACTIVE ...\n" ); |
| 9006 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9007 | smeProcessPendingQueue( pMac ); |
| 9008 | } |
| 9009 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9010 | case eWNI_SME_REMOVEKEY_RSP: |
| 9011 | { |
| 9012 | tSirSmeRemoveKeyRsp *pRsp = (tSirSmeRemoveKeyRsp *)pSirMsg; |
| 9013 | tListElem *pEntry; |
| 9014 | tSmeCmd *pCommand; |
| 9015 | |
| 9016 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9017 | if ( pEntry ) |
| 9018 | { |
| 9019 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9020 | if ( eSmeCommandRemoveKey == pCommand->command ) |
| 9021 | { |
| 9022 | sessionId = pCommand->sessionId; |
| 9023 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9024 | |
| 9025 | if(!pSession) |
| 9026 | { |
| 9027 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9028 | return; |
| 9029 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9030 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9031 | { |
| 9032 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
| 9033 | palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 9034 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
| 9035 | removeKeyEvent.encryptionModeMulticast = |
| 9036 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9037 | removeKeyEvent.encryptionModeUnicast = |
| 9038 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9039 | palCopyMemory( pMac->hHdd, removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 9040 | removeKeyEvent.authMode = |
| 9041 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 9042 | if( eSIR_SUCCESS != pRsp->statusCode ) |
| 9043 | { |
| 9044 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 9045 | } |
| 9046 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 9047 | } |
| 9048 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9049 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9050 | { |
| 9051 | palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) ); |
| 9052 | result = eCSR_ROAM_RESULT_NONE; |
| 9053 | pRoamInfo = &roamInfo; |
| 9054 | } |
| 9055 | else |
| 9056 | { |
| 9057 | result = eCSR_ROAM_RESULT_FAILURE; |
| 9058 | } |
| 9059 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 9060 | eCSR_ROAM_REMOVE_KEY_COMPLETE, result); |
| 9061 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9062 | { |
| 9063 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 9064 | } |
| 9065 | } |
| 9066 | else |
| 9067 | { |
| 9068 | smsLog( pMac, LOGW, "CSR: Roam Completion called but setkey command is not ACTIVE ...\n" ); |
| 9069 | } |
| 9070 | } |
| 9071 | else |
| 9072 | { |
| 9073 | smsLog( pMac, LOGW, "CSR: SetKey Completion called but NO commands are ACTIVE ...\n" ); |
| 9074 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9075 | smeProcessPendingQueue( pMac ); |
| 9076 | } |
| 9077 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9078 | case eWNI_SME_GET_STATISTICS_RSP: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 9079 | smsLog( pMac, LOG2, FL("Stats rsp from PE\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9080 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 9081 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9082 | case eWNI_SME_GET_RSSI_REQ: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 9083 | smsLog( pMac, LOG2, FL("GetRssiReq from self\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9084 | csrUpdateRssi( pMac, pSirMsg ); |
| 9085 | break; |
| 9086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9087 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9088 | case eWNI_SME_FT_PRE_AUTH_RSP: |
| 9089 | csrRoamFTPreAuthRspProcessor( pMac, (tpSirFTPreAuthRsp)pSirMsg ); |
| 9090 | break; |
| 9091 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9092 | case eWNI_SME_MAX_ASSOC_EXCEEDED: |
| 9093 | pSmeMaxAssocInd = (tSmeMaxAssocInd*)pSirMsg; |
| 9094 | smsLog( pMac, LOG1, FL("send indication that max assoc have been reached and the new peer cannot be accepted\n")); |
| 9095 | sessionId = pSmeMaxAssocInd->sessionId; |
| 9096 | roamInfo.sessionId = sessionId; |
| 9097 | palCopyMemory(pMac->hHdd, &roamInfo.peerMac, pSmeMaxAssocInd->peerMac, sizeof(tCsrBssid)); |
| 9098 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 9099 | eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED); |
| 9100 | break; |
| 9101 | |
| 9102 | case eWNI_SME_BTAMP_LOG_LINK_IND: |
| 9103 | smsLog( pMac, LOG1, FL("Establish logical link req from HCI serialized through MC thread\n")); |
| 9104 | btampEstablishLogLinkHdlr( pSirMsg ); |
| 9105 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9106 | case eWNI_SME_RSSI_IND: |
| 9107 | smsLog( pMac, LOG1, FL("RSSI indication from TL serialized through MC thread\n")); |
| 9108 | csrRoamRssiIndHdlr( pMac, pSirMsg ); |
| 9109 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9110 | |
| 9111 | default: |
| 9112 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9113 | } // end switch on message type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9114 | } |
| 9115 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9116 | void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, |
| 9117 | tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult) |
| 9118 | { |
| 9119 | if(pSession) |
| 9120 | { |
| 9121 | if(pSession->bRefAssocStartCnt) |
| 9122 | { |
| 9123 | pSession->bRefAssocStartCnt--; |
| 9124 | VOS_ASSERT( pSession->bRefAssocStartCnt == 0); |
| 9125 | //Need to call association_completion because there is an assoc_start pending. |
| 9126 | csrRoamCallCallback(pMac, pSession->sessionId, NULL, roamId, |
| 9127 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 9128 | eCSR_ROAM_RESULT_FAILURE); |
| 9129 | } |
| 9130 | csrRoamCallCallback(pMac, pSession->sessionId, pRoamInfo, roamId, eCSR_ROAM_ROAMING_COMPLETION, roamResult); |
| 9131 | } |
| 9132 | else |
| 9133 | { |
| 9134 | smsLog(pMac, LOGW, FL(" pSession is NULL")); |
| 9135 | } |
| 9136 | } |
| 9137 | |
| 9138 | |
| 9139 | eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason) |
| 9140 | { |
| 9141 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9142 | if(CSR_IS_LOSTLINK_ROAMING(roamingReason) && |
| 9143 | (eANI_BOOLEAN_FALSE == pMac->roam.roamSession[sessionId].fCancelRoaming)) |
| 9144 | { |
| 9145 | status = csrScanRequestLostLink1( pMac, sessionId ); |
| 9146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9147 | return(status); |
| 9148 | } |
| 9149 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9150 | //return a boolean to indicate whether roaming completed or continue. |
| 9151 | tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 9152 | tANI_BOOLEAN fForce, eCsrRoamResult roamResult) |
| 9153 | { |
| 9154 | tANI_BOOLEAN fCompleted = eANI_BOOLEAN_TRUE; |
| 9155 | tANI_TIMESTAMP roamTime = (tANI_TIMESTAMP)(pMac->roam.configParam.nRoamingTime * PAL_TICKS_PER_SECOND); |
| 9156 | tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 9157 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9158 | if(!pSession) |
| 9159 | { |
| 9160 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9161 | return eANI_BOOLEAN_FALSE; |
| 9162 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9163 | //Check whether time is up |
| 9164 | if(pSession->fCancelRoaming || fForce || |
| 9165 | ((curTime - pSession->roamingStartTime) > roamTime) || |
| 9166 | eCsrReassocRoaming == pSession->roamingReason || |
| 9167 | eCsrDynamicRoaming == pSession->roamingReason) |
| 9168 | { |
| 9169 | smsLog(pMac, LOGW, FL(" indicates roaming completion\n")); |
| 9170 | if(pSession->fCancelRoaming && CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason)) |
| 9171 | { |
| 9172 | //roaming is cancelled, tell HDD to indicate disconnect |
| 9173 | //Because LIM overload deauth_ind for both deauth frame and missed beacon |
| 9174 | //we need to use this logic to detinguish it. For missed beacon, LIM set reason |
| 9175 | //to be eSIR_BEACON_MISSED |
| 9176 | if(eSIR_BEACON_MISSED == pSession->roamingStatusCode) |
| 9177 | { |
| 9178 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 9179 | } |
| 9180 | else if(eCsrLostlinkRoamingDisassoc == pSession->roamingReason) |
| 9181 | { |
| 9182 | roamResult = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 9183 | } |
| 9184 | else if(eCsrLostlinkRoamingDeauth == pSession->roamingReason) |
| 9185 | { |
| 9186 | roamResult = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 9187 | } |
| 9188 | else |
| 9189 | { |
| 9190 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 9191 | } |
| 9192 | } |
| 9193 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 9194 | pSession->roamingReason = eCsrNotRoaming; |
| 9195 | } |
| 9196 | else |
| 9197 | { |
| 9198 | pSession->roamResult = roamResult; |
| 9199 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoamingTimer(pMac, sessionId, PAL_TIMER_TO_SEC_UNIT))) |
| 9200 | { |
| 9201 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 9202 | pSession->roamingReason = eCsrNotRoaming; |
| 9203 | } |
| 9204 | else |
| 9205 | { |
| 9206 | fCompleted = eANI_BOOLEAN_FALSE; |
| 9207 | } |
| 9208 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9209 | return(fCompleted); |
| 9210 | } |
| 9211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9212 | void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9213 | { |
| 9214 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9215 | |
| 9216 | if(!pSession) |
| 9217 | { |
| 9218 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9219 | return; |
| 9220 | } |
| 9221 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9222 | if(CSR_IS_ROAMING(pSession)) |
| 9223 | { |
| 9224 | smsLog(pMac, LOGW, " Cancelling roaming\n"); |
| 9225 | pSession->fCancelRoaming = eANI_BOOLEAN_TRUE; |
| 9226 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 9227 | { |
| 9228 | //No need to do anything in here because the handler takes care of it |
| 9229 | } |
| 9230 | else |
| 9231 | { |
| 9232 | eCsrRoamResult roamResult = CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason) ? |
| 9233 | eCSR_ROAM_RESULT_LOSTLINK : eCSR_ROAM_RESULT_NONE; |
| 9234 | //Roaming is stopped after here |
| 9235 | csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_TRUE, roamResult); |
| 9236 | //Since CSR may be in lostlink roaming situation, abort all roaming related activities |
| 9237 | csrScanAbortMacScan(pMac); |
| 9238 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 9239 | } |
| 9240 | } |
| 9241 | } |
| 9242 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9243 | void csrRoamRoamingTimerHandler(void *pv) |
| 9244 | { |
| 9245 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9246 | tpAniSirGlobal pMac = pInfo->pMac; |
| 9247 | tANI_U32 sessionId = pInfo->sessionId; |
| 9248 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9249 | |
| 9250 | if(!pSession) |
| 9251 | { |
| 9252 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9253 | return; |
| 9254 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9255 | |
| 9256 | if(eANI_BOOLEAN_FALSE == pSession->fCancelRoaming) |
| 9257 | { |
| 9258 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoaming(pMac, sessionId, pSession->roamingReason))) |
| 9259 | { |
| 9260 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, pSession->roamResult); |
| 9261 | pSession->roamingReason = eCsrNotRoaming; |
| 9262 | } |
| 9263 | } |
| 9264 | } |
| 9265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9266 | eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 9267 | { |
| 9268 | eHalStatus status; |
| 9269 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9270 | |
| 9271 | if(!pSession) |
| 9272 | { |
| 9273 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9274 | return eHAL_STATUS_FAILURE; |
| 9275 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9276 | |
| 9277 | smsLog(pMac, LOG1, " csrScanStartRoamingTimer \n "); |
| 9278 | pSession->roamingTimerInfo.sessionId = (tANI_U8)sessionId; |
| 9279 | status = palTimerStart(pMac->hHdd, pSession->hTimerRoaming, interval, eANI_BOOLEAN_FALSE); |
| 9280 | |
| 9281 | return (status); |
| 9282 | } |
| 9283 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9284 | eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9285 | { |
| 9286 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerRoaming)); |
| 9287 | } |
| 9288 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9289 | void csrRoamWaitForKeyTimeOutHandler(void *pv) |
| 9290 | { |
| 9291 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9292 | tpAniSirGlobal pMac = pInfo->pMac; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9293 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pInfo->sessionId ); |
| 9294 | |
| 9295 | smsLog(pMac, LOGW, "WaitForKey timer expired in state=%d sub-state=%d\n", |
| 9296 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9297 | pMac->roam.curSubState[pInfo->sessionId]); |
| 9298 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9299 | if( CSR_IS_WAIT_FOR_KEY( pMac, pInfo->sessionId ) ) |
| 9300 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9301 | #ifdef FEATURE_WLAN_LFR |
| 9302 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9303 | { |
| 9304 | /* |
| 9305 | * Enable heartbeat timer when hand-off is in progress |
| 9306 | * and Key Wait timer expired. |
| 9307 | */ |
| 9308 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey expiry" |
| 9309 | " (nHBCount=%d)\n", |
| 9310 | pMac->roam.configParam.HeartbeatThresh24); |
| 9311 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 9312 | pMac->roam.configParam.HeartbeatThresh24, |
| 9313 | NULL, eANI_BOOLEAN_FALSE); |
| 9314 | } |
| 9315 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9316 | smsLog(pMac, LOGW, " SME pre-auth state timeout. \n "); |
| 9317 | //Change the substate so command queue is unblocked. |
| 9318 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, pInfo->sessionId); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9319 | if (pSession) |
| 9320 | { |
| 9321 | if( csrIsConnStateConnectedInfra(pMac, pInfo->sessionId) ) |
| 9322 | { |
| 9323 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 9324 | smeProcessPendingQueue(pMac); |
| 9325 | } |
| 9326 | else |
| 9327 | { |
| 9328 | smsLog(pMac, LOGW, "%s: could not post link up\n", |
| 9329 | __func__); |
| 9330 | } |
| 9331 | } |
| 9332 | else |
| 9333 | { |
| 9334 | smsLog(pMac, LOGW, "%s: session not found\n", __func__); |
| 9335 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9336 | } |
| 9337 | |
| 9338 | } |
| 9339 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9340 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval) |
| 9341 | { |
| 9342 | eHalStatus status; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9343 | #ifdef FEATURE_WLAN_LFR |
| 9344 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9345 | { |
| 9346 | /* Disable heartbeat timer when hand-off is in progress */ |
| 9347 | smsLog(pMac, LOG2, "%s: disabling HB timer in state=%d sub-state=%d\n", |
| 9348 | __func__, |
| 9349 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9350 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId]); |
| 9351 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE); |
| 9352 | } |
| 9353 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9354 | smsLog(pMac, LOG1, " csrScanStartWaitForKeyTimer \n "); |
| 9355 | status = palTimerStart(pMac->hHdd, pMac->roam.hTimerWaitForKey, interval, eANI_BOOLEAN_FALSE); |
| 9356 | |
| 9357 | return (status); |
| 9358 | } |
| 9359 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9360 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac) |
| 9361 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9362 | smsLog(pMac, LOG2, "WaitForKey timer stopped in state=%d sub-state=%d\n", |
| 9363 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 9364 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId]); |
| 9365 | #ifdef FEATURE_WLAN_LFR |
| 9366 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 9367 | { |
| 9368 | /* |
| 9369 | * Enable heartbeat timer when hand-off is in progress |
| 9370 | * and Key Wait timer got stopped for some reason |
| 9371 | */ |
| 9372 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey stop" |
| 9373 | " (nHBCount=%d)\n", |
| 9374 | pMac->roam.configParam.HeartbeatThresh24); |
| 9375 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 9376 | pMac->roam.configParam.HeartbeatThresh24, |
| 9377 | NULL, eANI_BOOLEAN_FALSE); |
| 9378 | } |
| 9379 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9380 | return (palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey)); |
| 9381 | } |
| 9382 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9383 | void csrRoamIbssJoinTimerHandler(void *pv) |
| 9384 | { |
| 9385 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 9386 | tpAniSirGlobal pMac = pInfo->pMac; |
| 9387 | eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE; |
| 9388 | tANI_U32 sessionId = pInfo->sessionId; |
| 9389 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9390 | |
| 9391 | if(!pSession) |
| 9392 | { |
| 9393 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9394 | return; |
| 9395 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9396 | |
| 9397 | pSession->ibss_join_pending = FALSE; |
| 9398 | // JEZ100225: As of main/latest "tip", we are no longer doing this. Check on this. |
| 9399 | //csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 9400 | // Send an IBSS stop request to PE |
| 9401 | csrRoamDisconnectInternal(pMac, sessionId, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9402 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9403 | eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 9404 | { |
| 9405 | eHalStatus status; |
| 9406 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9407 | |
| 9408 | if(!pSession) |
| 9409 | { |
| 9410 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9411 | return eHAL_STATUS_FAILURE; |
| 9412 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9413 | |
| 9414 | smsLog(pMac, LOG1, " csrRoamStartIbssJoinTimer \n "); |
| 9415 | pSession->ibssJoinTimerInfo.sessionId = (tANI_U8)sessionId; |
| 9416 | status = palTimerStart(pMac->hHdd, pSession->hTimerIbssJoining, interval, eANI_BOOLEAN_FALSE); |
| 9417 | |
| 9418 | return (status); |
| 9419 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9420 | eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 9421 | { |
| 9422 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerIbssJoining)); |
| 9423 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9424 | void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, |
| 9425 | eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess) |
| 9426 | { |
| 9427 | eRoamCmdStatus roamStatus = csrGetRoamCompleteStatus(pMac, sessionId); |
| 9428 | tANI_U32 roamId = 0; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9429 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 9430 | /* To silence the KW tool Null chaeck is added */ |
| 9431 | if(!pSession) |
| 9432 | { |
| 9433 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9434 | return; |
| 9435 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9436 | |
| 9437 | if(pCommand) |
| 9438 | { |
| 9439 | roamId = pCommand->u.roamCmd.roamId; |
| 9440 | #if defined(VOSS_ENABLED) |
| 9441 | VOS_ASSERT( sessionId == pCommand->sessionId ); |
| 9442 | #endif |
| 9443 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9444 | if(eCSR_ROAM_ROAMING_COMPLETION == roamStatus) |
| 9445 | { |
| 9446 | //if success, force roaming completion |
| 9447 | csrRoamCompleteRoaming(pMac, sessionId, fSuccess, roamResult); |
| 9448 | } |
| 9449 | else |
| 9450 | { |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9451 | VOS_ASSERT(pSession->bRefAssocStartCnt == 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9452 | smsLog(pMac, LOGW, FL(" indicates association completion. roamResult = %d\n"), roamResult); |
| 9453 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, roamId, roamStatus, roamResult); |
| 9454 | } |
| 9455 | } |
| 9456 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9457 | eHalStatus csrRoamLostLink( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 type, tSirSmeRsp *pSirMsg) |
| 9458 | { |
| 9459 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9460 | tSirSmeDeauthInd *pDeauthIndMsg = NULL; |
| 9461 | tSirSmeDisassocInd *pDisassocIndMsg = NULL; |
| 9462 | eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK; |
| 9463 | tCsrRoamInfo *pRoamInfo = NULL; |
| 9464 | tCsrRoamInfo roamInfo; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9465 | tANI_BOOLEAN fToRoam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9466 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9467 | /* To silence the KW tool Null chaeck is added */ |
| 9468 | if(!pSession) |
| 9469 | { |
| 9470 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9471 | return eHAL_STATUS_FAILURE; |
| 9472 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9473 | //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] | 9474 | fToRoam = CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9475 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
| 9476 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 9477 | { |
| 9478 | result = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 9479 | pDisassocIndMsg = (tSirSmeDisassocInd *)pSirMsg; |
| 9480 | pSession->roamingStatusCode = pDisassocIndMsg->statusCode; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 9481 | pSession->joinFailStatusCode.reasonCode = pDisassocIndMsg->reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9482 | } |
| 9483 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 9484 | { |
| 9485 | result = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 9486 | pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg; |
| 9487 | pSession->roamingStatusCode = pDeauthIndMsg->statusCode; |
Madan Mohan Koyyalamudi | 6a80893 | 2012-11-06 16:05:54 -0800 | [diff] [blame] | 9488 | /* Convert into proper reason code */ |
| 9489 | pSession->joinFailStatusCode.reasonCode = |
| 9490 | (pDeauthIndMsg->reasonCode == eSIR_BEACON_MISSED) ? |
| 9491 | eSIR_MAC_DISASSOC_LEAVING_BSS_REASON : pDeauthIndMsg->reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9492 | } |
| 9493 | else |
| 9494 | { |
| 9495 | smsLog(pMac, LOGW, FL("gets an unknown type (%d)\n"), type); |
| 9496 | result = eCSR_ROAM_RESULT_NONE; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 9497 | pSession->joinFailStatusCode.reasonCode = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9498 | } |
| 9499 | |
| 9500 | // call profile lost link routine here |
| 9501 | #ifdef WLAN_SOFTAP_FEATURE |
| 9502 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 9503 | #endif |
| 9504 | { |
| 9505 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_LOSTLINK_DETECTED, result); |
| 9506 | } |
| 9507 | |
| 9508 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 9509 | { |
| 9510 | status = csrSendMBDisassocCnfMsg(pMac, pDisassocIndMsg); |
| 9511 | } |
| 9512 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 9513 | { |
| 9514 | status = csrSendMBDeauthCnfMsg(pMac, pDeauthIndMsg); |
| 9515 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9516 | if(!HAL_STATUS_SUCCESS(status)) |
| 9517 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9518 | //If fail to send confirmation to PE, not to trigger roaming |
| 9519 | fToRoam = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9520 | } |
| 9521 | |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9522 | //prepare to tell HDD to disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9523 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 9524 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 9525 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9526 | if( eWNI_SME_DISASSOC_IND == type) |
| 9527 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9528 | //staMacAddr |
| 9529 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 9530 | roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId; |
| 9531 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9532 | else if( eWNI_SME_DEAUTH_IND == type ) |
| 9533 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9534 | //staMacAddr |
| 9535 | palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr)); |
| 9536 | roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId; |
| 9537 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9538 | smsLog(pMac, LOGW, FL("roamInfo.staId (%d)\n"), roamInfo.staId); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9539 | |
| 9540 | /* See if we can possibly roam. If so, start the roaming process and notify HDD |
| 9541 | that we are roaming. But if we cannot possibly roam, or if we are unable to |
| 9542 | currently roam, then notify HDD of the lost link */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9543 | if(fToRoam) |
| 9544 | { |
| 9545 | //Only remove the connected BSS in infrastructure mode |
| 9546 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 9547 | //Not to do anying for lostlink with WDS |
| 9548 | if( pMac->roam.configParam.nRoamingTime ) |
| 9549 | { |
| 9550 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac, sessionId, |
| 9551 | ( eWNI_SME_DEAUTH_IND == type ) ? |
| 9552 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc))) |
| 9553 | { |
| 9554 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 9555 | //For IBSS, we need to give some more info to HDD |
| 9556 | if(csrIsBssTypeIBSS(pSession->connectedProfile.BSSType)) |
| 9557 | { |
| 9558 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 9559 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 9560 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 9561 | } |
| 9562 | else |
| 9563 | { |
| 9564 | roamInfo.reasonCode = eCsrRoamReasonSmeIssuedForLostLink; |
| 9565 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9566 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9567 | pSession->roamingReason = ( eWNI_SME_DEAUTH_IND == type ) ? |
| 9568 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc; |
| 9569 | pSession->roamingStartTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 9570 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_LOSTLINK); |
| 9571 | } |
| 9572 | else |
| 9573 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9574 | smsLog(pMac, LOGW, " %s Fail to start roaming, status = %d", __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9575 | fToRoam = eANI_BOOLEAN_FALSE; |
| 9576 | } |
| 9577 | } |
| 9578 | else |
| 9579 | { |
| 9580 | //We are told not to roam, indicate lostlink |
| 9581 | fToRoam = eANI_BOOLEAN_FALSE; |
| 9582 | } |
| 9583 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9584 | if(!fToRoam) |
| 9585 | { |
Madan Mohan Koyyalamudi | af854cf | 2012-10-30 17:56:25 -0700 | [diff] [blame] | 9586 | //Tell HDD about the lost link |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9587 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9588 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9589 | /* Don't call csrRoamCallCallback for GO/SoftAp case as this indication |
| 9590 | * was already given as part of eWNI_SME_DISASSOC_IND msg handling in |
| 9591 | * csrRoamCheckForLinkStatusChange API. |
| 9592 | */ |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9593 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result); |
| 9594 | } |
| 9595 | |
| 9596 | /*No need to start idle scan in case of IBSS/SAP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9597 | Still enable idle scan for polling in case concurrent sessions are running */ |
| 9598 | if(CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile)) |
| 9599 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 9600 | csrScanStartIdleScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9601 | } |
| 9602 | } |
| 9603 | |
| 9604 | return (status); |
| 9605 | } |
| 9606 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9607 | eHalStatus csrRoamLostLinkAfterhandoffFailure( tpAniSirGlobal pMac,tANI_U32 sessionId) |
| 9608 | { |
| 9609 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9610 | tListElem *pEntry = NULL; |
| 9611 | tSmeCmd *pCommand = NULL; |
| 9612 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9613 | |
| 9614 | if(!pSession) |
| 9615 | { |
| 9616 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9617 | return eHAL_STATUS_FAILURE; |
| 9618 | } |
| 9619 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9620 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9621 | //Only remove the connected BSS in infrastructure mode |
| 9622 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 9623 | if(pMac->roam.configParam.nRoamingTime) |
| 9624 | { |
| 9625 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac,sessionId, pSession->roamingReason))) |
| 9626 | { |
| 9627 | //before starting the lost link logic release the roam command for handoff |
| 9628 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 9629 | if(pEntry) |
| 9630 | { |
| 9631 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 9632 | } |
| 9633 | if(pCommand) |
| 9634 | { |
| 9635 | if (( eSmeCommandRoam == pCommand->command ) && |
| 9636 | ( eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)) |
| 9637 | { |
| 9638 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9639 | { |
| 9640 | csrReleaseCommandRoam( pMac, pCommand ); |
| 9641 | } |
| 9642 | } |
| 9643 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9644 | smsLog( pMac, LOGW, "Lost link roaming started ...\n"); |
| 9645 | } |
| 9646 | } |
| 9647 | else |
| 9648 | { |
| 9649 | //We are told not to roam, indicate lostlink |
| 9650 | status = eHAL_STATUS_FAILURE; |
| 9651 | } |
| 9652 | |
| 9653 | return (status); |
| 9654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9655 | void csrRoamWmStatusChangeComplete( tpAniSirGlobal pMac ) |
| 9656 | { |
| 9657 | tListElem *pEntry; |
| 9658 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9659 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9660 | if ( pEntry ) |
| 9661 | { |
| 9662 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9663 | if ( eSmeCommandWmStatusChange == pCommand->command ) |
| 9664 | { |
| 9665 | // Nothing to process in a Lost Link completion.... It just kicks off a |
| 9666 | // roaming sequence. |
| 9667 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9668 | { |
| 9669 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 9670 | } |
| 9671 | else |
| 9672 | { |
| 9673 | smsLog( pMac, LOGE, " ******csrRoamWmStatusChangeComplete fail to release command\n"); |
| 9674 | } |
| 9675 | |
| 9676 | } |
| 9677 | else |
| 9678 | { |
| 9679 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but LOST LINK command is not ACTIVE ...\n" ); |
| 9680 | } |
| 9681 | } |
| 9682 | else |
| 9683 | { |
| 9684 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but NO commands are ACTIVE ...\n" ); |
| 9685 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9686 | smeProcessPendingQueue( pMac ); |
| 9687 | } |
| 9688 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9689 | void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 9690 | { |
| 9691 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 9692 | tSirSmeRsp *pSirSmeMsg; |
| 9693 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pCommand->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9694 | |
| 9695 | if(!pSession) |
| 9696 | { |
| 9697 | smsLog(pMac, LOGE, FL(" session %d not found "), pCommand->sessionId); |
| 9698 | return; |
| 9699 | } |
| 9700 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9701 | switch ( pCommand->u.wmStatusChangeCmd.Type ) |
| 9702 | { |
| 9703 | case eCsrDisassociated: |
| 9704 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg; |
| 9705 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DISASSOC_IND, pSirSmeMsg); |
| 9706 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9707 | case eCsrDeauthenticated: |
| 9708 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg; |
| 9709 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DEAUTH_IND, pSirSmeMsg); |
| 9710 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9711 | default: |
| 9712 | smsLog(pMac, LOGW, FL("gets an unknown command %d\n"), pCommand->u.wmStatusChangeCmd.Type); |
| 9713 | break; |
| 9714 | } |
| 9715 | //For WDS, we want to stop BSS as well when it is indicated that it is disconnected. |
| 9716 | if( CSR_IS_CONN_WDS(&pSession->connectedProfile) ) |
| 9717 | { |
| 9718 | if( !HAL_STATUS_SUCCESS(csrRoamIssueStopBssCmd( pMac, pCommand->sessionId, eANI_BOOLEAN_TRUE )) ) |
| 9719 | { |
| 9720 | //This is not good |
| 9721 | smsLog(pMac, LOGE, FL(" failed to issue stopBSS command\n")); |
| 9722 | } |
| 9723 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9724 | // Lost Link just triggers a roaming sequence. We can complte the Lost Link |
| 9725 | // command here since there is nothing else to do. |
| 9726 | csrRoamWmStatusChangeComplete( pMac ); |
| 9727 | } |
| 9728 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9729 | //This function returns band and mode information. |
| 9730 | //The only tricky part is that if phyMode is set to 11abg, this function may return eCSR_CFG_DOT11_MODE_11B |
| 9731 | //instead of eCSR_CFG_DOT11_MODE_11G if everything is set to auto-pick. |
| 9732 | #ifdef WLAN_SOFTAP_FEATURE |
| 9733 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 9734 | tANI_U8 operationChn, eCsrBand *pBand ) |
| 9735 | #else |
| 9736 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, eCsrPhyMode phyModeIn, |
| 9737 | tANI_U8 operationChn, eCsrBand *pBand ) |
| 9738 | #endif |
| 9739 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9740 | #ifdef WLAN_SOFTAP_FEATURE |
| 9741 | eCsrPhyMode phyModeIn = (eCsrPhyMode)pProfile->phyMode; |
| 9742 | eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pProfile, phyModeIn, |
| 9743 | pMac->roam.configParam.ProprietaryRatesEnabled); |
| 9744 | #else |
| 9745 | eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(phyModeIn, |
| 9746 | pMac->roam.configParam.ProprietaryRatesEnabled); |
| 9747 | #endif |
| 9748 | eCsrBand eBand; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 9749 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9750 | //If the global setting for dot11Mode is set to auto/abg, we overwrite the setting in the profile. |
| 9751 | #ifdef WLAN_SOFTAP_FEATURE |
| 9752 | if( ((!CSR_IS_INFRA_AP(pProfile )&& !CSR_IS_WDS(pProfile )) && |
| 9753 | ((eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) || |
| 9754 | (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode))) || |
| 9755 | (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) ) |
| 9756 | #else |
| 9757 | if( (eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) || |
| 9758 | (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode) || |
| 9759 | (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9760 | #endif |
| 9761 | { |
| 9762 | switch( pMac->roam.configParam.uCfgDot11Mode ) |
| 9763 | { |
| 9764 | case eCSR_CFG_DOT11_MODE_11A: |
| 9765 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 9766 | eBand = eCSR_BAND_5G; |
| 9767 | break; |
| 9768 | case eCSR_CFG_DOT11_MODE_11B: |
| 9769 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9770 | eBand = eCSR_BAND_24; |
| 9771 | break; |
| 9772 | case eCSR_CFG_DOT11_MODE_11G: |
| 9773 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 9774 | eBand = eCSR_BAND_24; |
| 9775 | break; |
| 9776 | case eCSR_CFG_DOT11_MODE_11N: |
| 9777 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 9778 | eBand = eCSR_BAND_24; |
| 9779 | break; |
| 9780 | //case eCSR_CFG_DOT11_MODE_BEST: |
| 9781 | // cfgDot11Mode = eCSR_CFG_DOT11_MODE_BEST; |
| 9782 | // eBand = eCSR_BAND_24; |
| 9783 | // break; |
| 9784 | default: |
| 9785 | // Global dot11 Mode setting is 11a/b/g. |
| 9786 | // use the channel number to determine the Mode setting. |
| 9787 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 9788 | { |
| 9789 | eBand = pMac->roam.configParam.eBand; |
| 9790 | if(eCSR_BAND_24 == eBand) |
| 9791 | { |
| 9792 | //See reason in else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) to pick 11B |
| 9793 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9794 | } |
| 9795 | else |
| 9796 | { |
| 9797 | //prefer 5GHz |
| 9798 | eBand = eCSR_BAND_5G; |
| 9799 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 9800 | } |
| 9801 | } |
| 9802 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 9803 | { |
| 9804 | // channel is a 2.4GHz channel. Set mode to 11g. |
| 9805 | // |
| 9806 | // !!LAC - WiFi tests require IBSS networks to start in 11b mode without any change to the |
| 9807 | // default parameter settings on the adapter. We use ACU to start an IBSS through creation |
| 9808 | // of a startIBSS profile. this startIBSS profile has Auto MACProtocol and the |
| 9809 | // adapter property setting for dot11Mode is also AUTO. So in this case, let's start |
| 9810 | // the IBSS network in 11b mode instead of 11g mode. |
| 9811 | // |
| 9812 | // so this is for Auto=profile->MacProtocol && Auto=Global.dot11Mode && profile->channel is < 14, |
| 9813 | // then start the IBSS in b mode. |
| 9814 | // |
| 9815 | // Note: we used to have this start as an 11g IBSS for best performance... now to specify that |
| 9816 | // the user will have to set the do11Mode in the property page to 11g to force it. |
| 9817 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9818 | eBand = eCSR_BAND_24; |
| 9819 | } |
| 9820 | else |
| 9821 | { |
| 9822 | // else, it's a 5.0GHz channel. Set mode to 11a. |
| 9823 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 9824 | eBand = eCSR_BAND_5G; |
| 9825 | } |
| 9826 | break; |
| 9827 | }//switch |
| 9828 | }//if( eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 9829 | else |
| 9830 | { |
| 9831 | //dot11 mode is set, lets pick the band |
| 9832 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 9833 | { |
| 9834 | // channel is Auto also. |
| 9835 | eBand = pMac->roam.configParam.eBand; |
| 9836 | if(eCSR_BAND_ALL == eBand) |
| 9837 | { |
| 9838 | //prefer 5GHz |
| 9839 | eBand = eCSR_BAND_5G; |
| 9840 | } |
| 9841 | } |
| 9842 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 9843 | { |
| 9844 | eBand = eCSR_BAND_24; |
| 9845 | } |
| 9846 | else |
| 9847 | { |
| 9848 | eBand = eCSR_BAND_5G; |
| 9849 | } |
| 9850 | } |
| 9851 | if(pBand) |
| 9852 | { |
| 9853 | *pBand = eBand; |
| 9854 | } |
| 9855 | |
| 9856 | if (operationChn == 14){ |
| 9857 | smsLog(pMac, LOGE, FL(" Switching to Dot11B mode \n")); |
| 9858 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 9859 | } |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 9860 | |
Madan Mohan Koyyalamudi | 5ec4b18 | 2012-11-28 16:15:17 -0800 | [diff] [blame] | 9861 | /* Incase of WEP Security encryption type is coming as part of add key. So while STart BSS dont have information */ |
| 9862 | 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] | 9863 | ((eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 9864 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 9865 | (eCSR_CFG_DOT11_MODE_11AC == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 9866 | #endif |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 9867 | (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode)) ) |
| 9868 | { |
| 9869 | //We cannot do 11n here |
| 9870 | if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 9871 | { |
| 9872 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 9873 | } |
| 9874 | else |
| 9875 | { |
| 9876 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 9877 | } |
| 9878 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9879 | return( cfgDot11Mode ); |
| 9880 | } |
| 9881 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9882 | eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 9883 | { |
| 9884 | eHalStatus status; |
| 9885 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9886 | |
| 9887 | if(!pSession) |
| 9888 | { |
| 9889 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9890 | return eHAL_STATUS_FAILURE; |
| 9891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9892 | |
| 9893 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9894 | { |
| 9895 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9896 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9897 | if(pIbssLog) |
| 9898 | { |
| 9899 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_REQ; |
| 9900 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9901 | } |
| 9902 | } |
| 9903 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9904 | pSession->ibss_join_pending = FALSE; |
| 9905 | csrRoamStopIbssJoinTimer(pMac, sessionId ); |
| 9906 | // Set the roaming substate to 'stop Bss request'... |
| 9907 | csrRoamSubstateChange( pMac, NewSubstate, sessionId ); |
| 9908 | |
| 9909 | // attempt to stop the Bss (reason code is ignored...) |
| 9910 | status = csrSendMBStopBssReqMsg( pMac, sessionId ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 9911 | if(!HAL_STATUS_SUCCESS(status)) |
| 9912 | { |
| 9913 | smsLog(pMac, LOGW, FL("csrSendMBStopBssReqMsg failed with status %d"), status); |
| 9914 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9915 | return (status); |
| 9916 | } |
| 9917 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9918 | //pNumChan is a caller allocated space with the sizeof pChannels |
| 9919 | eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan) |
| 9920 | { |
| 9921 | |
| 9922 | return (ccmCfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 9923 | (tANI_U8 *)pChannels, |
| 9924 | pNumChan)); |
| 9925 | } |
| 9926 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 9927 | tPowerdBm csrGetCfgMaxTxPower (tpAniSirGlobal pMac, tANI_U8 channel) |
| 9928 | { |
| 9929 | tANI_U32 cfgLength = 0; |
| 9930 | tANI_U16 cfgId = 0; |
| 9931 | tPowerdBm maxTxPwr = 0; |
| 9932 | tANI_U8 *pCountryInfo = NULL; |
| 9933 | eHalStatus status; |
| 9934 | tANI_U8 count = 0; |
| 9935 | tANI_U8 firstChannel; |
| 9936 | tANI_U8 maxChannels; |
| 9937 | |
| 9938 | if (CSR_IS_CHANNEL_5GHZ(channel)) |
| 9939 | { |
| 9940 | cfgId = WNI_CFG_MAX_TX_POWER_5; |
| 9941 | cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN; |
| 9942 | } |
| 9943 | else if (CSR_IS_CHANNEL_24GHZ(channel)) |
| 9944 | { |
| 9945 | cfgId = WNI_CFG_MAX_TX_POWER_2_4; |
| 9946 | cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN; |
| 9947 | } |
| 9948 | else |
| 9949 | return maxTxPwr; |
| 9950 | |
| 9951 | status = palAllocateMemory(pMac->hHdd, (void **)&pCountryInfo, cfgLength); |
| 9952 | if (status != eHAL_STATUS_SUCCESS) |
| 9953 | { |
| 9954 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 9955 | FL("%s: palAllocateMemory() failed, status = %d"), |
| 9956 | __FUNCTION__, status); |
| 9957 | goto error; |
| 9958 | } |
| 9959 | status = ccmCfgGetStr(pMac, cfgId, (tANI_U8 *)pCountryInfo, &cfgLength); |
| 9960 | if (status != eHAL_STATUS_SUCCESS) |
| 9961 | { |
| 9962 | goto error; |
| 9963 | } |
| 9964 | /* Identify the channel and maxtxpower */ |
| 9965 | while (count <= (cfgLength - (sizeof(tSirMacChanInfo)))) |
| 9966 | { |
| 9967 | firstChannel = pCountryInfo[count++]; |
| 9968 | maxChannels = pCountryInfo[count++]; |
| 9969 | maxTxPwr = pCountryInfo[count++]; |
| 9970 | |
| 9971 | if ((channel >= firstChannel) && |
| 9972 | (channel < (firstChannel + maxChannels))) |
| 9973 | { |
| 9974 | break; |
| 9975 | } |
| 9976 | } |
| 9977 | |
| 9978 | error: |
| 9979 | if (NULL != pCountryInfo) |
| 9980 | palFreeMemory(pMac->hHdd, pCountryInfo); |
| 9981 | |
| 9982 | return maxTxPwr; |
| 9983 | } |
| 9984 | |
| 9985 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9986 | tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel ) |
| 9987 | { |
| 9988 | tANI_BOOLEAN fValid = FALSE; |
| 9989 | tANI_U32 idxValidChannels; |
| 9990 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 9991 | |
| 9992 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len))) |
| 9993 | { |
| 9994 | for ( idxValidChannels = 0; ( idxValidChannels < len ); idxValidChannels++ ) |
| 9995 | { |
| 9996 | if ( channel == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 9997 | { |
| 9998 | fValid = TRUE; |
| 9999 | break; |
| 10000 | } |
| 10001 | } |
| 10002 | } |
| 10003 | pMac->roam.numValidChannels = len; |
| 10004 | return fValid; |
| 10005 | } |
| 10006 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10007 | tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel) |
| 10008 | { |
| 10009 | tANI_BOOLEAN fValid = eANI_BOOLEAN_FALSE; |
| 10010 | tANI_U8 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10011 | for(i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++) |
| 10012 | { |
| 10013 | if(channel == pMac->scan.base40MHzChannels.channelList[i]) |
| 10014 | { |
| 10015 | fValid = eANI_BOOLEAN_TRUE; |
| 10016 | break; |
| 10017 | } |
| 10018 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10019 | return (fValid); |
| 10020 | } |
| 10021 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10022 | //This function check and validate whether the NIC can do CB (40MHz) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10023 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10024 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10025 | ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10026 | tANI_U8 centerChn; |
| 10027 | tANI_U32 ChannelBondingMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10028 | if(CSR_IS_CHANNEL_24GHZ(primaryChn)) |
| 10029 | { |
| 10030 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 10031 | } |
| 10032 | else |
| 10033 | { |
| 10034 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 10035 | } |
| 10036 | //Figure what the other side's CB mode |
| 10037 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 10038 | { |
| 10039 | if(pIes->HTCaps.present && (eHT_CHANNEL_WIDTH_40MHZ == pIes->HTCaps.supportedChannelWidthSet)) |
| 10040 | { |
| 10041 | if(pIes->HTInfo.present) |
| 10042 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10043 | /* This is called during INFRA STA/CLIENT and should use the merged value of |
| 10044 | * supported channel width and recommended tx width as per standard |
| 10045 | */ |
| 10046 | smsLog(pMac, LOG1, "scws %u rtws %u sco %u\n", |
| 10047 | pIes->HTCaps.supportedChannelWidthSet, |
| 10048 | pIes->HTInfo.recommendedTxWidthSet, |
| 10049 | pIes->HTInfo.secondaryChannelOffset); |
| 10050 | |
| 10051 | if (pIes->HTInfo.recommendedTxWidthSet == eHT_CHANNEL_WIDTH_40MHZ) |
| 10052 | eRet = (ePhyChanBondState)pIes->HTInfo.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10053 | else |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10054 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 10055 | switch (eRet) { |
| 10056 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 10057 | centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET; |
| 10058 | break; |
| 10059 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 10060 | centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET; |
| 10061 | break; |
| 10062 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 10063 | default: |
| 10064 | centerChn = primaryChn; |
| 10065 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10066 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10067 | if((PHY_SINGLE_CHANNEL_CENTERED != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10068 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10069 | smsLog(pMac, LOGE, " Invalid center channel (%d), disable 40MHz mode\n", centerChn); |
| 10070 | //eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10071 | } |
| 10072 | } |
| 10073 | } |
| 10074 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10075 | return eRet; |
| 10076 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10077 | tANI_BOOLEAN csrIsEncryptionInList( tpAniSirGlobal pMac, tCsrEncryptionList *pCipherList, eCsrEncryptionType encryptionType ) |
| 10078 | { |
| 10079 | tANI_BOOLEAN fFound = FALSE; |
| 10080 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10081 | for( idx = 0; idx < pCipherList->numEntries; idx++ ) |
| 10082 | { |
| 10083 | if( pCipherList->encryptionType[idx] == encryptionType ) |
| 10084 | { |
| 10085 | fFound = TRUE; |
| 10086 | break; |
| 10087 | } |
| 10088 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10089 | return fFound; |
| 10090 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10091 | tANI_BOOLEAN csrIsAuthInList( tpAniSirGlobal pMac, tCsrAuthList *pAuthList, eCsrAuthType authType ) |
| 10092 | { |
| 10093 | tANI_BOOLEAN fFound = FALSE; |
| 10094 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10095 | for( idx = 0; idx < pAuthList->numEntries; idx++ ) |
| 10096 | { |
| 10097 | if( pAuthList->authType[idx] == authType ) |
| 10098 | { |
| 10099 | fFound = TRUE; |
| 10100 | break; |
| 10101 | } |
| 10102 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10103 | return fFound; |
| 10104 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10105 | tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2) |
| 10106 | { |
| 10107 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 10108 | tCsrScanResultFilter *pScanFilter = NULL; |
| 10109 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10110 | |
| 10111 | if(pProfile1 && pProfile2) |
| 10112 | { |
| 10113 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 10114 | if(HAL_STATUS_SUCCESS(status)) |
| 10115 | { |
| 10116 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 10117 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile2, pScanFilter); |
| 10118 | if(HAL_STATUS_SUCCESS(status)) |
| 10119 | { |
| 10120 | fCheck = eANI_BOOLEAN_FALSE; |
| 10121 | do |
| 10122 | { |
| 10123 | tANI_U32 i; |
| 10124 | for(i = 0; i < pScanFilter->SSIDs.numOfSSIDs; i++) |
| 10125 | { |
| 10126 | fCheck = csrIsSsidMatch( pMac, pScanFilter->SSIDs.SSIDList[i].SSID.ssId, |
| 10127 | pScanFilter->SSIDs.SSIDList[i].SSID.length, |
| 10128 | pProfile1->SSID.ssId, pProfile1->SSID.length, eANI_BOOLEAN_FALSE ); |
| 10129 | if ( fCheck ) break; |
| 10130 | } |
| 10131 | if(!fCheck) |
| 10132 | { |
| 10133 | break; |
| 10134 | } |
| 10135 | if( !csrIsAuthInList( pMac, &pProfile2->AuthType, pProfile1->AuthType) |
| 10136 | || pProfile2->BSSType != pProfile1->BSSType |
| 10137 | || !csrIsEncryptionInList( pMac, &pProfile2->EncryptionType, pProfile1->EncryptionType ) |
| 10138 | ) |
| 10139 | { |
| 10140 | fCheck = eANI_BOOLEAN_FALSE; |
| 10141 | break; |
| 10142 | } |
| 10143 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10144 | if (pProfile1->MDID.mdiePresent || pProfile2->MDID.mdiePresent) |
| 10145 | { |
| 10146 | if (pProfile1->MDID.mobilityDomain != pProfile2->MDID.mobilityDomain) |
| 10147 | { |
| 10148 | fCheck = eANI_BOOLEAN_FALSE; |
| 10149 | break; |
| 10150 | } |
| 10151 | } |
| 10152 | #endif |
| 10153 | //Match found |
| 10154 | fCheck = eANI_BOOLEAN_TRUE; |
| 10155 | }while(0); |
| 10156 | csrFreeScanFilter(pMac, pScanFilter); |
| 10157 | } |
| 10158 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 10159 | } |
| 10160 | } |
| 10161 | |
| 10162 | return (fCheck); |
| 10163 | } |
| 10164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10165 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2) |
| 10166 | { |
| 10167 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 10168 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10169 | do |
| 10170 | { |
| 10171 | //Only check for static WEP |
| 10172 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) && |
| 10173 | !csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) |
| 10174 | { |
| 10175 | fCheck = eANI_BOOLEAN_TRUE; |
| 10176 | break; |
| 10177 | } |
| 10178 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, pConnProfile->EncryptionType)) break; |
| 10179 | if(pConnProfile->Keys.defaultIndex != pProfile2->Keys.defaultIndex) break; |
| 10180 | for(i = 0; i < CSR_MAX_NUM_KEY; i++) |
| 10181 | { |
| 10182 | if(pConnProfile->Keys.KeyLength[i] != pProfile2->Keys.KeyLength[i]) break; |
| 10183 | if(!palEqualMemory(pMac->hHdd, &pConnProfile->Keys.KeyMaterial[i], |
| 10184 | &pProfile2->Keys.KeyMaterial[i], pProfile2->Keys.KeyLength[i])) |
| 10185 | { |
| 10186 | break; |
| 10187 | } |
| 10188 | } |
| 10189 | if( i == CSR_MAX_NUM_KEY) |
| 10190 | { |
| 10191 | fCheck = eANI_BOOLEAN_TRUE; |
| 10192 | } |
| 10193 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10194 | return (fCheck); |
| 10195 | } |
| 10196 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10197 | //IBSS |
| 10198 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10199 | tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac ) |
| 10200 | { |
| 10201 | tANI_U8 channel = 0; |
| 10202 | tANI_U32 idx; |
| 10203 | tANI_U32 idxValidChannels; |
| 10204 | tANI_BOOLEAN fFound = FALSE; |
| 10205 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10206 | |
| 10207 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel5G) |
| 10208 | { |
| 10209 | channel = pMac->roam.configParam.AdHocChannel5G; |
| 10210 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 10211 | { |
| 10212 | channel = 0; |
| 10213 | } |
| 10214 | } |
| 10215 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 10216 | { |
| 10217 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_50 ) && !fFound; idx++ ) |
| 10218 | { |
| 10219 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 10220 | { |
| 10221 | if ( csrStartIbssChannels50[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10222 | { |
| 10223 | fFound = TRUE; |
| 10224 | channel = csrStartIbssChannels50[ idx ]; |
| 10225 | } |
| 10226 | } |
| 10227 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10228 | // this is rare, but if it does happen, we find anyone in 11a bandwidth and return the first 11a channel found! |
| 10229 | if (!fFound) |
| 10230 | { |
| 10231 | for ( idxValidChannels = 0; idxValidChannels < len ; idxValidChannels++ ) |
| 10232 | { |
| 10233 | if ( CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ idx ]) ) // the max channel# in 11g is 14 |
| 10234 | { |
| 10235 | channel = csrStartIbssChannels50[ idx ]; |
| 10236 | break; |
| 10237 | } |
| 10238 | } |
| 10239 | } |
| 10240 | }//if |
| 10241 | |
| 10242 | return( channel ); |
| 10243 | } |
| 10244 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10245 | tANI_U8 csrRoamGetIbssStartChannelNumber24( tpAniSirGlobal pMac ) |
| 10246 | { |
| 10247 | tANI_U8 channel = 1; |
| 10248 | tANI_U32 idx; |
| 10249 | tANI_U32 idxValidChannels; |
| 10250 | tANI_BOOLEAN fFound = FALSE; |
| 10251 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10252 | |
| 10253 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel24) |
| 10254 | { |
| 10255 | channel = pMac->roam.configParam.AdHocChannel24; |
| 10256 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 10257 | { |
| 10258 | channel = 0; |
| 10259 | } |
| 10260 | } |
| 10261 | |
| 10262 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 10263 | { |
| 10264 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_24 ) && !fFound; idx++ ) |
| 10265 | { |
| 10266 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 10267 | { |
| 10268 | if ( csrStartIbssChannels24[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10269 | { |
| 10270 | fFound = TRUE; |
| 10271 | channel = csrStartIbssChannels24[ idx ]; |
| 10272 | } |
| 10273 | } |
| 10274 | } |
| 10275 | } |
| 10276 | |
| 10277 | return( channel ); |
| 10278 | } |
| 10279 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10280 | static void csrRoamGetBssStartParms( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 10281 | tCsrRoamStartBssParams *pParam ) |
| 10282 | { |
| 10283 | eCsrCfgDot11Mode cfgDot11Mode; |
| 10284 | eCsrBand eBand; |
| 10285 | tANI_U8 channel = 0; |
| 10286 | tSirNwType nwType; |
| 10287 | tANI_U8 operationChannel = 0; |
| 10288 | |
| 10289 | if(pProfile->ChannelInfo.numOfChannels && pProfile->ChannelInfo.ChannelList) |
| 10290 | { |
| 10291 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 10292 | } |
| 10293 | |
| 10294 | #ifdef WLAN_SOFTAP_FEATURE |
| 10295 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
| 10296 | #else |
| 10297 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, (eCsrPhyMode)pProfile->phyMode, operationChannel, &eBand ); |
| 10298 | #endif |
| 10299 | |
| 10300 | #ifdef WLAN_FEATURE_P2P |
| 10301 | if( ( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 10302 | (pProfile->csrPersona == VOS_P2P_GO_MODE) ) |
| 10303 | && ( cfgDot11Mode == eCSR_CFG_DOT11_MODE_11B) |
| 10304 | ) |
| 10305 | { |
| 10306 | /* This should never happen */ |
| 10307 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
| 10308 | FL("For P2PClient/P2P-GO (persona %d) cfgDot11Mode is 11B\n"), |
| 10309 | pProfile->csrPersona); |
| 10310 | VOS_ASSERT(0); |
| 10311 | } |
| 10312 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10313 | switch( cfgDot11Mode ) |
| 10314 | { |
| 10315 | case eCSR_CFG_DOT11_MODE_11G: |
| 10316 | nwType = eSIR_11G_NW_TYPE; |
| 10317 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10318 | case eCSR_CFG_DOT11_MODE_11B: |
| 10319 | nwType = eSIR_11B_NW_TYPE; |
| 10320 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10321 | case eCSR_CFG_DOT11_MODE_11A: |
| 10322 | nwType = eSIR_11A_NW_TYPE; |
| 10323 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10324 | default: |
| 10325 | case eCSR_CFG_DOT11_MODE_11N: |
| 10326 | case eCSR_CFG_DOT11_MODE_TAURUS: |
| 10327 | //Because LIM only verifies it against 11a, 11b or 11g, set only 11g or 11a here |
| 10328 | if(eCSR_BAND_24 == eBand) |
| 10329 | { |
| 10330 | nwType = eSIR_11G_NW_TYPE; |
| 10331 | } |
| 10332 | else |
| 10333 | { |
| 10334 | nwType = eSIR_11A_NW_TYPE; |
| 10335 | } |
| 10336 | break; |
| 10337 | } |
| 10338 | |
| 10339 | pParam->extendedRateSet.numRates = 0; |
| 10340 | |
| 10341 | switch ( nwType ) |
| 10342 | { |
| 10343 | default: |
| 10344 | smsLog(pMac, LOGE, FL("sees an unknown pSirNwType (%d)\n"), nwType); |
| 10345 | case eSIR_11A_NW_TYPE: |
| 10346 | |
| 10347 | pParam->operationalRateSet.numRates = 8; |
| 10348 | |
| 10349 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 10350 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10351 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 10352 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10353 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 10354 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10355 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10356 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10357 | |
| 10358 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10359 | { |
| 10360 | channel = csrRoamGetIbssStartChannelNumber50( pMac ); |
| 10361 | if( 0 == channel && |
| 10362 | CSR_IS_PHY_MODE_DUAL_BAND(pProfile->phyMode) && |
| 10363 | CSR_IS_PHY_MODE_DUAL_BAND(pMac->roam.configParam.phyMode) |
| 10364 | ) |
| 10365 | { |
| 10366 | //We could not find a 5G channel by auto pick, let's try 2.4G channels |
| 10367 | //We only do this here because csrRoamGetPhyModeBandForBss always picks 11a for AUTO |
| 10368 | nwType = eSIR_11B_NW_TYPE; |
| 10369 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10370 | pParam->operationalRateSet.numRates = 4; |
| 10371 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10372 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10373 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10374 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 10375 | } |
| 10376 | } |
| 10377 | else |
| 10378 | { |
| 10379 | channel = operationChannel; |
| 10380 | } |
| 10381 | break; |
| 10382 | |
| 10383 | case eSIR_11B_NW_TYPE: |
| 10384 | pParam->operationalRateSet.numRates = 4; |
| 10385 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10386 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10387 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10388 | 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] | 10389 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10390 | { |
| 10391 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10392 | } |
| 10393 | else |
| 10394 | { |
| 10395 | channel = operationChannel; |
| 10396 | } |
| 10397 | |
| 10398 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10399 | case eSIR_11G_NW_TYPE: |
| 10400 | #ifdef WLAN_FEATURE_P2P |
| 10401 | /* For P2P Client and P2P GO, disable 11b rates */ |
| 10402 | if( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 10403 | (pProfile->csrPersona == VOS_P2P_GO_MODE) |
| 10404 | ) |
| 10405 | { |
| 10406 | pParam->operationalRateSet.numRates = 8; |
| 10407 | |
| 10408 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 10409 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10410 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 10411 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10412 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 10413 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10414 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10415 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10416 | } |
| 10417 | else |
| 10418 | #endif |
| 10419 | { |
| 10420 | pParam->operationalRateSet.numRates = 4; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10421 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 10422 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 10423 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 10424 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 10425 | |
| 10426 | pParam->extendedRateSet.numRates = 8; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10427 | pParam->extendedRateSet.rate[0] = SIR_MAC_RATE_6; |
| 10428 | pParam->extendedRateSet.rate[1] = SIR_MAC_RATE_9; |
| 10429 | pParam->extendedRateSet.rate[2] = SIR_MAC_RATE_12; |
| 10430 | pParam->extendedRateSet.rate[3] = SIR_MAC_RATE_18; |
| 10431 | pParam->extendedRateSet.rate[4] = SIR_MAC_RATE_24; |
| 10432 | pParam->extendedRateSet.rate[5] = SIR_MAC_RATE_36; |
| 10433 | pParam->extendedRateSet.rate[6] = SIR_MAC_RATE_48; |
| 10434 | pParam->extendedRateSet.rate[7] = SIR_MAC_RATE_54; |
| 10435 | } |
| 10436 | |
| 10437 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 10438 | { |
| 10439 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 10440 | } |
| 10441 | else |
| 10442 | { |
| 10443 | channel = operationChannel; |
| 10444 | } |
| 10445 | |
| 10446 | break; |
| 10447 | } |
| 10448 | pParam->operationChn = channel; |
| 10449 | pParam->sirNwType = nwType; |
| 10450 | } |
| 10451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10452 | static void csrRoamGetBssStartParmsFromBssDesc( tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, |
| 10453 | tDot11fBeaconIEs *pIes, tCsrRoamStartBssParams *pParam ) |
| 10454 | { |
| 10455 | |
| 10456 | if( pParam ) |
| 10457 | { |
| 10458 | pParam->sirNwType = pBssDesc->nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10459 | pParam->cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10460 | pParam->operationChn = pBssDesc->channelId; |
| 10461 | palCopyMemory( pMac->hHdd, &pParam->bssid, pBssDesc->bssId, sizeof(tCsrBssid) ); |
| 10462 | |
| 10463 | if( pIes ) |
| 10464 | { |
| 10465 | if(pIes->SuppRates.present) |
| 10466 | { |
| 10467 | pParam->operationalRateSet.numRates = pIes->SuppRates.num_rates; |
| 10468 | if(pIes->SuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) |
| 10469 | { |
| 10470 | smsLog(pMac, LOGE, FL("num_rates :%d is more than SIR_MAC_RATESET_EID_MAX, resetting to SIR_MAC_RATESET_EID_MAX\n"), |
| 10471 | pIes->SuppRates.num_rates); |
| 10472 | pIes->SuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
| 10473 | } |
| 10474 | palCopyMemory(pMac->hHdd, pParam->operationalRateSet.rate, pIes->SuppRates.rates, |
| 10475 | sizeof(*pIes->SuppRates.rates) * pIes->SuppRates.num_rates); |
| 10476 | } |
| 10477 | if( pIes->SSID.present ) |
| 10478 | { |
| 10479 | pParam->ssId.length = pIes->SSID.num_ssid; |
| 10480 | palCopyMemory(pMac->hHdd, pParam->ssId.ssId, pIes->SSID.ssid, pParam->ssId.length); |
| 10481 | } |
| 10482 | pParam->cbMode = csrGetCBModeFromIes(pMac, pParam->operationChn, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10483 | } |
| 10484 | else |
| 10485 | { |
| 10486 | pParam->ssId.length = 0; |
| 10487 | pParam->operationalRateSet.numRates = 0; |
| 10488 | } |
| 10489 | } |
| 10490 | } |
| 10491 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10492 | static void csrRoamDetermineMaxRateForAdHoc( tpAniSirGlobal pMac, tSirMacRateSet *pSirRateSet ) |
| 10493 | { |
| 10494 | tANI_U8 MaxRate = 0; |
| 10495 | tANI_U32 i; |
| 10496 | tANI_U8 *pRate; |
| 10497 | |
| 10498 | pRate = pSirRateSet->rate; |
| 10499 | for ( i = 0; i < pSirRateSet->numRates; i++ ) |
| 10500 | { |
| 10501 | MaxRate = CSR_MAX( MaxRate, ( pRate[ i ] & (~CSR_DOT11_BASIC_RATE_MASK) ) ); |
| 10502 | } |
| 10503 | |
| 10504 | // Save the max rate in the connected state information... |
| 10505 | |
| 10506 | // modify LastRates variable as well |
| 10507 | |
| 10508 | return; |
| 10509 | } |
| 10510 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10511 | //this function finds a valid secondary channel for channel bonding with "channel". |
| 10512 | //Param: channel -- primary channel, caller must validate it |
| 10513 | // cbChoice -- CB directory |
| 10514 | //Return: if 0, no secondary channel is found. Otherwise a valid secondary channel. |
| 10515 | static tANI_U8 csrRoamGetSecondaryChannel(tpAniSirGlobal pMac, tANI_U8 channel, eCsrCBChoice cbChoice) |
| 10516 | { |
| 10517 | tANI_U8 chnUp = 0, chnDown = 0, chnRet = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10518 | switch (cbChoice) |
| 10519 | { |
| 10520 | case eCSR_CB_OFF: |
| 10521 | chnUp = 0; |
| 10522 | chnDown = 0; |
| 10523 | break; |
| 10524 | case eCSR_CB_DOWN: |
| 10525 | chnUp = 0; |
| 10526 | chnDown = channel - CSR_CB_CHANNEL_GAP; |
| 10527 | break; |
| 10528 | case eCSR_CB_UP: |
| 10529 | chnUp = channel + CSR_CB_CHANNEL_GAP; |
| 10530 | chnDown = 0; |
| 10531 | break; |
| 10532 | case eCSR_CB_AUTO: |
| 10533 | //consider every other value means auto |
| 10534 | default: |
| 10535 | chnUp = channel + CSR_CB_CHANNEL_GAP; |
| 10536 | chnDown = channel - CSR_CB_CHANNEL_GAP; |
| 10537 | break; |
| 10538 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10539 | //if CB_UP or auto, try channel up first |
| 10540 | if(chnUp && CSR_IS_SAME_BAND_CHANNELS(chnUp, channel) && csrRoamIsChannelValid(pMac, chnUp)) |
| 10541 | { |
| 10542 | //found a valid up channel for channel bonding |
| 10543 | //check whether the center channel is valid |
| 10544 | if(csrRoamIsValid40MhzChannel(pMac, channel + CSR_CB_CENTER_CHANNEL_OFFSET)) |
| 10545 | { |
| 10546 | chnRet = chnUp; |
| 10547 | } |
| 10548 | } |
| 10549 | if(chnRet == 0 && chnDown && CSR_IS_SAME_BAND_CHANNELS(chnDown, channel) && csrRoamIsChannelValid(pMac, chnDown)) |
| 10550 | { |
| 10551 | //found a valid down channel for channel bonding |
| 10552 | if(csrRoamIsValid40MhzChannel(pMac, channel - CSR_CB_CENTER_CHANNEL_OFFSET)) |
| 10553 | { |
| 10554 | chnRet = chnDown; |
| 10555 | } |
| 10556 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10557 | return chnRet; |
| 10558 | } |
| 10559 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10560 | eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, |
| 10561 | tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId ) |
| 10562 | { |
| 10563 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10564 | eCsrBand eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10565 | // Set the roaming substate to 'Start BSS attempt'... |
| 10566 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10567 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10568 | //Need to figure out whether we need to log WDS??? |
| 10569 | if( CSR_IS_IBSS( pProfile ) ) |
| 10570 | { |
| 10571 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10572 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 10573 | if(pIbssLog) |
| 10574 | { |
| 10575 | if(pBssDesc) |
| 10576 | { |
| 10577 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_REQ; |
| 10578 | palCopyMemory(pMac->hHdd, pIbssLog->bssid, pBssDesc->bssId, 6); |
| 10579 | } |
| 10580 | else |
| 10581 | { |
| 10582 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_REQ; |
| 10583 | } |
| 10584 | palCopyMemory(pMac->hHdd, pIbssLog->ssid, pParam->ssId.ssId, |
| 10585 | pParam->ssId.length); |
| 10586 | if(pProfile->ChannelInfo.numOfChannels == 0) |
| 10587 | { |
| 10588 | pIbssLog->channelSetting = AUTO_PICK; |
| 10589 | } |
| 10590 | else |
| 10591 | { |
| 10592 | pIbssLog->channelSetting = SPECIFIED; |
| 10593 | } |
| 10594 | pIbssLog->operatingChannel = pParam->operationChn; |
| 10595 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 10596 | } |
| 10597 | } |
| 10598 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10599 | //Put RSN information in for Starting BSS |
| 10600 | pParam->nRSNIELength = (tANI_U16)pProfile->nRSNReqIELength; |
| 10601 | pParam->pRSNIE = pProfile->pRSNReqIE; |
| 10602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10603 | #ifdef WLAN_SOFTAP_FEATURE |
| 10604 | pParam->privacy = pProfile->privacy; |
| 10605 | pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq; |
| 10606 | pParam->authType = pProfile->csr80211AuthType; |
| 10607 | pParam->beaconInterval = pProfile->beaconInterval; |
| 10608 | pParam->dtimPeriod = pProfile->dtimPeriod; |
| 10609 | pParam->ApUapsdEnable = pProfile->ApUapsdEnable; |
| 10610 | pParam->ssidHidden = pProfile->SSIDs.SSIDList[0].ssidHidden; |
| 10611 | if (CSR_IS_INFRA_AP(pProfile)&& (pParam->operationChn != 0)) |
| 10612 | { |
| 10613 | if (csrIsValidChannel(pMac, pParam->operationChn) != eHAL_STATUS_SUCCESS) |
| 10614 | { |
| 10615 | pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL; |
| 10616 | } |
| 10617 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10618 | pParam->protEnabled = pProfile->protEnabled; |
| 10619 | pParam->obssProtEnabled = pProfile->obssProtEnabled; |
| 10620 | pParam->ht_protection = pProfile->cfg_protection; |
| 10621 | pParam->wps_state = pProfile->wps_state; |
| 10622 | #endif |
| 10623 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10624 | #ifdef WLAN_SOFTAP_FEATURE |
| 10625 | pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, pParam->operationChn /* pProfile->operationChannel*/, |
| 10626 | &eBand); |
| 10627 | #else |
| 10628 | pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile->operationChannel, |
| 10629 | &eBand); |
| 10630 | #endif |
| 10631 | pParam->bssPersona = pProfile->csrPersona; |
| 10632 | // When starting an IBSS, start on the channel from the Profile. |
| 10633 | status = csrSendMBStartBssReqMsg( pMac, sessionId, pProfile->BSSType, pParam, pBssDesc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10634 | return (status); |
| 10635 | } |
| 10636 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10637 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10638 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10639 | { |
| 10640 | tANI_U8 Channel, SecondChn; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10641 | ePhyChanBondState cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10642 | eCsrCBChoice cbChoice; |
| 10643 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10644 | |
| 10645 | if(!pSession) |
| 10646 | { |
| 10647 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10648 | return; |
| 10649 | } |
| 10650 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10651 | if( pBssDesc ) |
| 10652 | { |
| 10653 | csrRoamGetBssStartParmsFromBssDesc( pMac, pBssDesc, pIes, &pSession->bssParams ); |
| 10654 | //Since csrRoamGetBssStartParmsFromBssDesc fills in the bssid for pSession->bssParams |
| 10655 | //The following code has to be do after that. |
| 10656 | //For WDS station, use selfMac as the self BSSID |
| 10657 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 10658 | { |
| 10659 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid)); |
| 10660 | } |
| 10661 | } |
| 10662 | else |
| 10663 | { |
| 10664 | csrRoamGetBssStartParms(pMac, pProfile, &pSession->bssParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10665 | //Use the first SSID |
| 10666 | if(pProfile->SSIDs.numOfSSIDs) |
| 10667 | { |
| 10668 | palCopyMemory(pMac->hHdd, &pSession->bssParams.ssId, pProfile->SSIDs.SSIDList, sizeof(tSirMacSSid)); |
| 10669 | } |
| 10670 | //For WDS station, use selfMac as the self BSSID |
| 10671 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 10672 | { |
| 10673 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, &pSession->selfMacAddr, sizeof(tCsrBssid)); |
| 10674 | } |
| 10675 | //Use the first BSSID |
| 10676 | else if( pProfile->BSSIDs.numOfBSSIDs ) |
| 10677 | { |
| 10678 | palCopyMemory(pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 10679 | } |
| 10680 | else |
| 10681 | { |
| 10682 | palZeroMemory( pMac->hHdd, &pSession->bssParams.bssid, sizeof(tCsrBssid) ); |
| 10683 | } |
| 10684 | } |
| 10685 | Channel = pSession->bssParams.operationChn; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10686 | //Set operating channel in pProfile which will be used |
| 10687 | //in csrRoamSetBssConfigCfg() to determine channel bonding |
| 10688 | //mode and will be configured in CFG later |
| 10689 | pProfile->operationChannel = Channel; |
| 10690 | |
| 10691 | if(Channel == 0) |
| 10692 | { |
| 10693 | smsLog(pMac, LOGW, " CSR cannot find a channel to start IBSS\n"); |
| 10694 | } |
| 10695 | else |
| 10696 | { |
| 10697 | |
| 10698 | csrRoamDetermineMaxRateForAdHoc( pMac, &pSession->bssParams.operationalRateSet ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10699 | if (CSR_IS_INFRA_AP(pProfile)) |
| 10700 | { |
| 10701 | if(CSR_IS_CHANNEL_24GHZ(Channel)) |
| 10702 | { |
| 10703 | cbMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 10704 | } |
| 10705 | else |
| 10706 | { |
| 10707 | cbMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 10708 | } |
| 10709 | smsLog(pMac, LOG1, "##softap cbMode %d\n", cbMode); |
| 10710 | pBssConfig->cbMode = cbMode; |
| 10711 | pSession->bssParams.cbMode = cbMode; |
| 10712 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10713 | |
| 10714 | if( CSR_IS_START_IBSS( pProfile ) ) |
| 10715 | { |
| 10716 | //TBH: channel bonding is not supported for Libra |
| 10717 | if( pProfile->ChannelInfo.ChannelList && eCSR_OPERATING_CHANNEL_AUTO != pProfile->ChannelInfo.ChannelList[0] ) |
| 10718 | { |
| 10719 | Channel = pProfile->ChannelInfo.ChannelList[0]; |
| 10720 | cbChoice = pProfile->CBMode; |
| 10721 | } |
| 10722 | else { |
| 10723 | cbChoice = pMac->roam.configParam.cbChoice; |
| 10724 | } |
| 10725 | pSession->bssParams.operationChn = Channel; |
| 10726 | //make sure channel is valid |
| 10727 | if(!csrRoamIsChannelValid(pMac, Channel)) |
| 10728 | { |
| 10729 | //set Channel to 0 to let lim know this is invalid |
| 10730 | //We still send this request down to lim even though we know the channel is wrong because |
| 10731 | //lim will response with error and hdd's eWNI_SME_START_BSS_RSP handler will roam other profile (if any) |
| 10732 | Channel = 0; |
| 10733 | pSession->bssParams.operationChn = 0; |
| 10734 | } |
| 10735 | else { |
| 10736 | tANI_U32 ChannelBondingMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10737 | if(CSR_IS_CHANNEL_24GHZ(Channel)) |
| 10738 | { |
| 10739 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 10740 | } |
| 10741 | else |
| 10742 | { |
| 10743 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 10744 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10745 | //now we have a valid channel |
| 10746 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 10747 | { |
| 10748 | //let's pick a secondard channel |
| 10749 | SecondChn = csrRoamGetSecondaryChannel(pMac, Channel, cbChoice); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10750 | if(SecondChn > Channel) |
| 10751 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10752 | cbMode = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10753 | } |
| 10754 | else if(SecondChn && SecondChn < Channel) |
| 10755 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10756 | cbMode = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10757 | } |
| 10758 | else |
| 10759 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10760 | cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10761 | } |
| 10762 | pSession->bssParams.cbMode = cbMode; |
| 10763 | } |
| 10764 | else |
| 10765 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10766 | pSession->bssParams.cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10767 | } |
| 10768 | } |
| 10769 | } |
| 10770 | } |
| 10771 | } |
| 10772 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10773 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 10774 | tANI_BOOLEAN *pfSameIbss ) |
| 10775 | { |
| 10776 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10777 | tANI_BOOLEAN fSameIbss = FALSE; |
| 10778 | |
| 10779 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 10780 | { |
| 10781 | // Check if any profile parameter has changed ? If any profile parameter |
| 10782 | // has changed then stop old BSS and start a new one with new parameters |
| 10783 | if ( csrIsSameProfile( pMac, &pMac->roam.roamSession[sessionId].connectedProfile, pProfile ) ) |
| 10784 | { |
| 10785 | fSameIbss = TRUE; |
| 10786 | } |
| 10787 | else |
| 10788 | { |
| 10789 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 10790 | } |
| 10791 | } |
| 10792 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 10793 | { |
| 10794 | // Disassociate from the connected Infrastructure network... |
| 10795 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 10796 | } |
| 10797 | else |
| 10798 | { |
| 10799 | tBssConfigParam *pBssConfig; |
| 10800 | |
| 10801 | status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); |
| 10802 | if(HAL_STATUS_SUCCESS(status)) |
| 10803 | { |
| 10804 | palZeroMemory(pMac->hHdd, pBssConfig, sizeof(tBssConfigParam)); |
| 10805 | // there is no Bss description before we start an IBSS so we need to adopt |
| 10806 | // all Bss configuration parameters from the Profile. |
| 10807 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, pBssConfig, NULL); |
| 10808 | if(HAL_STATUS_SUCCESS(status)) |
| 10809 | { |
| 10810 | //save dotMode |
| 10811 | pMac->roam.roamSession[sessionId].bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
| 10812 | //Prepare some more parameters for this IBSS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10813 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10814 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
| 10815 | } |
| 10816 | |
| 10817 | palFreeMemory(pMac->hHdd, pBssConfig); |
| 10818 | }//Allocate memory |
| 10819 | } |
| 10820 | |
| 10821 | if(pfSameIbss) |
| 10822 | { |
| 10823 | *pfSameIbss = fSameIbss; |
| 10824 | } |
| 10825 | return( status ); |
| 10826 | } |
| 10827 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10828 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 10829 | tSirSmeNewBssInfo *pNewBss ) |
| 10830 | { |
| 10831 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10832 | |
| 10833 | if(!pSession) |
| 10834 | { |
| 10835 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10836 | return; |
| 10837 | } |
| 10838 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10839 | if( pNewBss ) |
| 10840 | { |
| 10841 | // Set the operating channel. |
| 10842 | pSession->connectedProfile.operationChannel = pNewBss->channelNumber; |
| 10843 | // move the BSSId from the BSS description into the connected state information. |
| 10844 | palCopyMemory( pMac->hHdd, &pSession->connectedProfile.bssid, |
| 10845 | &(pNewBss->bssId), sizeof( tCsrBssid ) ); |
| 10846 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10847 | return; |
| 10848 | } |
| 10849 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10850 | #ifdef FEATURE_WLAN_WAPI |
| 10851 | eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, |
| 10852 | tANI_U32 numItems ) |
| 10853 | { |
| 10854 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10855 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10856 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 10857 | { |
| 10858 | smsLog(pMac, LOGE, FL(" Invalid session ID\n")); |
| 10859 | return status; |
| 10860 | } |
| 10861 | smsLog(pMac, LOGW, "csrRoamSetBKIDCache called, numItems = %d\n", numItems); |
| 10862 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10863 | if(numItems <= CSR_MAX_BKID_ALLOWED) |
| 10864 | { |
| 10865 | status = eHAL_STATUS_SUCCESS; |
| 10866 | //numItems may be 0 to clear the cache |
| 10867 | pSession->NumBkidCache = (tANI_U16)numItems; |
| 10868 | if(numItems && pBKIDCache) |
| 10869 | { |
| 10870 | status = palCopyMemory( pMac->hHdd, pSession->BkidCacheInfo, pBKIDCache, |
| 10871 | sizeof(tBkidCacheInfo) * numItems ); |
| 10872 | } |
| 10873 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10874 | return (status); |
| 10875 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10876 | eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, |
| 10877 | tBkidCacheInfo *pBkidCache) |
| 10878 | { |
| 10879 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10880 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10881 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 10882 | { |
| 10883 | smsLog(pMac, LOGE, FL(" Invalid session ID\n")); |
| 10884 | return status; |
| 10885 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10886 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10887 | if(pNum && pBkidCache) |
| 10888 | { |
| 10889 | if(pSession->NumBkidCache == 0) |
| 10890 | { |
| 10891 | *pNum = 0; |
| 10892 | status = eHAL_STATUS_SUCCESS; |
| 10893 | } |
| 10894 | else if(*pNum >= pSession->NumBkidCache) |
| 10895 | { |
| 10896 | if(pSession->NumBkidCache > CSR_MAX_PMKID_ALLOWED) |
| 10897 | { |
| 10898 | smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED\n"), |
| 10899 | pSession->NumBkidCache); |
| 10900 | pSession->NumBkidCache = CSR_MAX_PMKID_ALLOWED; |
| 10901 | } |
| 10902 | palCopyMemory( pMac->hHdd, pBkidCache, pSession->BkidCacheInfo, |
| 10903 | sizeof(tBkidCacheInfo) * pSession->NumBkidCache ); |
| 10904 | *pNum = pSession->NumBkidCache; |
| 10905 | status = eHAL_STATUS_SUCCESS; |
| 10906 | } |
| 10907 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10908 | return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10909 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10910 | tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10911 | { |
| 10912 | return (pMac->roam.roamSession[sessionId].NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10913 | } |
| 10914 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10915 | eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 10916 | tPmkidCacheInfo *pPMKIDCache, tANI_U32 numItems ) |
| 10917 | { |
| 10918 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10919 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10920 | |
| 10921 | if(!pSession) |
| 10922 | { |
| 10923 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10924 | return eHAL_STATUS_FAILURE; |
| 10925 | } |
| 10926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10927 | smsLog(pMac, LOGW, "csrRoamSetPMKIDCache called, numItems = %d\n", numItems); |
| 10928 | if(numItems <= CSR_MAX_PMKID_ALLOWED) |
| 10929 | { |
| 10930 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10931 | { |
| 10932 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
| 10933 | palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type)); |
| 10934 | secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_UPDATE; |
| 10935 | secEvent.encryptionModeMulticast = |
| 10936 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 10937 | secEvent.encryptionModeUnicast = |
| 10938 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 10939 | palCopyMemory( pMac->hHdd, secEvent.bssid, pSession->connectedProfile.bssid, 6 ); |
| 10940 | secEvent.authMode = |
| 10941 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 10942 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 10943 | } |
| 10944 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10945 | status = eHAL_STATUS_SUCCESS; |
| 10946 | //numItems may be 0 to clear the cache |
| 10947 | pSession->NumPmkidCache = (tANI_U16)numItems; |
| 10948 | if(numItems && pPMKIDCache) |
| 10949 | { |
| 10950 | status = palCopyMemory( pMac->hHdd, pSession->PmkidCacheInfo, pPMKIDCache, |
| 10951 | sizeof(tPmkidCacheInfo) * numItems ); |
| 10952 | } |
| 10953 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10954 | return (status); |
| 10955 | } |
| 10956 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10957 | tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10958 | { |
| 10959 | return (pMac->roam.roamSession[sessionId].NumPmkidCache); |
| 10960 | } |
| 10961 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10962 | eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache) |
| 10963 | { |
| 10964 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 10965 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10966 | |
| 10967 | if(!pSession) |
| 10968 | { |
| 10969 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10970 | return eHAL_STATUS_FAILURE; |
| 10971 | } |
| 10972 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10973 | if(pNum && pPmkidCache) |
| 10974 | { |
| 10975 | if(pSession->NumPmkidCache == 0) |
| 10976 | { |
| 10977 | *pNum = 0; |
| 10978 | status = eHAL_STATUS_SUCCESS; |
| 10979 | } |
| 10980 | else if(*pNum >= pSession->NumPmkidCache) |
| 10981 | { |
| 10982 | if(pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED) |
| 10983 | { |
| 10984 | smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED\n"), |
| 10985 | pSession->NumPmkidCache); |
| 10986 | pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED; |
| 10987 | } |
| 10988 | palCopyMemory( pMac->hHdd, pPmkidCache, pSession->PmkidCacheInfo, |
| 10989 | sizeof(tPmkidCacheInfo) * pSession->NumPmkidCache ); |
| 10990 | *pNum = pSession->NumPmkidCache; |
| 10991 | status = eHAL_STATUS_SUCCESS; |
| 10992 | } |
| 10993 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10994 | return (status); |
| 10995 | } |
| 10996 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10997 | eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 10998 | { |
| 10999 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11000 | tANI_U32 len; |
| 11001 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11002 | |
| 11003 | if(!pSession) |
| 11004 | { |
| 11005 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11006 | return eHAL_STATUS_FAILURE; |
| 11007 | } |
| 11008 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11009 | if(pLen) |
| 11010 | { |
| 11011 | len = *pLen; |
| 11012 | *pLen = pSession->nWpaRsnReqIeLength; |
| 11013 | if(pBuf) |
| 11014 | { |
| 11015 | if(len >= pSession->nWpaRsnReqIeLength) |
| 11016 | { |
| 11017 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnReqIE, pSession->nWpaRsnReqIeLength); |
| 11018 | } |
| 11019 | } |
| 11020 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11021 | return (status); |
| 11022 | } |
| 11023 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11024 | eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11025 | { |
| 11026 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11027 | tANI_U32 len; |
| 11028 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11029 | |
| 11030 | if(!pSession) |
| 11031 | { |
| 11032 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11033 | return eHAL_STATUS_FAILURE; |
| 11034 | } |
| 11035 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11036 | if(pLen) |
| 11037 | { |
| 11038 | len = *pLen; |
| 11039 | *pLen = pSession->nWpaRsnRspIeLength; |
| 11040 | if(pBuf) |
| 11041 | { |
| 11042 | if(len >= pSession->nWpaRsnRspIeLength) |
| 11043 | { |
| 11044 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWpaRsnRspIE, pSession->nWpaRsnRspIeLength); |
| 11045 | } |
| 11046 | } |
| 11047 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11048 | return (status); |
| 11049 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11050 | #ifdef FEATURE_WLAN_WAPI |
| 11051 | eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11052 | { |
| 11053 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11054 | tANI_U32 len; |
| 11055 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11056 | |
| 11057 | if(!pSession) |
| 11058 | { |
| 11059 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11060 | return eHAL_STATUS_FAILURE; |
| 11061 | } |
| 11062 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11063 | if(pLen) |
| 11064 | { |
| 11065 | len = *pLen; |
| 11066 | *pLen = pSession->nWapiReqIeLength; |
| 11067 | if(pBuf) |
| 11068 | { |
| 11069 | if(len >= pSession->nWapiReqIeLength) |
| 11070 | { |
| 11071 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiReqIE, pSession->nWapiReqIeLength); |
| 11072 | } |
| 11073 | } |
| 11074 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11075 | return (status); |
| 11076 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11077 | eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11078 | { |
| 11079 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11080 | tANI_U32 len; |
| 11081 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11082 | |
| 11083 | if(!pSession) |
| 11084 | { |
| 11085 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11086 | return eHAL_STATUS_FAILURE; |
| 11087 | } |
| 11088 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11089 | if(pLen) |
| 11090 | { |
| 11091 | len = *pLen; |
| 11092 | *pLen = pSession->nWapiRspIeLength; |
| 11093 | if(pBuf) |
| 11094 | { |
| 11095 | if(len >= pSession->nWapiRspIeLength) |
| 11096 | { |
| 11097 | status = palCopyMemory(pMac->hHdd, pBuf, pSession->pWapiRspIE, pSession->nWapiRspIeLength); |
| 11098 | } |
| 11099 | } |
| 11100 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11101 | return (status); |
| 11102 | } |
| 11103 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11104 | eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11105 | { |
| 11106 | eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION; |
| 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 (retStatus); |
| 11113 | } |
| 11114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11115 | if(CSR_IS_ROAMING(pSession)) |
| 11116 | { |
| 11117 | retStatus = eCSR_ROAM_ROAMING_COMPLETION; |
| 11118 | pSession->fRoaming = eANI_BOOLEAN_FALSE; |
| 11119 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11120 | return (retStatus); |
| 11121 | } |
| 11122 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11123 | //This function remove the connected BSS from te cached scan result |
| 11124 | eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac, |
| 11125 | tCsrRoamConnectedProfile *pConnProfile) |
| 11126 | { |
| 11127 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 11128 | tCsrScanResultFilter *pScanFilter = NULL; |
| 11129 | tListElem *pEntry; |
| 11130 | tCsrScanResult *pResult; |
| 11131 | tDot11fBeaconIEs *pIes; |
| 11132 | tANI_BOOLEAN fMatch; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11133 | if(!(csrIsMacAddressZero(pMac, &pConnProfile->bssid) || |
| 11134 | csrIsMacAddressBroadcast(pMac, &pConnProfile->bssid))) |
| 11135 | { |
| 11136 | do |
| 11137 | { |
| 11138 | //Prepare the filter. Only fill in the necessary fields. Not all fields are needed |
| 11139 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter)); |
| 11140 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11141 | palZeroMemory(pMac->hHdd, pScanFilter, sizeof(tCsrScanResultFilter)); |
| 11142 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->BSSIDs.bssid, sizeof(tCsrBssid)); |
| 11143 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11144 | palCopyMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid, &pConnProfile->bssid, sizeof(tCsrBssid)); |
| 11145 | pScanFilter->BSSIDs.numOfBSSIDs = 1; |
| 11146 | if(!csrIsNULLSSID(pConnProfile->SSID.ssId, pConnProfile->SSID.length)) |
| 11147 | { |
| 11148 | status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter->SSIDs.SSIDList, sizeof(tCsrSSIDInfo)); |
| 11149 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11150 | palCopyMemory(pMac->hHdd, &pScanFilter->SSIDs.SSIDList[0].SSID, &pConnProfile->SSID, sizeof(tSirMacSSid)); |
| 11151 | } |
| 11152 | pScanFilter->authType.numEntries = 1; |
| 11153 | pScanFilter->authType.authType[0] = pConnProfile->AuthType; |
| 11154 | pScanFilter->BSSType = pConnProfile->BSSType; |
| 11155 | pScanFilter->EncryptionType.numEntries = 1; |
| 11156 | pScanFilter->EncryptionType.encryptionType[0] = pConnProfile->EncryptionType; |
| 11157 | pScanFilter->mcEncryptionType.numEntries = 1; |
| 11158 | pScanFilter->mcEncryptionType.encryptionType[0] = pConnProfile->mcEncryptionType; |
| 11159 | //We ignore the channel for now, BSSID should be enough |
| 11160 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 11161 | //Also ignore the following fields |
| 11162 | pScanFilter->uapsd_mask = 0; |
| 11163 | pScanFilter->bWPSAssociation = eANI_BOOLEAN_FALSE; |
| 11164 | pScanFilter->countryCode[0] = 0; |
| 11165 | pScanFilter->phyMode = eCSR_DOT11_MODE_TAURUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11166 | csrLLLock(&pMac->scan.scanResultList); |
| 11167 | pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK ); |
| 11168 | while( pEntry ) |
| 11169 | { |
| 11170 | pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link ); |
| 11171 | pIes = (tDot11fBeaconIEs *)( pResult->Result.pvIes ); |
| 11172 | fMatch = csrMatchBSS(pMac, &pResult->Result.BssDescriptor, |
| 11173 | pScanFilter, NULL, NULL, NULL, &pIes); |
| 11174 | //Release the IEs allocated by csrMatchBSS is needed |
| 11175 | if( !pResult->Result.pvIes ) |
| 11176 | { |
| 11177 | //need to free the IEs since it is allocated by csrMatchBSS |
| 11178 | palFreeMemory(pMac->hHdd, pIes); |
| 11179 | } |
| 11180 | if(fMatch) |
| 11181 | { |
| 11182 | //We found the one |
| 11183 | if( csrLLRemoveEntry(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK) ) |
| 11184 | { |
| 11185 | //Free the memory |
| 11186 | csrFreeScanResultEntry( pMac, pResult ); |
| 11187 | } |
| 11188 | break; |
| 11189 | } |
| 11190 | pEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK); |
| 11191 | }//while |
| 11192 | csrLLUnlock(&pMac->scan.scanResultList); |
| 11193 | }while(0); |
| 11194 | if(pScanFilter) |
| 11195 | { |
| 11196 | csrFreeScanFilter(pMac, pScanFilter); |
| 11197 | palFreeMemory(pMac->hHdd, pScanFilter); |
| 11198 | } |
| 11199 | } |
| 11200 | return (status); |
| 11201 | } |
| 11202 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11203 | //BT-AMP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11204 | eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId ) |
| 11205 | { |
| 11206 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11207 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11208 | for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 11209 | { |
| 11210 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 11211 | { |
| 11212 | if( csrIsConnStateIbss( pMac, sessionId ) || csrIsBTAMP( pMac, sessionId ) ) |
| 11213 | { |
| 11214 | //co-exist with IBSS or BT-AMP is not supported |
| 11215 | smsLog( pMac, LOGW, " BTAMP is not allowed due to IBSS/BT-AMP exist in session %d\n", sessionId ); |
| 11216 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 11217 | break; |
| 11218 | } |
| 11219 | if( csrIsConnStateInfra( pMac, sessionId ) ) |
| 11220 | { |
| 11221 | if( chnId && |
| 11222 | ( (tANI_U8)chnId != pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ) ) |
| 11223 | { |
| 11224 | smsLog( pMac, LOGW, " BTAMP is not allowed due to channel (%d) diff than infr channel (%d)\n", |
| 11225 | chnId, pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ); |
| 11226 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 11227 | break; |
| 11228 | } |
| 11229 | } |
| 11230 | } |
| 11231 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11232 | return ( status ); |
| 11233 | } |
| 11234 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11235 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ) |
| 11236 | { |
| 11237 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11238 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11239 | tBssConfigParam bssConfig; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11240 | |
| 11241 | if(!pSession) |
| 11242 | { |
| 11243 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11244 | return eHAL_STATUS_FAILURE; |
| 11245 | } |
| 11246 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11247 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 11248 | { |
| 11249 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 11250 | } |
| 11251 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 11252 | { |
| 11253 | // Disassociate from the connected Infrastructure network... |
| 11254 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 11255 | } |
| 11256 | else |
| 11257 | { |
| 11258 | #if defined(VOSS_ENABLED) |
| 11259 | //We don't expect Bt-AMP HDD not to disconnect the last connection first at this time. |
| 11260 | //Otherwise we need to add code to handle the |
| 11261 | //situation just like IBSS. Though for WDS station, we need to send disassoc to PE first then |
| 11262 | //send stop_bss to PE, before we can continue. |
| 11263 | VOS_ASSERT( !csrIsConnStateWds( pMac, sessionId ) ); |
| 11264 | #endif |
| 11265 | palZeroMemory(pMac->hHdd, &bssConfig, sizeof(tBssConfigParam)); |
| 11266 | /* Assume HDD provide bssid in profile */ |
| 11267 | palCopyMemory( pMac->hHdd, &pSession->bssParams.bssid, pProfile->BSSIDs.bssid[0], sizeof(tCsrBssid) ); |
| 11268 | // there is no Bss description before we start an WDS so we need |
| 11269 | // to adopt all Bss configuration parameters from the Profile. |
| 11270 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, &bssConfig, pBssDesc); |
| 11271 | if(HAL_STATUS_SUCCESS(status)) |
| 11272 | { |
| 11273 | //Save profile for late use |
| 11274 | csrFreeRoamProfile( pMac, sessionId ); |
| 11275 | if (HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, |
| 11276 | (void **)&pSession->pCurRoamProfile, |
| 11277 | sizeof(tCsrRoamProfile)))) |
| 11278 | { |
| 11279 | palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile)); |
| 11280 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile); |
| 11281 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11282 | //Prepare some more parameters for this WDS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11283 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11284 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
| 11285 | } |
| 11286 | } |
| 11287 | |
| 11288 | return( status ); |
| 11289 | } |
| 11290 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11291 | ////////////////////Mail box |
| 11292 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11293 | //pBuf is caller allocated memory point to &(tSirSmeJoinReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 11294 | //or &(tSirSmeReassocReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 11295 | static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, |
| 11296 | tSirBssDescription *pBssDescription, |
| 11297 | tANI_U8 *pBuf, tANI_U8 uapsdMask) |
| 11298 | { |
| 11299 | tCsrChannelSet channelGroup; |
| 11300 | tSirMacCapabilityInfo *pAP_capabilityInfo; |
| 11301 | tAniBool fTmp; |
| 11302 | tANI_BOOLEAN found = FALSE; |
| 11303 | tANI_U32 size = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11304 | tANI_S8 pwrLimit = 0; |
| 11305 | tANI_U16 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11306 | // plug in neighborhood occupancy info (i.e. BSSes on primary or secondary channels) |
| 11307 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundPri |
| 11308 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecDown |
| 11309 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecUp |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11310 | // 802.11h |
| 11311 | //We can do this because it is in HOST CPU order for now. |
| 11312 | pAP_capabilityInfo = (tSirMacCapabilityInfo *)&pBssDescription->capabilityInfo; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11313 | //tell the target AP my 11H capability only if both AP and STA support 11H and the channel being used is 11a |
| 11314 | if ( csrIs11hSupported( pMac ) && pAP_capabilityInfo->spectrumMgt && eSIR_11A_NW_TYPE == pBssDescription->nwType ) |
| 11315 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11316 | fTmp = (tAniBool)pal_cpu_to_be32(1); |
| 11317 | } |
| 11318 | else |
| 11319 | fTmp = (tAniBool)0; |
| 11320 | |
| 11321 | // corresponds to --- pMsg->spectrumMgtIndicator = ON; |
| 11322 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&fTmp, sizeof(tAniBool) ); |
| 11323 | pBuf += sizeof(tAniBool); |
| 11324 | *pBuf++ = MIN_STA_PWR_CAP_DBM; // it is for pMsg->powerCap.minTxPower = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11325 | found = csrSearchChannelListForTxPower(pMac, pBssDescription, &channelGroup); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11326 | // This is required for 11k test VoWiFi Ent: Test 2. |
| 11327 | // We need the power capabilities for Assoc Req. |
| 11328 | // This macro is provided by the halPhyCfg.h. We pick our |
| 11329 | // max and min capability by the halPhy provided macros |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11330 | pwrLimit = csrGetCfgMaxTxPower (pMac, pBssDescription->channelId); |
| 11331 | if (0 != pwrLimit) |
| 11332 | { |
| 11333 | *pBuf++ = pwrLimit; |
| 11334 | } |
| 11335 | else |
| 11336 | { |
| 11337 | *pBuf++ = MAX_STA_PWR_CAP_DBM; |
| 11338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11339 | size = sizeof(pMac->roam.validChannelList); |
| 11340 | if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size))) |
| 11341 | { |
| 11342 | *pBuf++ = (tANI_U8)size; //tSirSupChnl->numChnl |
| 11343 | for ( i = 0; i < size; i++) |
| 11344 | { |
| 11345 | *pBuf++ = pMac->roam.validChannelList[ i ]; //tSirSupChnl->channelList[ i ] |
| 11346 | |
| 11347 | } |
| 11348 | } |
| 11349 | else |
| 11350 | { |
| 11351 | smsLog(pMac, LOGE, FL("can not find any valid channel\n")); |
| 11352 | *pBuf++ = 0; //tSirSupChnl->numChnl |
| 11353 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11354 | //Check whether it is ok to enter UAPSD |
| 11355 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 11356 | if( btcIsReadyForUapsd(pMac) ) |
| 11357 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 11358 | { |
| 11359 | *pBuf++ = uapsdMask; |
| 11360 | } |
| 11361 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 11362 | else |
| 11363 | { |
| 11364 | smsLog(pMac, LOGE, FL(" BTC doesn't allow UAPSD for uapsd_mask(0x%X)\n"), uapsdMask); |
| 11365 | *pBuf++ = 0; |
| 11366 | } |
| 11367 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 11368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11369 | // move the entire BssDescription into the join request. |
| 11370 | palCopyMemory( pMac->hHdd, pBuf, pBssDescription, |
| 11371 | pBssDescription->length + sizeof( pBssDescription->length ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11372 | pBuf += pBssDescription->length + sizeof( pBssDescription->length ); // update to new location |
| 11373 | } |
| 11374 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11375 | /* |
| 11376 | * The communication between HDD and LIM is thru mailbox (MB). |
| 11377 | * Both sides will access the data structure "tSirSmeJoinReq". |
| 11378 | * The rule is, while the components of "tSirSmeJoinReq" can be accessed in the regular way like tSirSmeJoinReq.assocType, this guideline |
| 11379 | * stops at component tSirRSNie; any acces to the components after tSirRSNie is forbidden because the space from tSirRSNie is quueezed |
| 11380 | * with the component "tSirBssDescription". And since the size of actual 'tSirBssDescription' varies, the receiving side (which is the routine |
| 11381 | * limJoinReqSerDes() of limSerDesUtils.cc) should keep in mind not to access the components DIRECTLY after tSirRSNie. |
| 11382 | */ |
| 11383 | eHalStatus csrSendJoinReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11384 | tCsrRoamProfile *pProfile, tDot11fBeaconIEs *pIes, tANI_U16 messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11385 | { |
| 11386 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11387 | tSirSmeJoinReq *pMsg; |
| 11388 | tANI_U8 *pBuf; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11389 | v_U8_t acm_mask = 0, uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11390 | tANI_U16 msgLen, wTmp, ieLen; |
| 11391 | tSirMacRateSet OpRateSet; |
| 11392 | tSirMacRateSet ExRateSet; |
| 11393 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11394 | tANI_U32 dwTmp; |
| 11395 | 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] | 11396 | |
| 11397 | if(!pSession) |
| 11398 | { |
| 11399 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11400 | return eHAL_STATUS_FAILURE; |
| 11401 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11402 | /* To satisfy klockworks */ |
| 11403 | if (NULL == pBssDescription) |
| 11404 | { |
| 11405 | smsLog(pMac, LOGE, FL(" pBssDescription is NULL\n")); |
| 11406 | return eHAL_STATUS_FAILURE; |
| 11407 | } |
| 11408 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11409 | do { |
| 11410 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 11411 | pSession->joinFailStatusCode.reasonCode = 0; |
| 11412 | // There are a number of variable length fields to consider. First, the tSirSmeJoinReq |
| 11413 | // includes a single bssDescription. bssDescription includes a single tANI_U32 for the |
| 11414 | // IE fields, but the length field in the bssDescription needs to be interpreted to |
| 11415 | // determine length of the IE fields. |
| 11416 | // |
| 11417 | // So, take the size of the JoinReq, subtract the size of the bssDescription and |
| 11418 | // add in the length from the bssDescription (then add the size of the 'length' field |
| 11419 | // itself because that is NOT included in the length field). |
| 11420 | msgLen = sizeof( tSirSmeJoinReq ) - sizeof( *pBssDescription ) + |
| 11421 | pBssDescription->length + sizeof( pBssDescription->length ) + |
| 11422 | 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] | 11423 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 11424 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11425 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11426 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)messageType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11427 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 11428 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11429 | // sessionId |
| 11430 | *pBuf = (tANI_U8)sessionId; |
| 11431 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11432 | // transactionId |
| 11433 | *pBuf = 0; |
| 11434 | *( pBuf + 1 ) = 0; |
| 11435 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11436 | // ssId |
| 11437 | if( pIes->SSID.present && pIes->SSID.num_ssid ) |
| 11438 | { |
| 11439 | // ssId len |
| 11440 | *pBuf = pIes->SSID.num_ssid; |
| 11441 | pBuf++; |
| 11442 | palCopyMemory( pMac->hHdd, pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid ); |
| 11443 | pBuf += pIes->SSID.num_ssid; |
| 11444 | } |
| 11445 | else |
| 11446 | { |
| 11447 | *pBuf = 0; |
| 11448 | pBuf++; |
| 11449 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11450 | // selfMacAddr |
| 11451 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 11452 | pBuf += sizeof(tSirMacAddr); |
| 11453 | // bsstype |
| 11454 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) ); |
| 11455 | if (dwTmp == eSIR_BTAMP_STA_MODE) dwTmp = eSIR_BTAMP_AP_MODE; // Override BssType for BTAMP |
| 11456 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 11457 | pBuf += sizeof(tSirBssType); |
| 11458 | // dot11mode |
| 11459 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode ); |
| 11460 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11461 | //Persona |
| 11462 | *pBuf = (tANI_U8)pProfile->csrPersona; |
| 11463 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11464 | //CBMode |
| 11465 | *pBuf = (tANI_U8)pSession->bssParams.cbMode; |
| 11466 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11467 | |
| 11468 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11469 | FL("CSR PERSONA=%d CSR CbMode %d"), pProfile->csrPersona, pSession->bssParams.cbMode); |
| 11470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11471 | // uapsdPerAcBitmask |
| 11472 | *pBuf = pProfile->uapsd_mask; |
| 11473 | pBuf++; |
| 11474 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11475 | |
| 11476 | |
| 11477 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11478 | #endif /*(WNI_POLARIS_FW_PACKAGE == ADVANCED)*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11479 | status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11480 | if (HAL_STATUS_SUCCESS(status) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11481 | { |
| 11482 | // OperationalRateSet |
| 11483 | if (OpRateSet.numRates) { |
| 11484 | *pBuf++ = OpRateSet.numRates; |
| 11485 | palCopyMemory(pMac->hHdd, pBuf, OpRateSet.rate, OpRateSet.numRates); |
| 11486 | pBuf += OpRateSet.numRates; |
| 11487 | } else *pBuf++ = 0; |
| 11488 | // ExtendedRateSet |
| 11489 | if (ExRateSet.numRates) { |
| 11490 | *pBuf++ = ExRateSet.numRates; |
| 11491 | palCopyMemory(pMac->hHdd, pBuf, ExRateSet.rate, ExRateSet.numRates); |
| 11492 | pBuf += ExRateSet.numRates; |
| 11493 | } else *pBuf++ = 0; |
| 11494 | } |
| 11495 | else |
| 11496 | { |
| 11497 | *pBuf++ = 0; |
| 11498 | *pBuf++ = 0; |
| 11499 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11500 | // rsnIE |
| 11501 | if ( csrIsProfileWpa( pProfile ) ) |
| 11502 | { |
| 11503 | // Insert the Wpa IE into the join request |
| 11504 | ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes, |
| 11505 | (tCsrWpaIe *)( wpaRsnIE ) ); |
| 11506 | } |
| 11507 | else if( csrIsProfileRSN( pProfile ) ) |
| 11508 | { |
| 11509 | // Insert the RSN IE into the join request |
| 11510 | ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 11511 | (tCsrRSNIe *)( wpaRsnIE ) ); |
| 11512 | } |
| 11513 | #ifdef FEATURE_WLAN_WAPI |
| 11514 | else if( csrIsProfileWapi( pProfile ) ) |
| 11515 | { |
| 11516 | // Insert the WAPI IE into the join request |
| 11517 | ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 11518 | (tCsrWapiIe *)( wpaRsnIE ) ); |
| 11519 | } |
| 11520 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11521 | else |
| 11522 | { |
| 11523 | ieLen = 0; |
| 11524 | } |
| 11525 | //remember the IE for future use |
| 11526 | if( ieLen ) |
| 11527 | { |
| 11528 | if(ieLen > DOT11F_IE_RSN_MAX_LEN) |
| 11529 | { |
| 11530 | smsLog(pMac, LOGE, FL(" WPA RSN IE length :%d is more than DOT11F_IE_RSN_MAX_LEN, resetting to %d\n"), ieLen, DOT11F_IE_RSN_MAX_LEN); |
| 11531 | ieLen = DOT11F_IE_RSN_MAX_LEN; |
| 11532 | } |
| 11533 | #ifdef FEATURE_WLAN_WAPI |
| 11534 | if( csrIsProfileWapi( pProfile ) ) |
| 11535 | { |
| 11536 | //Check whether we need to allocate more memory |
| 11537 | if(ieLen > pSession->nWapiReqIeLength) |
| 11538 | { |
| 11539 | if(pSession->pWapiReqIE && pSession->nWapiReqIeLength) |
| 11540 | { |
| 11541 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 11542 | } |
| 11543 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWapiReqIE, ieLen); |
| 11544 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11545 | } |
| 11546 | pSession->nWapiReqIeLength = ieLen; |
| 11547 | palCopyMemory(pMac->hHdd, pSession->pWapiReqIE, wpaRsnIE, ieLen); |
| 11548 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11549 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11550 | pBuf += sizeof(tANI_U16); |
| 11551 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11552 | pBuf += ieLen; |
| 11553 | } |
| 11554 | else//should be WPA/WPA2 otherwise |
| 11555 | #endif /* FEATURE_WLAN_WAPI */ |
| 11556 | { |
| 11557 | //Check whether we need to allocate more memory |
| 11558 | if(ieLen > pSession->nWpaRsnReqIeLength) |
| 11559 | { |
| 11560 | if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength) |
| 11561 | { |
| 11562 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 11563 | } |
| 11564 | status = palAllocateMemory(pMac->hHdd, (void **)&pSession->pWpaRsnReqIE, ieLen); |
| 11565 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11566 | } |
| 11567 | pSession->nWpaRsnReqIeLength = ieLen; |
| 11568 | palCopyMemory(pMac->hHdd, pSession->pWpaRsnReqIE, wpaRsnIE, ieLen); |
| 11569 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11570 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11571 | pBuf += sizeof(tANI_U16); |
| 11572 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11573 | pBuf += ieLen; |
| 11574 | } |
| 11575 | } |
| 11576 | else |
| 11577 | { |
| 11578 | //free whatever old info |
| 11579 | pSession->nWpaRsnReqIeLength = 0; |
| 11580 | if(pSession->pWpaRsnReqIE) |
| 11581 | { |
| 11582 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 11583 | pSession->pWpaRsnReqIE = NULL; |
| 11584 | } |
| 11585 | #ifdef FEATURE_WLAN_WAPI |
| 11586 | pSession->nWapiReqIeLength = 0; |
| 11587 | if(pSession->pWapiReqIE) |
| 11588 | { |
| 11589 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 11590 | pSession->pWapiReqIE = NULL; |
| 11591 | } |
| 11592 | #endif /* FEATURE_WLAN_WAPI */ |
| 11593 | //length is two bytes |
| 11594 | *pBuf = 0; |
| 11595 | *(pBuf + 1) = 0; |
| 11596 | pBuf += 2; |
| 11597 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11598 | #ifdef FEATURE_WLAN_CCX |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11599 | if( eWNI_SME_JOIN_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11600 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11601 | // Never include the cckmIE in an Join Request |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11602 | //length is two bytes |
| 11603 | *pBuf = 0; |
| 11604 | *(pBuf + 1) = 0; |
| 11605 | pBuf += 2; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11606 | } |
| 11607 | else if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11608 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11609 | // cckmIE |
| 11610 | if( csrIsProfileCCX( pProfile ) ) |
| 11611 | { |
| 11612 | // Insert the CCKM IE into the join request |
| 11613 | ieLen = csrConstructCcxCckmIe( pMac, |
| 11614 | pSession, |
| 11615 | pProfile, |
| 11616 | pBssDescription, |
| 11617 | pSession->pWpaRsnReqIE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11618 | pSession->nWpaRsnReqIeLength, |
| 11619 | (void *)( wpaRsnIE ) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11620 | } |
| 11621 | else |
| 11622 | { |
| 11623 | ieLen = 0; |
| 11624 | } |
| 11625 | //If present, copy the IE into the eWNI_SME_REASSOC_REQ message buffer |
| 11626 | if( ieLen ) |
| 11627 | { |
| 11628 | //Copy the CCKM IE over from the temp buffer (wpaRsnIE) |
| 11629 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11630 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11631 | pBuf += sizeof(tANI_U16); |
| 11632 | palCopyMemory( pMac->hHdd, pBuf, wpaRsnIE, ieLen ); |
| 11633 | pBuf += ieLen; |
| 11634 | } |
| 11635 | else |
| 11636 | { |
| 11637 | //Indicate you have no CCKM IE |
| 11638 | //length is two bytes |
| 11639 | *pBuf = 0; |
| 11640 | *(pBuf + 1) = 0; |
| 11641 | pBuf += 2; |
| 11642 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11643 | } |
| 11644 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11645 | // addIEScan |
| 11646 | if(pProfile->nAddIEScanLength && pProfile->pAddIEScan) |
| 11647 | { |
| 11648 | ieLen = pProfile->nAddIEScanLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11649 | if(ieLen > pSession->nAddIEScanLength) |
| 11650 | { |
| 11651 | if(pSession->pAddIEScan && pSession->nAddIEScanLength) |
| 11652 | { |
| 11653 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 11654 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11655 | status = palAllocateMemory(pMac->hHdd, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11656 | (void **)&pSession->pAddIEScan, ieLen); |
| 11657 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11658 | } |
| 11659 | pSession->nAddIEScanLength = ieLen; |
| 11660 | palCopyMemory(pMac->hHdd, pSession->pAddIEScan, |
| 11661 | pProfile->pAddIEScan, ieLen); |
| 11662 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11663 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11664 | pBuf += sizeof(tANI_U16); |
| 11665 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEScan, ieLen ); |
| 11666 | pBuf += ieLen; |
| 11667 | } |
| 11668 | else |
| 11669 | { |
| 11670 | pSession->nAddIEScanLength = 0; |
| 11671 | if(pSession->pAddIEScan) |
| 11672 | { |
| 11673 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 11674 | pSession->pAddIEScan = NULL; |
| 11675 | } |
| 11676 | *pBuf = 0; |
| 11677 | *(pBuf + 1) = 0; |
| 11678 | pBuf += 2; |
| 11679 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11680 | // addIEAssoc |
| 11681 | if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc) |
| 11682 | { |
| 11683 | ieLen = pProfile->nAddIEAssocLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11684 | if(ieLen > pSession->nAddIEAssocLength) |
| 11685 | { |
| 11686 | if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength) |
| 11687 | { |
| 11688 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 11689 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11690 | status = palAllocateMemory(pMac->hHdd, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11691 | (void **)&pSession->pAddIEAssoc, ieLen); |
| 11692 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 11693 | } |
| 11694 | pSession->nAddIEAssocLength = ieLen; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11695 | palCopyMemory(pMac->hHdd, pSession->pAddIEAssoc, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11696 | pProfile->pAddIEAssoc, ieLen); |
| 11697 | wTmp = pal_cpu_to_be16( ieLen ); |
| 11698 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11699 | pBuf += sizeof(tANI_U16); |
| 11700 | palCopyMemory( pMac->hHdd, pBuf, pProfile->pAddIEAssoc, ieLen ); |
| 11701 | pBuf += ieLen; |
| 11702 | } |
| 11703 | else |
| 11704 | { |
| 11705 | pSession->nAddIEAssocLength = 0; |
| 11706 | if(pSession->pAddIEAssoc) |
| 11707 | { |
| 11708 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 11709 | pSession->pAddIEAssoc = NULL; |
| 11710 | } |
| 11711 | *pBuf = 0; |
| 11712 | *(pBuf + 1) = 0; |
| 11713 | pBuf += 2; |
| 11714 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11715 | |
| 11716 | if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11717 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11718 | //Unmask any AC in reassoc that is ACM-set |
| 11719 | uapsd_mask = (v_U8_t)pProfile->uapsd_mask; |
| 11720 | if( uapsd_mask && ( NULL != pBssDescription ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11721 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11722 | if( CSR_IS_QOS_BSS(pIes) && CSR_IS_UAPSD_BSS(pIes) ) |
| 11723 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11724 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11725 | acm_mask = sme_QosGetACMMask(pMac, pBssDescription, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11726 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11727 | uapsd_mask &= ~(acm_mask); |
| 11728 | } |
| 11729 | else |
| 11730 | { |
| 11731 | uapsd_mask = 0; |
| 11732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11733 | } |
| 11734 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11735 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11736 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) ); |
| 11737 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11738 | pBuf += sizeof(tANI_U32); |
| 11739 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11740 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) ); |
| 11741 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11742 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11743 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11744 | pProfile->MDID.mdiePresent = pBssDescription->mdiePresent; |
| 11745 | if (csrIsProfile11r( pProfile ) ) |
| 11746 | { |
| 11747 | // is11Rconnection; |
| 11748 | dwTmp = pal_cpu_to_be32(TRUE); |
| 11749 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11750 | pBuf += sizeof(tAniBool); |
| 11751 | } |
| 11752 | else |
| 11753 | { |
| 11754 | // is11Rconnection; |
| 11755 | dwTmp = pal_cpu_to_be32(FALSE); |
| 11756 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11757 | pBuf += sizeof(tAniBool); |
| 11758 | } |
| 11759 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11760 | #ifdef FEATURE_WLAN_CCX |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11761 | /* A profile can not be both CCX and 11R. But an 802.11R AP |
| 11762 | * may be advertising support for CCX as well. So if we are |
| 11763 | * associating Open or explicitly CCX then we will get CCX. |
| 11764 | * If we are associating explictly 11R only then we will get |
| 11765 | * 11R. |
| 11766 | */ |
| 11767 | if ((csrIsProfileCCX(pProfile) || |
| 11768 | ((pIes->CCXVersion.present) |
| 11769 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11770 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 11771 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 11772 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11773 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
| 11774 | && (!(csrIsProfile11r( pProfile ))) |
| 11775 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
| 11776 | { |
| 11777 | // isCCXconnection; |
| 11778 | dwTmp = pal_cpu_to_be32(TRUE); |
| 11779 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11780 | pBuf += sizeof(tAniBool); |
| 11781 | } |
| 11782 | else |
| 11783 | { |
| 11784 | //isCCXconnection; |
| 11785 | dwTmp = pal_cpu_to_be32(FALSE); |
| 11786 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
| 11787 | pBuf += sizeof(tAniBool); |
| 11788 | } |
| 11789 | |
| 11790 | if (eWNI_SME_JOIN_REQ == messageType) |
| 11791 | { |
| 11792 | tCCXTspecInfo ccxTspec; |
| 11793 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 11794 | // so nullify the TSPEC parameters |
| 11795 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11796 | palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11797 | pBuf += sizeof(tCCXTspecInfo); |
| 11798 | } |
| 11799 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 11800 | { |
| 11801 | if ((csrIsProfileCCX(pProfile) || |
| 11802 | ((pIes->CCXVersion.present) |
| 11803 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11804 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 11805 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 11806 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11807 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
| 11808 | && (!(csrIsProfile11r( pProfile ))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11809 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11810 | { |
| 11811 | tCCXTspecInfo ccxTspec; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11812 | // CCX Tspec information |
| 11813 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11814 | ccxTspec.numTspecs = sme_QosCCxRetrieveTspecInfo(pMac, sessionId, (tTspecInfo *) &ccxTspec.tspec[0]); |
| 11815 | *pBuf = ccxTspec.numTspecs; |
| 11816 | pBuf += sizeof(tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11817 | // Copy the TSPEC information only if present |
| 11818 | if (ccxTspec.numTspecs) { |
| 11819 | palCopyMemory(pMac->hHdd, pBuf, (void*)&ccxTspec.tspec[0], (ccxTspec.numTspecs*sizeof(tTspecInfo))); |
| 11820 | } |
| 11821 | pBuf += sizeof(ccxTspec.tspec); |
| 11822 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11823 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11824 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11825 | tCCXTspecInfo ccxTspec; |
| 11826 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 11827 | // so nullify the TSPEC parameters |
| 11828 | palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11829 | palCopyMemory( pMac->hHdd, pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
| 11830 | pBuf += sizeof(tCCXTspecInfo); |
| 11831 | } |
| 11832 | } |
| 11833 | #endif // FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11834 | #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] | 11835 | // Fill in isFastTransitionEnabled |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11836 | if (pMac->roam.configParam.isFastTransitionEnabled |
| 11837 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 11838 | || csrRoamIsFastRoamEnabled(pMac, sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11839 | #endif |
| 11840 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11841 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11842 | dwTmp = pal_cpu_to_be32(TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11843 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11844 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11845 | } |
| 11846 | else |
| 11847 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11848 | dwTmp = pal_cpu_to_be32(FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11849 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11850 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11851 | } |
| 11852 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 11853 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 11854 | if(csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 11855 | { |
| 11856 | //legacy fast roaming enabled |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11857 | dwTmp = pal_cpu_to_be32(TRUE); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 11858 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11859 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 11860 | } |
| 11861 | else |
| 11862 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11863 | dwTmp = pal_cpu_to_be32(FALSE); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 11864 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) ); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11865 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 11866 | } |
| 11867 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11868 | |
| 11869 | // txLdpcIniFeatureEnabled |
| 11870 | *pBuf = (tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 11871 | pBuf++; |
| 11872 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11873 | if ((csrIs11hSupported (pMac)) && (CSR_IS_CHANNEL_5GHZ(pBssDescription->channelId)) && |
| 11874 | (pIes->Country.present) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)) |
| 11875 | { |
| 11876 | csrSaveToChannelPower2G_5G( pMac, pIes->Country.num_triplets * sizeof(tSirMacChanInfo), |
| 11877 | (tSirMacChanInfo *)(&pIes->Country.triplets[0]) ); |
| 11878 | csrApplyPower2Current(pMac); |
| 11879 | } |
| 11880 | |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 11881 | #ifdef WLAN_FEATURE_11AC |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11882 | // txBFIniFeatureEnabled |
| 11883 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFEnable; |
| 11884 | pBuf++; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 11885 | |
| 11886 | // txBFCsnValue |
| 11887 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFCsnValue; |
| 11888 | pBuf++; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 11889 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11890 | //BssDesc |
| 11891 | csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, |
| 11892 | (tANI_U8)pProfile->uapsd_mask); |
| 11893 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 11894 | if(!HAL_STATUS_SUCCESS(status)) |
| 11895 | { |
| 11896 | break; |
| 11897 | } |
| 11898 | else |
| 11899 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11900 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11901 | if (eWNI_SME_JOIN_REQ == messageType) |
| 11902 | { |
| 11903 | //Tush-QoS: notify QoS module that join happening |
| 11904 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_JOIN_REQ, NULL); |
| 11905 | } |
| 11906 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 11907 | { |
| 11908 | //Tush-QoS: notify QoS module that reassoc happening |
| 11909 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_REASSOC_REQ, NULL); |
| 11910 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11911 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 11912 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11913 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11914 | return( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11915 | } |
| 11916 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11917 | // |
| 11918 | eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 11919 | { |
| 11920 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11921 | tSirSmeDisassocReq *pMsg; |
| 11922 | tANI_U8 *pBuf; |
| 11923 | tANI_U16 wTmp; |
| 11924 | #ifdef WLAN_SOFTAP_FEATURE |
| 11925 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11926 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11927 | return eHAL_STATUS_FAILURE; |
| 11928 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11929 | do { |
| 11930 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocReq )); |
| 11931 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 11932 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocReq )); |
| 11933 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_REQ); |
| 11934 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11935 | pBuf = &pMsg->sessionId; |
| 11936 | // sessionId |
| 11937 | *pBuf++ = (tANI_U8)sessionId; |
| 11938 | // transactionId |
| 11939 | *pBuf = 0; |
| 11940 | *( pBuf + 1 ) = 0; |
| 11941 | pBuf += sizeof(tANI_U16); |
| 11942 | |
| 11943 | #ifdef WLAN_SOFTAP_FEATURE |
| 11944 | if ( (pSession->pCurRoamProfile != NULL ) && |
| 11945 | ( reasonCode == eSIR_MAC_UNSPEC_FAILURE_REASON ) && |
| 11946 | ((CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))) |
| 11947 | { |
| 11948 | // Set the bssid address before sending the message to LIM |
| 11949 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( tSirMacAddr ) ); |
| 11950 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11951 | // Set the peer MAC address before sending the message to LIM |
| 11952 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); //perMacAddr is passed as bssId for softAP |
| 11953 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 11954 | } |
| 11955 | else |
| 11956 | { |
| 11957 | #endif |
| 11958 | // Set the peer MAC address before sending the message to LIM |
| 11959 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); |
| 11960 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11961 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->bssId ) ); |
| 11962 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 11963 | #ifdef WLAN_SOFTAP_FEATURE |
| 11964 | } |
| 11965 | #endif |
| 11966 | if(!HAL_STATUS_SUCCESS(status)) |
| 11967 | { |
| 11968 | palFreeMemory(pMac->hHdd, pMsg); |
| 11969 | break; |
| 11970 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11971 | // reasonCode |
| 11972 | wTmp = pal_cpu_to_be16(reasonCode); |
| 11973 | status = palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 11974 | if(!HAL_STATUS_SUCCESS(status)) |
| 11975 | { |
| 11976 | palFreeMemory(pMac->hHdd, pMsg); |
| 11977 | break; |
| 11978 | } |
| 11979 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11980 | /* The state will be DISASSOC_HANDOFF only when we are doing handoff. |
| 11981 | Here we should not send the disassoc over the air to the AP */ |
| 11982 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId) |
| 11983 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11984 | && csrRoamIs11rAssoc(pMac) |
| 11985 | #endif |
| 11986 | ) |
| 11987 | { |
| 11988 | *pBuf = CSR_DONT_SEND_DISASSOC_OVER_THE_AIR; /* Set DoNotSendOverTheAir flag to 1 only for handoff case */ |
| 11989 | } |
| 11990 | pBuf += sizeof(tANI_U8); |
| 11991 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11992 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11993 | return( status ); |
| 11994 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11995 | #ifdef WLAN_SOFTAP_FEATURE |
| 11996 | eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable, tSirMacAddr bssId ) |
| 11997 | { |
| 11998 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11999 | tSirSmeTkipCntrMeasReq *pMsg; |
| 12000 | tANI_U8 *pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12001 | do |
| 12002 | { |
| 12003 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeTkipCntrMeasReq )); |
| 12004 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12005 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeTkipCntrMeasReq )); |
| 12006 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_TKIP_CNTR_MEAS_REQ); |
| 12007 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeTkipCntrMeasReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12008 | pBuf = &pMsg->sessionId; |
| 12009 | // sessionId |
| 12010 | *pBuf++ = (tANI_U8)sessionId; |
| 12011 | // transactionId |
| 12012 | *pBuf = 0; |
| 12013 | *( pBuf + 1 ) = 0; |
| 12014 | pBuf += sizeof(tANI_U16); |
| 12015 | // bssid |
| 12016 | status = palCopyMemory( pMac->hHdd, pMsg->bssId, bssId, sizeof( tSirMacAddr ) ); |
| 12017 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 12018 | // bEnable |
| 12019 | *pBuf = (tANI_BOOLEAN)bEnable; |
| 12020 | if(!HAL_STATUS_SUCCESS(status)) |
| 12021 | { |
| 12022 | palFreeMemory(pMac->hHdd, pMsg); |
| 12023 | break; |
| 12024 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12025 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12026 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12027 | return( status ); |
| 12028 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12029 | eHalStatus |
| 12030 | csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12031 | VOS_MODULE_ID modId, tSirMacAddr bssId, |
| 12032 | void *pUsrContext, void *pfnSapEventCallback, |
| 12033 | tANI_U8 *pAssocStasBuf ) |
| 12034 | { |
| 12035 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12036 | tSirSmeGetAssocSTAsReq *pMsg; |
| 12037 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 12038 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12039 | do |
| 12040 | { |
| 12041 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeGetAssocSTAsReq ) ); |
| 12042 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12043 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetAssocSTAsReq ) ); |
| 12044 | 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] | 12045 | pBuf = (tANI_U8 *)&pMsg->bssId; |
| 12046 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12047 | // bssId |
| 12048 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) ); |
| 12049 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12050 | // modId |
| 12051 | dwTmp = pal_cpu_to_be16((tANI_U16)modId); |
| 12052 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U16)); |
| 12053 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12054 | // pUsrContext |
| 12055 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
| 12056 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12057 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12058 | // pfnSapEventCallback |
| 12059 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
| 12060 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12061 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12062 | // pAssocStasBuf |
| 12063 | dwTmp = pal_cpu_to_be32((tANI_U32)pAssocStasBuf); |
| 12064 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12065 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12066 | 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] | 12067 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12068 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12069 | return( status ); |
| 12070 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12071 | eHalStatus |
| 12072 | csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12073 | tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac) |
| 12074 | { |
| 12075 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12076 | tSirSmeGetWPSPBCSessionsReq *pMsg; |
| 12077 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 12078 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12079 | do |
| 12080 | { |
| 12081 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirSmeGetWPSPBCSessionsReq) ); |
| 12082 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12083 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetWPSPBCSessionsReq ) ); |
| 12084 | 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] | 12085 | pBuf = (tANI_U8 *)&pMsg->pUsrContext; |
| 12086 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12087 | // pUsrContext |
| 12088 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
| 12089 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12090 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12091 | // pSapEventCallback |
| 12092 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
| 12093 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12094 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12095 | // bssId |
| 12096 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) ); |
| 12097 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12098 | // MAC Address of STA in WPS session |
| 12099 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pRemoveMac.bytes, sizeof(v_MACADDR_t)); |
| 12100 | pBuf += sizeof(v_MACADDR_t); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12101 | 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] | 12102 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12103 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12104 | return( status ); |
| 12105 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 12106 | |
| 12107 | eHalStatus |
| 12108 | csrSendChngMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12109 | { |
| 12110 | tpSirChangeBIParams pMsg; |
| 12111 | tANI_U16 len = 0; |
| 12112 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12113 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12114 | |
| 12115 | if(!pSession) |
| 12116 | { |
| 12117 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12118 | return eHAL_STATUS_FAILURE; |
| 12119 | } |
| 12120 | |
| 12121 | //NO need to update the Beacon Params if update beacon parameter flag is not set |
| 12122 | if(!pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval ) |
| 12123 | return eHAL_STATUS_SUCCESS; |
| 12124 | |
| 12125 | pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE; |
| 12126 | |
| 12127 | /* Create the message and send to lim */ |
| 12128 | len = sizeof(tSirChangeBIParams); |
| 12129 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len ); |
| 12130 | if(HAL_STATUS_SUCCESS(status)) |
| 12131 | { |
| 12132 | palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirChangeBIParams) ); |
| 12133 | pMsg->messageType = eWNI_SME_CHNG_MCC_BEACON_INTERVAL; |
| 12134 | pMsg->length = len; |
| 12135 | |
| 12136 | // bssId |
| 12137 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 12138 | smsLog( pMac, LOG1, FL("CSR Attempting to change BI for Bssid= %02x-%02x-%02x-%02x-%02x-%02x "), |
| 12139 | pMsg->bssId[ 0 ], pMsg->bssId[ 1 ], pMsg->bssId[ 2 ], |
| 12140 | pMsg->bssId[ 3 ], pMsg->bssId[ 4 ], pMsg->bssId[ 5 ] ); |
| 12141 | pMsg->sessionId = sessionId; |
| 12142 | smsLog(pMac, LOG1, FL(" session %d BeaconInterval %d\n"), sessionId, pMac->roam.roamSession[sessionId].bssParams.beaconInterval); |
| 12143 | pMsg->beaconInterval = pMac->roam.roamSession[sessionId].bssParams.beaconInterval; |
| 12144 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 12145 | } |
| 12146 | return status; |
| 12147 | } |
| 12148 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12149 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12150 | eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 12151 | { |
| 12152 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12153 | tSirSmeDeauthReq *pMsg; |
| 12154 | tANI_U8 *pBuf; |
| 12155 | tANI_U16 wTmp; |
| 12156 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12157 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 12158 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12159 | do { |
| 12160 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthReq )); |
| 12161 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12162 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthReq )); |
| 12163 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_REQ); |
| 12164 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthReq )); |
| 12165 | //sessionId |
| 12166 | pBuf = &pMsg->sessionId; |
| 12167 | *pBuf++ = (tANI_U8)sessionId; |
| 12168 | |
| 12169 | //tansactionId |
| 12170 | *pBuf = 0; |
| 12171 | *(pBuf + 1 ) = 0; |
| 12172 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12173 | if ((pSession->pCurRoamProfile != NULL) && ( |
| 12174 | #ifdef WLAN_SOFTAP_FEATURE |
| 12175 | (CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
| 12176 | #endif |
| 12177 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))){ |
| 12178 | // Set the BSSID before sending the message to LIM |
| 12179 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( pMsg->peerMacAddr ) ); |
| 12180 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 12181 | } |
| 12182 | else |
| 12183 | { |
| 12184 | // Set the BSSID before sending the message to LIM |
| 12185 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 12186 | pBuf = pBuf + sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12187 | } |
| 12188 | if(!HAL_STATUS_SUCCESS(status)) |
| 12189 | { |
| 12190 | palFreeMemory(pMac->hHdd, pMsg); |
| 12191 | break; |
| 12192 | } |
| 12193 | // Set the peer MAC address before sending the message to LIM |
| 12194 | status = palCopyMemory( pMac->hHdd, (tSirMacAddr *) pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 12195 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 12196 | if(!HAL_STATUS_SUCCESS(status)) |
| 12197 | { |
| 12198 | palFreeMemory(pMac->hHdd, pMsg); |
| 12199 | break; |
| 12200 | } |
| 12201 | wTmp = pal_cpu_to_be16(reasonCode); |
| 12202 | status = palCopyMemory( pMac->hHdd, pBuf, &wTmp,sizeof( tANI_U16 ) ); |
| 12203 | if(!HAL_STATUS_SUCCESS(status)) |
| 12204 | { |
| 12205 | palFreeMemory(pMac->hHdd, pMsg); |
| 12206 | break; |
| 12207 | } |
| 12208 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12209 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12210 | return( status ); |
| 12211 | } |
| 12212 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12213 | eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd ) |
| 12214 | { |
| 12215 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12216 | tSirSmeDisassocCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12217 | do { |
| 12218 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocCnf )); |
| 12219 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12220 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocCnf )); |
| 12221 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_CNF); |
| 12222 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12223 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocCnf )); |
| 12224 | status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDisassocInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); |
| 12225 | if(!HAL_STATUS_SUCCESS(status)) |
| 12226 | { |
| 12227 | palFreeMemory(pMac->hHdd, pMsg); |
| 12228 | break; |
| 12229 | } |
| 12230 | //To test reconn |
| 12231 | status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDisassocInd->bssId, sizeof(pMsg->peerMacAddr)); |
| 12232 | if(!HAL_STATUS_SUCCESS(status)) |
| 12233 | { |
| 12234 | palFreeMemory(pMac->hHdd, pMsg); |
| 12235 | break; |
| 12236 | } |
| 12237 | //To test reconn ends |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12238 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12239 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12240 | return( status ); |
| 12241 | } |
| 12242 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12243 | eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd ) |
| 12244 | { |
| 12245 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12246 | tSirSmeDeauthCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12247 | do { |
| 12248 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthCnf )); |
| 12249 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12250 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDeauthCnf )); |
| 12251 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_CNF); |
| 12252 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12253 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthCnf )); |
| 12254 | status = palCopyMemory(pMac->hHdd, pMsg->bssId, pDeauthInd->bssId, sizeof(pMsg->bssId)); |
| 12255 | if(!HAL_STATUS_SUCCESS(status)) |
| 12256 | { |
| 12257 | palFreeMemory(pMac->hHdd, pMsg); |
| 12258 | break; |
| 12259 | } |
| 12260 | status = palCopyMemory(pMac->hHdd, pMsg->peerMacAddr, pDeauthInd->peerMacAddr, sizeof(pMsg->peerMacAddr)); |
| 12261 | if(!HAL_STATUS_SUCCESS(status)) |
| 12262 | { |
| 12263 | palFreeMemory(pMac->hHdd, pMsg); |
| 12264 | break; |
| 12265 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12266 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12267 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12268 | return( status ); |
| 12269 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12270 | eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus ) |
| 12271 | { |
| 12272 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12273 | tSirSmeAssocCnf *pMsg; |
| 12274 | tANI_U8 *pBuf; |
| 12275 | tSirResultCodes statusCode; |
| 12276 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12277 | do { |
| 12278 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocCnf )); |
| 12279 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12280 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocCnf )); |
| 12281 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ASSOC_CNF); |
| 12282 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocCnf )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12283 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 12284 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 12285 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12286 | else |
| 12287 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
| 12288 | palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) ); |
| 12289 | pBuf += sizeof(tSirResultCodes); |
| 12290 | // bssId |
| 12291 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12292 | pBuf += sizeof (tSirMacAddr); |
| 12293 | // peerMacAddr |
| 12294 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 12295 | pBuf += sizeof (tSirMacAddr); |
| 12296 | // aid |
| 12297 | wTmp = pal_cpu_to_be16(pAssocInd->aid); |
| 12298 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12299 | pBuf += sizeof (tANI_U16); |
| 12300 | // alternateBssId |
| 12301 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12302 | pBuf += sizeof (tSirMacAddr); |
| 12303 | // alternateChannelId |
| 12304 | *pBuf = 11; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12305 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12306 | if(!HAL_STATUS_SUCCESS(status)) |
| 12307 | { |
| 12308 | //pMsg is freed by palSendMBMessage |
| 12309 | break; |
| 12310 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12311 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12312 | return( status ); |
| 12313 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12314 | #ifdef WLAN_SOFTAP_FEATURE |
| 12315 | eHalStatus csrSendAssocIndToUpperLayerCnfMsg( tpAniSirGlobal pMac, |
| 12316 | tpSirSmeAssocInd pAssocInd, |
| 12317 | eHalStatus Halstatus, |
| 12318 | tANI_U8 sessionId) |
| 12319 | { |
| 12320 | tSirMsgQ msgQ; |
| 12321 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12322 | tSirSmeAssocIndToUpperLayerCnf *pMsg; |
| 12323 | tANI_U8 *pBuf; |
| 12324 | tSirResultCodes statusCode; |
| 12325 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12326 | do { |
| 12327 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 12328 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12329 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12330 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12331 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPPER_LAYER_ASSOC_CNF); |
| 12332 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 12333 | |
| 12334 | pMsg->sessionId = sessionId; |
| 12335 | |
| 12336 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 12337 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 12338 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 12339 | else |
| 12340 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
| 12341 | palCopyMemory( pMac->hHdd, pBuf, &statusCode, sizeof(tSirResultCodes) ); |
| 12342 | pBuf += sizeof(tSirResultCodes); |
| 12343 | // bssId |
| 12344 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12345 | pBuf += sizeof (tSirMacAddr); |
| 12346 | // peerMacAddr |
| 12347 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 12348 | pBuf += sizeof (tSirMacAddr); |
| 12349 | // StaId |
| 12350 | wTmp = pal_cpu_to_be16(pAssocInd->staId); |
| 12351 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12352 | pBuf += sizeof (tANI_U16); |
| 12353 | // alternateBssId |
| 12354 | status = palCopyMemory(pMac->hHdd, (tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 12355 | pBuf += sizeof (tSirMacAddr); |
| 12356 | // alternateChannelId |
| 12357 | *pBuf = 11; |
| 12358 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12359 | // Instead of copying roam Info, we just copy only WmmEnabled , RsnIE information |
| 12360 | //Wmm |
| 12361 | *pBuf = pAssocInd->wmmEnabledSta; |
| 12362 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12363 | //RSN IE |
| 12364 | status = palCopyMemory(pMac->hHdd, (tSirRSNie *)pBuf, &pAssocInd->rsnIE, sizeof(tSirRSNie)); |
| 12365 | pBuf += sizeof (tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12366 | //Additional IE |
| 12367 | status = palCopyMemory(pMac->hHdd, (void *)pBuf, &pAssocInd->addIE, sizeof(tSirAddie)); |
| 12368 | pBuf += sizeof (tSirAddie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12369 | //reassocReq |
| 12370 | *pBuf = pAssocInd->reassocReq; |
| 12371 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12372 | msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF; |
| 12373 | msgQ.bodyptr = pMsg; |
| 12374 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12375 | SysProcessMmhMsg(pMac, &msgQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12376 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12377 | return( status ); |
| 12378 | } |
| 12379 | #endif |
| 12380 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12381 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId , |
| 12382 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 12383 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 12384 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 12385 | tANI_U8 *pKeyRsc ) |
| 12386 | { |
| 12387 | tSirSmeSetContextReq *pMsg; |
| 12388 | tANI_U16 msgLen; |
| 12389 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12390 | tAniEdType tmpEdType; |
| 12391 | tAniKeyDirection tmpDirection; |
| 12392 | tANI_U8 *pBuf; |
| 12393 | tANI_U8 *p; |
| 12394 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12395 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12396 | if( ( 1 != numKeys ) && ( 0 != numKeys ) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12397 | // all of these fields appear in every SET_CONTEXT message. Below we'll add in the size for each |
| 12398 | // key set. Since we only support upto one key, we always allocate memory for 1 key |
| 12399 | msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) + |
| 12400 | sizeof( tSirMacAddr ) + 1 + sizeof(tANI_U16) + |
| 12401 | sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + |
| 12402 | ( sizeof( pMsg->keyMaterial.key ) ); |
| 12403 | |
| 12404 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12405 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12406 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 12407 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SETCONTEXT_REQ); |
| 12408 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12409 | //sessionId |
| 12410 | pBuf = &pMsg->sessionId; |
| 12411 | *pBuf = (tANI_U8)sessionId; |
| 12412 | pBuf++; |
| 12413 | // transactionId |
| 12414 | *pBuf = 0; |
| 12415 | *(pBuf + 1) = 0; |
| 12416 | pBuf += sizeof(tANI_U16); |
| 12417 | // peerMacAddr |
| 12418 | palCopyMemory( pMac->hHdd, pBuf, |
| 12419 | (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr) ); |
| 12420 | |
| 12421 | pBuf += sizeof(tSirMacAddr); |
| 12422 | |
| 12423 | // bssId |
| 12424 | palCopyMemory( pMac->hHdd, pBuf, |
| 12425 | (tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 12426 | |
| 12427 | pBuf += sizeof(tSirMacAddr); |
| 12428 | |
| 12429 | p = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12430 | // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field |
| 12431 | // in the tSirKeyMaterial keyMaterial; field). |
| 12432 | // |
| 12433 | // !!NOTE: This keyMaterial.length contains the length of a MAX size key, though the keyLength can be |
| 12434 | // shorter than this max size. Is LIM interpreting this ok ? |
| 12435 | 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] | 12436 | // set pMsg->keyMaterial.edType |
| 12437 | tmpEdType = (tAniEdType)pal_cpu_to_be32(edType); |
| 12438 | palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType) ); |
| 12439 | p += sizeof( pMsg->keyMaterial.edType ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12440 | // set the pMsg->keyMaterial.numKeys field |
| 12441 | *p = numKeys; |
| 12442 | p += sizeof( pMsg->keyMaterial.numKeys ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12443 | // set pSirKey->keyId = keyId; |
| 12444 | *p = keyId; |
| 12445 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12446 | // set pSirKey->unicast = (tANI_U8)fUnicast; |
| 12447 | *p = (tANI_U8)fUnicast; |
| 12448 | p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12449 | // set pSirKey->keyDirection = aniKeyDirection; |
| 12450 | tmpDirection = (tAniKeyDirection)pal_cpu_to_be32(aniKeyDirection); |
| 12451 | palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection) ); |
| 12452 | p += sizeof(tAniKeyDirection); |
| 12453 | // pSirKey->keyRsc = ;; |
| 12454 | palCopyMemory( pMac->hHdd, p, pKeyRsc, CSR_MAX_RSC_LEN ); |
| 12455 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12456 | // set pSirKey->paeRole |
| 12457 | *p = paeRole; // 0 is Supplicant |
| 12458 | p++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12459 | // set pSirKey->keyLength = keyLength; |
| 12460 | p = pal_set_U16( p, pal_cpu_to_be16(keyLength) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12461 | if ( keyLength && pKey ) |
| 12462 | { |
| 12463 | palCopyMemory( pMac->hHdd, p, pKey, keyLength ); |
| 12464 | if(keyLength == 16) |
| 12465 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 12466 | 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\n", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12467 | keyId, edType, pKey[0], pKey[1], pKey[2], pKey[3], pKey[4], |
| 12468 | pKey[5], pKey[6], pKey[7], pKey[8], |
| 12469 | pKey[9], pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], pKey[15]); |
| 12470 | } |
| 12471 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12472 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12473 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12474 | return( status ); |
| 12475 | } |
| 12476 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12477 | eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, |
| 12478 | tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc ) |
| 12479 | { |
| 12480 | eHalStatus status; |
| 12481 | tSirSmeStartBssReq *pMsg; |
| 12482 | tANI_U8 *pBuf = NULL; |
| 12483 | tANI_U8 *wTmpBuf = NULL; |
| 12484 | tANI_U16 msgLen, wTmp; |
| 12485 | tANI_U32 dwTmp; |
| 12486 | tSirNwType nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12487 | ePhyChanBondState cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12488 | #ifdef WLAN_SOFTAP_FEATURE |
| 12489 | tANI_U32 authType; |
| 12490 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12491 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12492 | |
| 12493 | if(!pSession) |
| 12494 | { |
| 12495 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12496 | return eHAL_STATUS_FAILURE; |
| 12497 | } |
| 12498 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12499 | do { |
| 12500 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 12501 | pSession->joinFailStatusCode.reasonCode = 0; |
| 12502 | msgLen = sizeof(tSirSmeStartBssReq); |
| 12503 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12504 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12505 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
| 12506 | 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] | 12507 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12508 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12509 | //sessionId |
| 12510 | *pBuf = (tANI_U8)sessionId; |
| 12511 | pBuf++; |
| 12512 | // transactionId |
| 12513 | *pBuf = 0; |
| 12514 | *(pBuf + 1) = 0; |
| 12515 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12516 | // bssid |
| 12517 | palCopyMemory( pMac->hHdd, pBuf, pParam->bssid, sizeof(tSirMacAddr) ); |
| 12518 | pBuf += sizeof(tSirMacAddr); |
| 12519 | // selfMacAddr |
| 12520 | palCopyMemory( pMac->hHdd, pBuf, pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 12521 | pBuf += sizeof(tSirMacAddr); |
| 12522 | // beaconInterval |
| 12523 | if( pBssDesc && pBssDesc->beaconInterval ) |
| 12524 | { |
| 12525 | wTmp = pal_cpu_to_be16( pBssDesc->beaconInterval ); |
| 12526 | } |
| 12527 | #ifdef WLAN_SOFTAP_FEATURE |
| 12528 | else if(pParam->beaconInterval) |
| 12529 | { |
| 12530 | wTmp = pal_cpu_to_be16( pParam->beaconInterval ); |
| 12531 | } |
| 12532 | #endif |
| 12533 | else |
| 12534 | { |
| 12535 | wTmp = pal_cpu_to_be16( WNI_CFG_BEACON_INTERVAL_STADEF ); |
| 12536 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12537 | if(csrIsconcurrentsessionValid (pMac, sessionId, |
| 12538 | pParam->bssPersona) |
| 12539 | == eHAL_STATUS_SUCCESS ) |
| 12540 | { |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 12541 | csrValidateMCCBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12542 | pParam->bssPersona); |
| 12543 | //Update the beacon Interval |
| 12544 | pParam->beaconInterval = wTmp; |
| 12545 | } |
| 12546 | else |
| 12547 | { |
| 12548 | smsLog( pMac,LOGE, FL("****Start BSS failed persona already exists***\n")); |
| 12549 | status = eHAL_STATUS_FAILURE; |
| 12550 | return status; |
| 12551 | } |
| 12552 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12553 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); |
| 12554 | pBuf += sizeof(tANI_U16); |
| 12555 | // dot11mode |
| 12556 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pParam->uCfgDot11Mode ); |
| 12557 | pBuf += 1; |
| 12558 | // bssType |
| 12559 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( bssType ) ); |
| 12560 | palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tSirBssType) ); |
| 12561 | pBuf += sizeof(tSirBssType); |
| 12562 | // ssId |
| 12563 | if( pParam->ssId.length ) |
| 12564 | { |
| 12565 | // ssId len |
| 12566 | *pBuf = pParam->ssId.length; |
| 12567 | pBuf++; |
| 12568 | palCopyMemory( pMac->hHdd, pBuf, pParam->ssId.ssId, pParam->ssId.length ); |
| 12569 | pBuf += pParam->ssId.length; |
| 12570 | } |
| 12571 | else |
| 12572 | { |
| 12573 | *pBuf = 0; |
| 12574 | pBuf++; |
| 12575 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12576 | // set the channel Id |
| 12577 | *pBuf = pParam->operationChn; |
| 12578 | pBuf++; |
| 12579 | //What should we really do for the cbmode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12580 | cbMode = (ePhyChanBondState)pal_cpu_to_be32(pParam->cbMode); |
| 12581 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState) ); |
| 12582 | pBuf += sizeof(ePhyChanBondState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12583 | |
| 12584 | #ifdef WLAN_SOFTAP_FEATURE |
| 12585 | // Set privacy |
| 12586 | *pBuf = pParam->privacy; |
| 12587 | pBuf++; |
| 12588 | |
| 12589 | //Set Uapsd |
| 12590 | *pBuf = pParam->ApUapsdEnable; |
| 12591 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12592 | //Set SSID hidden |
| 12593 | *pBuf = pParam->ssidHidden; |
| 12594 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12595 | *pBuf = (tANI_U8)pParam->fwdWPSPBCProbeReq; |
| 12596 | pBuf++; |
| 12597 | |
| 12598 | //Ht protection Enable/Disable |
| 12599 | *pBuf = (tANI_U8)pParam->protEnabled; |
| 12600 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12601 | //Enable Beacons to Receive for OBSS protection Enable/Disable |
| 12602 | *pBuf = (tANI_U8)pParam->obssProtEnabled; |
| 12603 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12604 | //set cfg related to protection |
| 12605 | wTmp = pal_cpu_to_be16( pParam->ht_protection ); |
| 12606 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); |
| 12607 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12608 | // Set Auth type |
| 12609 | authType = pal_cpu_to_be32(pParam->authType); |
| 12610 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&authType, sizeof(tANI_U32)); |
| 12611 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12612 | // Set DTIM |
| 12613 | dwTmp = pal_cpu_to_be32(pParam->dtimPeriod); |
| 12614 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
| 12615 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12616 | // Set wps_state |
| 12617 | *pBuf = pParam->wps_state; |
| 12618 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12619 | #endif |
| 12620 | //Persona |
| 12621 | *pBuf = (tANI_U8)pParam->bssPersona; |
| 12622 | pBuf++; |
| 12623 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 12624 | //txLdpcIniFeatureEnabled |
| 12625 | *pBuf = (tANI_U8)(tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 12626 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12627 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12628 | |
| 12629 | // set RSN IE |
| 12630 | if( pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata) ) |
| 12631 | { |
| 12632 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 12633 | palFreeMemory( pMac->hHdd, pMsg ); |
| 12634 | break; |
| 12635 | } |
| 12636 | wTmp = pal_cpu_to_be16( pParam->nRSNIELength ); |
| 12637 | palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) ); |
| 12638 | pBuf += sizeof(tANI_U16); |
| 12639 | if( wTmp ) |
| 12640 | { |
| 12641 | wTmp = pParam->nRSNIELength; |
| 12642 | palCopyMemory( pMac->hHdd, pBuf, pParam->pRSNIE, wTmp ); |
| 12643 | pBuf += wTmp; |
| 12644 | } |
| 12645 | nwType = (tSirNwType)pal_cpu_to_be32(pParam->sirNwType); |
| 12646 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType) ); |
| 12647 | pBuf += sizeof(tSirNwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12648 | *pBuf = pParam->operationalRateSet.numRates; //tSirMacRateSet->numRates |
| 12649 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12650 | palCopyMemory( pMac->hHdd, pBuf, pParam->operationalRateSet.rate, pParam->operationalRateSet.numRates ); |
| 12651 | pBuf += pParam->operationalRateSet.numRates ; |
| 12652 | *pBuf++ = pParam->extendedRateSet.numRates; |
| 12653 | if(0 != pParam->extendedRateSet.numRates) |
| 12654 | { |
| 12655 | palCopyMemory( pMac->hHdd, pBuf, pParam->extendedRateSet.rate, pParam->extendedRateSet.numRates ); |
| 12656 | pBuf += pParam->extendedRateSet.numRates; |
| 12657 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12658 | msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg |
| 12659 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 12660 | |
| 12661 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12662 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12663 | return( status ); |
| 12664 | } |
| 12665 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12666 | eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 12667 | { |
| 12668 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12669 | tSirSmeStopBssReq *pMsg; |
| 12670 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12671 | tANI_U8 *pBuf; |
| 12672 | tANI_U16 msgLen; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12673 | |
| 12674 | if(!pSession) |
| 12675 | { |
| 12676 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12677 | return eHAL_STATUS_FAILURE; |
| 12678 | } |
| 12679 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12680 | do { |
| 12681 | status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq)); |
| 12682 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12683 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq )); |
| 12684 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 12685 | pBuf = &pMsg->sessionId; |
| 12686 | //sessionId |
| 12687 | *pBuf = (tANI_U8)sessionId; |
| 12688 | pBuf++; |
| 12689 | // transactionId |
| 12690 | *pBuf = 0; |
| 12691 | pBuf += sizeof(tANI_U16); |
| 12692 | //reason code |
| 12693 | *pBuf = 0; |
| 12694 | pBuf += sizeof(tSirResultCodes); |
| 12695 | // bssid |
| 12696 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 12697 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 12698 | { |
| 12699 | palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 12700 | } |
| 12701 | else |
| 12702 | { |
| 12703 | palCopyMemory( pMac->hHdd, pBuf,(tANI_U8 *)&pSession->connectedProfile.bssid, sizeof(tSirMacAddr) ); |
| 12704 | } |
| 12705 | pBuf += sizeof(tSirMacAddr); |
| 12706 | msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr); |
| 12707 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12708 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12709 | #if 0 |
| 12710 | status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq)); |
| 12711 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 12712 | palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeStopBssReq )); |
| 12713 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 12714 | pMsg->reasonCode = 0; |
| 12715 | // bssid |
| 12716 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 12717 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 12718 | { |
| 12719 | pbBssid = (tANI_U8 *)&pSession->selfMacAddr; |
| 12720 | } |
| 12721 | else |
| 12722 | { |
| 12723 | pbBssid = (tANI_U8 *)&pSession->connectedProfile.bssid; |
| 12724 | } |
| 12725 | palCopyMemory( pMac->hHdd, &pMsg->bssId, pbBssid, sizeof(tSirMacAddr) ); |
| 12726 | pMsg->transactionId = 0; |
| 12727 | pMsg->sessionId = (tANI_U8)sessionId; |
| 12728 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeStopBssReq )); |
| 12729 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 12730 | #endif |
| 12731 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12732 | return( status ); |
| 12733 | } |
| 12734 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12735 | eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12736 | tCsrRoamModifyProfileFields *pModProfileFields, |
| 12737 | tANI_U32 *pRoamId, v_BOOL_t fForce) |
| 12738 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12739 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12740 | tANI_U32 roamId = 0; |
| 12741 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12742 | if((csrIsConnStateConnected(pMac, sessionId)) && |
| 12743 | (fForce || (!palEqualMemory(pMac->hHdd, &pModProfileFields, |
| 12744 | &pSession->connectedProfile.modifyProfileFields, |
| 12745 | sizeof(tCsrRoamModifyProfileFields)))) ) |
| 12746 | { |
| 12747 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 12748 | if(pRoamId) |
| 12749 | { |
| 12750 | *pRoamId = roamId; |
| 12751 | } |
| 12752 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12753 | status = csrRoamIssueReassoc(pMac, sessionId, NULL, pModProfileFields, |
| 12754 | eCsrSmeIssuedReassocToSameAP, roamId, |
| 12755 | eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12757 | return status; |
| 12758 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12759 | static eHalStatus csrRoamSessionOpened(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12760 | { |
| 12761 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12762 | tCsrRoamInfo roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12763 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 12764 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 12765 | eCSR_ROAM_SESSION_OPENED, eCSR_ROAM_RESULT_NONE); |
| 12766 | return (status); |
| 12767 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12768 | eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 12769 | { |
| 12770 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12771 | tListElem *pEntry = NULL; |
| 12772 | tSmeCmd *pCommand = NULL; |
| 12773 | tSirSmeAddStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12774 | do |
| 12775 | { |
| 12776 | if(pMsg == NULL) |
| 12777 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 12778 | smsLog(pMac, LOGE, "in %s msg ptr is NULL\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12779 | status = eHAL_STATUS_FAILURE; |
| 12780 | break; |
| 12781 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12782 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 12783 | if(pEntry) |
| 12784 | { |
| 12785 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 12786 | if(eSmeCommandAddStaSession == pCommand->command) |
| 12787 | { |
| 12788 | pRsp = (tSirSmeAddStaSelfRsp*)pMsg; |
| 12789 | smsLog( pMac, LOG1, "Add Sta rsp status = %d\n", pRsp->status ); |
| 12790 | //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] | 12791 | csrRoamSessionOpened(pMac, pCommand->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12792 | //Remove this command out of the active list |
| 12793 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 12794 | { |
| 12795 | //Now put this command back on the avilable command list |
| 12796 | csrReleaseCommand(pMac, pCommand); |
| 12797 | } |
| 12798 | smeProcessPendingQueue( pMac ); |
| 12799 | } |
| 12800 | else |
| 12801 | { |
| 12802 | smsLog(pMac, LOGE, "in %s eWNI_SME_ADD_STA_SELF_RSP Received but NO Add sta session command are ACTIVE ...\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 12803 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12804 | status = eHAL_STATUS_FAILURE; |
| 12805 | break; |
| 12806 | } |
| 12807 | } |
| 12808 | else |
| 12809 | { |
| 12810 | smsLog(pMac, LOGE, "in %s eWNI_SME_ADD_STA_SELF_RSP Received but NO commands are ACTIVE ...\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 12811 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12812 | status = eHAL_STATUS_FAILURE; |
| 12813 | break; |
| 12814 | } |
| 12815 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12816 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12817 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12818 | eHalStatus csrSendMBAddSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 12819 | { |
| 12820 | tSirSmeAddStaSelfReq *pMsg; |
| 12821 | tANI_U16 msgLen; |
| 12822 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12823 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12824 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 12825 | sizeof( tSirBssType )*/; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12826 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 12827 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12828 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12829 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ADD_STA_SELF_REQ); |
| 12830 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12831 | // self station address |
| 12832 | palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) ); |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 12833 | smsLog( pMac, LOG1, FL("selfMac=%02x, %02x, %02x, %02x, %02x, %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12834 | pMsg->selfMacAddr[0], |
| 12835 | pMsg->selfMacAddr[1], |
| 12836 | pMsg->selfMacAddr[2], |
| 12837 | pMsg->selfMacAddr[3], |
| 12838 | pMsg->selfMacAddr[4], |
| 12839 | pMsg->selfMacAddr[5]); |
| 12840 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12841 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12842 | return( status ); |
| 12843 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12844 | eHalStatus csrIssueAddStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr sessionMacAddr) |
| 12845 | { |
| 12846 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12847 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12848 | pCommand = csrGetCommandBuffer(pMac); |
| 12849 | if(NULL == pCommand) |
| 12850 | { |
| 12851 | status = eHAL_STATUS_RESOURCES; |
| 12852 | } |
| 12853 | else |
| 12854 | { |
| 12855 | pCommand->command = eSmeCommandAddStaSession; |
| 12856 | pCommand->sessionId = (tANI_U8)sessionId; |
| 12857 | palCopyMemory( pMac->hHdd, pCommand->u.addStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12858 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 12859 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 12860 | { |
| 12861 | //Should be panic?? |
| 12862 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 12863 | } |
| 12864 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12865 | return (status); |
| 12866 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12867 | eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 12868 | { |
| 12869 | return csrSendMBAddSelfStaReqMsg( pMac, |
| 12870 | pCommand->u.addStaSessionCmd.selfMacAddr ); |
| 12871 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12872 | eHalStatus csrRoamOpenSession( tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext, |
| 12873 | tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId ) |
| 12874 | { |
| 12875 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12876 | tANI_U32 i; |
| 12877 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12878 | *pbSessionId = CSR_SESSION_ID_INVALID; |
| 12879 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 12880 | { |
| 12881 | if( !CSR_IS_SESSION_VALID( pMac, i ) ) |
| 12882 | { |
| 12883 | pSession = CSR_GET_SESSION( pMac, i ); |
| 12884 | status = eHAL_STATUS_SUCCESS; |
| 12885 | pSession->sessionActive = eANI_BOOLEAN_TRUE; |
| 12886 | pSession->sessionId = (tANI_U8)i; |
| 12887 | pSession->callback = callback; |
| 12888 | pSession->pContext = pContext; |
| 12889 | palCopyMemory( pMac->hHdd, &pSession->selfMacAddr, pSelfMacAddr, sizeof(tCsrBssid) ); |
| 12890 | *pbSessionId = (tANI_U8)i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12891 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerRoaming, csrRoamRoamingTimerHandler, |
| 12892 | &pSession->roamingTimerInfo); |
| 12893 | if(!HAL_STATUS_SUCCESS(status)) |
| 12894 | { |
| 12895 | smsLog(pMac, LOGE, FL("cannot allocate memory for Roaming timer\n")); |
| 12896 | break; |
| 12897 | } |
| 12898 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 12899 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerJoinRetry, csrRoamJoinRetryTimerHandler, |
| 12900 | &pSession->joinRetryTimerInfo); |
| 12901 | if(!HAL_STATUS_SUCCESS(status)) |
| 12902 | { |
| 12903 | smsLog(pMac, LOGE, FL("cannot allocate memory for joinretry timer\n")); |
| 12904 | break; |
| 12905 | } |
| 12906 | #endif |
| 12907 | pSession->ibssJoinTimerInfo.pMac = pMac; |
| 12908 | pSession->ibssJoinTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12909 | status = palTimerAlloc(pMac->hHdd, &pSession->hTimerIbssJoining, csrRoamIbssJoinTimerHandler, |
| 12910 | &pSession->ibssJoinTimerInfo); |
| 12911 | if(!HAL_STATUS_SUCCESS(status)) |
| 12912 | { |
| 12913 | smsLog(pMac, LOGE, FL("cannot allocate memory for IbssJoining timer\n")); |
| 12914 | break; |
| 12915 | } |
| 12916 | status = csrIssueAddStaForSessionReq ( pMac, i, pSelfMacAddr ); |
| 12917 | break; |
| 12918 | } |
| 12919 | } |
| 12920 | if( CSR_ROAM_SESSION_MAX == i ) |
| 12921 | { |
| 12922 | //No session is available |
| 12923 | status = eHAL_STATUS_RESOURCES; |
| 12924 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12925 | return ( status ); |
| 12926 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12927 | eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 12928 | { |
| 12929 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12930 | tListElem *pEntry = NULL; |
| 12931 | tSmeCmd *pCommand = NULL; |
| 12932 | tSirSmeDelStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12933 | do |
| 12934 | { |
| 12935 | if(pMsg == NULL) |
| 12936 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 12937 | smsLog(pMac, LOGE, "in %s msg ptr is NULL\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12938 | status = eHAL_STATUS_FAILURE; |
| 12939 | break; |
| 12940 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12941 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 12942 | if(pEntry) |
| 12943 | { |
| 12944 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 12945 | if(eSmeCommandDelStaSession == pCommand->command) |
| 12946 | { |
| 12947 | tANI_U8 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12948 | pRsp = (tSirSmeDelStaSelfRsp*)pMsg; |
| 12949 | smsLog( pMac, LOG1, "Del Sta rsp status = %d\n", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12950 | //This session is done. |
| 12951 | csrCleanupSession(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12952 | if(pCommand->u.delStaSessionCmd.callback) |
| 12953 | { |
| 12954 | |
| 12955 | status = sme_ReleaseGlobalLock( &pMac->sme ); |
| 12956 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 12957 | { |
| 12958 | pCommand->u.delStaSessionCmd.callback( |
| 12959 | pCommand->u.delStaSessionCmd.pContext); |
| 12960 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 12961 | if (! HAL_STATUS_SUCCESS( status ) ) |
| 12962 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 12963 | smsLog(pMac, LOGP, "%s: Failed to Acquire Lock\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12964 | return status; |
| 12965 | } |
| 12966 | } |
| 12967 | else { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 12968 | smsLog(pMac, LOGE, "%s: Failed to Release Lock\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12969 | } |
| 12970 | } |
| 12971 | |
| 12972 | //Remove this command out of the active list |
| 12973 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 12974 | { |
| 12975 | //Now put this command back on the avilable command list |
| 12976 | csrReleaseCommand(pMac, pCommand); |
| 12977 | } |
| 12978 | smeProcessPendingQueue( pMac ); |
| 12979 | } |
| 12980 | else |
| 12981 | { |
| 12982 | smsLog(pMac, LOGE, "in %s eWNI_SME_DEL_STA_SELF_RSP Received but NO Del sta session command are ACTIVE ...\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 12983 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12984 | status = eHAL_STATUS_FAILURE; |
| 12985 | break; |
| 12986 | } |
| 12987 | } |
| 12988 | else |
| 12989 | { |
| 12990 | smsLog(pMac, LOGE, "in %s eWNI_SME_DEL_STA_SELF_RSP Received but NO commands are ACTIVE ...\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 12991 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12992 | status = eHAL_STATUS_FAILURE; |
| 12993 | break; |
| 12994 | } |
| 12995 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12996 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12997 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12998 | eHalStatus csrSendMBDelSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 12999 | { |
| 13000 | tSirSmeDelStaSelfReq *pMsg; |
| 13001 | tANI_U16 msgLen; |
| 13002 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13003 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13004 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 13005 | sizeof( tSirBssType )*/; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13006 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 13007 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
| 13008 | |
| 13009 | palZeroMemory(pMac->hHdd, pMsg, msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13010 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_STA_SELF_REQ); |
| 13011 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13012 | // self station address |
| 13013 | palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13014 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13015 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13016 | return( status ); |
| 13017 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13018 | eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13019 | tSirMacAddr sessionMacAddr, |
| 13020 | csrRoamSessionCloseCallback callback, |
| 13021 | void *pContext) |
| 13022 | { |
| 13023 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13024 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13025 | pCommand = csrGetCommandBuffer(pMac); |
| 13026 | if(NULL == pCommand) |
| 13027 | { |
| 13028 | status = eHAL_STATUS_RESOURCES; |
| 13029 | } |
| 13030 | else |
| 13031 | { |
| 13032 | pCommand->command = eSmeCommandDelStaSession; |
| 13033 | pCommand->sessionId = (tANI_U8)sessionId; |
| 13034 | pCommand->u.delStaSessionCmd.callback = callback; |
| 13035 | pCommand->u.delStaSessionCmd.pContext = pContext; |
| 13036 | palCopyMemory( pMac->hHdd, pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13037 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 13038 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 13039 | { |
| 13040 | //Should be panic?? |
| 13041 | smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status ); |
| 13042 | } |
| 13043 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13044 | return (status); |
| 13045 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13046 | eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 13047 | { |
| 13048 | return csrSendMBDelSelfStaReqMsg( pMac, |
| 13049 | pCommand->u.delStaSessionCmd.selfMacAddr ); |
| 13050 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13051 | static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13052 | { |
| 13053 | tDblLinkList *pList = &pMac->roam.roamCmdPendingList; |
| 13054 | tListElem *pEntry, *pNext; |
| 13055 | tSmeCmd *pCommand; |
| 13056 | tDblLinkList localList; |
| 13057 | |
| 13058 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 13059 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 13060 | { |
| 13061 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 13062 | return; |
| 13063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13064 | csrLLLock(pList); |
| 13065 | pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK); |
| 13066 | while(pEntry != NULL) |
| 13067 | { |
| 13068 | pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK); |
| 13069 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13070 | if(pCommand->sessionId == sessionId) |
| 13071 | { |
| 13072 | if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK)) |
| 13073 | { |
| 13074 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 13075 | } |
| 13076 | } |
| 13077 | pEntry = pNext; |
| 13078 | } |
| 13079 | csrLLUnlock(pList); |
| 13080 | |
| 13081 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 13082 | { |
| 13083 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13084 | csrAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 13085 | } |
| 13086 | csrLLClose(&localList); |
| 13087 | } |
| 13088 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13089 | void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13090 | { |
| 13091 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 13092 | { |
| 13093 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13094 | csrRoamStop(pMac, sessionId); |
| 13095 | csrFreeConnectBssDesc(pMac, sessionId); |
| 13096 | csrRoamFreeConnectProfile( pMac, &pSession->connectedProfile ); |
| 13097 | csrRoamFreeConnectedInfo ( pMac, &pSession->connectedInfo); |
| 13098 | palTimerFree(pMac->hHdd, pSession->hTimerRoaming); |
| 13099 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 13100 | palTimerFree(pMac->hHdd, pSession->hTimerJoinRetry); |
| 13101 | #endif |
| 13102 | palTimerFree(pMac->hHdd, pSession->hTimerIbssJoining); |
| 13103 | purgeSmeSessionCmdList(pMac, sessionId); |
| 13104 | purgeCsrSessionCmdList(pMac, sessionId); |
| 13105 | csrInitSession(pMac, sessionId); |
| 13106 | } |
| 13107 | } |
| 13108 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13109 | eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13110 | tANI_BOOLEAN fSync, |
| 13111 | csrRoamSessionCloseCallback callback, |
| 13112 | void *pContext ) |
| 13113 | { |
| 13114 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13115 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 13116 | { |
| 13117 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13118 | if(fSync) |
| 13119 | { |
| 13120 | csrCleanupSession(pMac, sessionId); |
| 13121 | } |
| 13122 | else |
| 13123 | { |
| 13124 | purgeSmeSessionCmdList(pMac, sessionId); |
| 13125 | purgeCsrSessionCmdList(pMac, sessionId); |
| 13126 | status = csrIssueDelStaForSessionReq( pMac, sessionId, |
| 13127 | pSession->selfMacAddr, callback, pContext); |
| 13128 | } |
| 13129 | } |
| 13130 | else |
| 13131 | { |
| 13132 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 13133 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13134 | return ( status ); |
| 13135 | } |
| 13136 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13137 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 13138 | { |
| 13139 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13140 | |
| 13141 | if(!pSession) |
| 13142 | { |
| 13143 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13144 | return; |
| 13145 | } |
| 13146 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13147 | pSession->sessionActive = eANI_BOOLEAN_FALSE; |
| 13148 | pSession->sessionId = CSR_SESSION_ID_INVALID; |
| 13149 | pSession->callback = NULL; |
| 13150 | pSession->pContext = NULL; |
| 13151 | pSession->ibss_join_pending = FALSE; |
| 13152 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 13153 | // TODO : Confirm pMac->roam.fReadyForPowerSave = eANI_BOOLEAN_FALSE; |
| 13154 | csrFreeRoamProfile( pMac, sessionId ); |
| 13155 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 13156 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 13157 | csrFreeConnectBssDesc(pMac, sessionId); |
| 13158 | csrScanEnable(pMac); |
| 13159 | palZeroMemory( pMac->hHdd, &pSession->selfMacAddr, sizeof(tCsrBssid) ); |
| 13160 | if(pSession->pWpaRsnReqIE) |
| 13161 | { |
| 13162 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnReqIE); |
| 13163 | pSession->pWpaRsnReqIE = NULL; |
| 13164 | } |
| 13165 | pSession->nWpaRsnReqIeLength = 0; |
| 13166 | if(pSession->pWpaRsnRspIE) |
| 13167 | { |
| 13168 | palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE); |
| 13169 | pSession->pWpaRsnRspIE = NULL; |
| 13170 | } |
| 13171 | pSession->nWpaRsnRspIeLength = 0; |
| 13172 | #ifdef FEATURE_WLAN_WAPI |
| 13173 | if(pSession->pWapiReqIE) |
| 13174 | { |
| 13175 | palFreeMemory(pMac->hHdd, pSession->pWapiReqIE); |
| 13176 | pSession->pWapiReqIE = NULL; |
| 13177 | } |
| 13178 | pSession->nWapiReqIeLength = 0; |
| 13179 | if(pSession->pWapiRspIE) |
| 13180 | { |
| 13181 | palFreeMemory(pMac->hHdd, pSession->pWapiRspIE); |
| 13182 | pSession->pWapiRspIE = NULL; |
| 13183 | } |
| 13184 | pSession->nWapiRspIeLength = 0; |
| 13185 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13186 | if(pSession->pAddIEScan) |
| 13187 | { |
| 13188 | palFreeMemory(pMac->hHdd, pSession->pAddIEScan); |
| 13189 | pSession->pAddIEScan = NULL; |
| 13190 | } |
| 13191 | pSession->nAddIEScanLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13192 | if(pSession->pAddIEAssoc) |
| 13193 | { |
| 13194 | palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc); |
| 13195 | pSession->pAddIEAssoc = NULL; |
| 13196 | } |
| 13197 | pSession->nAddIEAssocLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13198 | } |
| 13199 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13200 | eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId ) |
| 13201 | { |
| 13202 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13203 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13204 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13205 | { |
| 13206 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13207 | { |
| 13208 | if( csrIsMacAddressEqual( pMac, bssid, &pMac->roam.roamSession[i].connectedProfile.bssid ) ) |
| 13209 | { |
| 13210 | //Found it |
| 13211 | status = eHAL_STATUS_SUCCESS; |
| 13212 | *pSessionId = i; |
| 13213 | break; |
| 13214 | } |
| 13215 | } |
| 13216 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13217 | return( status ); |
| 13218 | } |
| 13219 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13220 | //This function assumes that we only support one IBSS session. We cannot use BSSID to identify |
| 13221 | //session because for IBSS, the bssid changes. |
| 13222 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ) |
| 13223 | { |
| 13224 | tANI_U32 i, nRet = CSR_SESSION_ID_INVALID; |
| 13225 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13226 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13227 | { |
| 13228 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13229 | { |
| 13230 | pSession = CSR_GET_SESSION( pMac, i ); |
| 13231 | if( pSession->pCurRoamProfile && ( csrIsBssTypeIBSS( pSession->connectedProfile.BSSType ) ) ) |
| 13232 | { |
| 13233 | //Found it |
| 13234 | nRet = i; |
| 13235 | break; |
| 13236 | } |
| 13237 | } |
| 13238 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13239 | return (nRet); |
| 13240 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13241 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid) |
| 13242 | { |
| 13243 | /* Update the current BSS info in ho control block based on connected |
| 13244 | profile info from pmac global structure */ |
| 13245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13246 | smsLog(pMac, LOGW, " csrRoamLinkUp: WLAN link UP with AP= %02x-%02x-%02x-%02x-%02x-%02x\n", |
| 13247 | bssid[ 0 ], bssid[ 1 ], bssid[ 2 ], |
| 13248 | bssid[ 3 ], bssid[ 4 ], bssid[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13249 | /* Check for user misconfig of RSSI trigger threshold */ |
| 13250 | pMac->roam.configParam.vccRssiThreshold = |
| 13251 | ( 0 == pMac->roam.configParam.vccRssiThreshold ) ? |
| 13252 | CSR_VCC_RSSI_THRESHOLD : pMac->roam.configParam.vccRssiThreshold; |
| 13253 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13254 | /* Check for user misconfig of UL MAC Loss trigger threshold */ |
| 13255 | pMac->roam.configParam.vccUlMacLossThreshold = |
| 13256 | ( 0 == pMac->roam.configParam.vccUlMacLossThreshold ) ? |
| 13257 | CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13258 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 13259 | { |
| 13260 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13261 | /* Indicate the neighbor roal algorithm about the connect indication */ |
| 13262 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId); |
| 13263 | csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS); |
| 13264 | } |
| 13265 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13266 | } |
| 13267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13268 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13269 | { |
| 13270 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13271 | |
| 13272 | if(!pSession) |
| 13273 | { |
| 13274 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13275 | return; |
| 13276 | } |
| 13277 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13278 | //Only to handle the case for Handover on infra link |
| 13279 | if( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 13280 | { |
| 13281 | return; |
| 13282 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13283 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 13284 | csrRoamDeregStatisticsReq(pMac); |
| 13285 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 13286 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 13287 | /* Indicate the neighbor roal algorithm about the disconnect indication */ |
| 13288 | csrNeighborRoamIndicateDisconnect(pMac, sessionId); |
| 13289 | #endif |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 13290 | |
| 13291 | //Remove this code once SLM_Sessionization is supported |
| 13292 | //BMPS_WORKAROUND_NOT_NEEDED |
| 13293 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 13294 | csrIsInfraApStarted( pMac ) && |
| 13295 | pMac->roam.configParam.doBMPSWorkaround) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13296 | { |
| 13297 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 13298 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13299 | } |
| 13300 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13301 | void csrRoamTlStatsTimerHandler(void *pv) |
| 13302 | { |
| 13303 | tpAniSirGlobal pMac = PMAC_STRUCT( pv ); |
| 13304 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13305 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 13306 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13307 | smsLog(pMac, LOG1, FL(" TL stat timer is no-op. It needs to support multiple stations")); |
| 13308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13309 | #if 0 |
| 13310 | // TODO Persession .??? |
| 13311 | //req TL for stats |
| 13312 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId)) |
| 13313 | { |
| 13314 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:couldn't get the stats from TL\n")); |
| 13315 | } |
| 13316 | else |
| 13317 | { |
| 13318 | //save in SME |
| 13319 | csrRoamSaveStatsFromTl(pMac, tlStats); |
| 13320 | } |
| 13321 | #endif |
| 13322 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 13323 | { |
| 13324 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 13325 | { |
| 13326 | //start timer |
| 13327 | status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 13328 | pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE); |
| 13329 | if(!HAL_STATUS_SUCCESS(status)) |
| 13330 | { |
| 13331 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:cannot start TlStatsTimer timer\n")); |
| 13332 | return; |
| 13333 | } |
| 13334 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 13335 | } |
| 13336 | } |
| 13337 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13338 | void csrRoamPeStatsTimerHandler(void *pv) |
| 13339 | { |
| 13340 | tCsrPeStatsReqInfo *pPeStatsReqListEntry = (tCsrPeStatsReqInfo *)pv; |
| 13341 | eHalStatus status; |
| 13342 | tpAniSirGlobal pMac = pPeStatsReqListEntry->pMac; |
| 13343 | VOS_STATUS vosStatus; |
| 13344 | tPmcPowerState powerState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13345 | pPeStatsReqListEntry->timerRunning = FALSE; |
| 13346 | if( pPeStatsReqListEntry->timerStopFailed == TRUE ) |
| 13347 | { |
| 13348 | // If we entered here, meaning the timer could not be successfully |
| 13349 | // stopped in csrRoamRemoveEntryFromPeStatsReqList(). So do it here. |
| 13350 | |
| 13351 | /* Destroy the timer */ |
| 13352 | vosStatus = vos_timer_destroy( &pPeStatsReqListEntry->hPeStatsTimer ); |
| 13353 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13354 | { |
| 13355 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to destroy hPeStatsTimer timer\n")); |
| 13356 | } |
| 13357 | |
| 13358 | // Free the entry |
| 13359 | palFreeMemory(pMac->hHdd, pPeStatsReqListEntry); |
| 13360 | pPeStatsReqListEntry = NULL; |
| 13361 | } |
| 13362 | else |
| 13363 | { |
| 13364 | if(!pPeStatsReqListEntry->rspPending) |
| 13365 | { |
| 13366 | status = csrSendMBStatsReqMsg(pMac, pPeStatsReqListEntry->statsMask & ~(1 << eCsrGlobalClassDStats), |
| 13367 | pPeStatsReqListEntry->staId); |
| 13368 | if(!HAL_STATUS_SUCCESS(status)) |
| 13369 | { |
| 13370 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to send down stats req to PE\n")); |
| 13371 | } |
| 13372 | else |
| 13373 | { |
| 13374 | pPeStatsReqListEntry->rspPending = TRUE; |
| 13375 | } |
| 13376 | } |
| 13377 | |
| 13378 | //send down a req |
| 13379 | if(pPeStatsReqListEntry->periodicity && |
| 13380 | (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pPeStatsReqListEntry->hPeStatsTimer))) |
| 13381 | { |
| 13382 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 13383 | if(ePMC_FULL_POWER == powerState) |
| 13384 | { |
| 13385 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 13386 | { |
| 13387 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 13388 | } |
| 13389 | } |
| 13390 | else |
| 13391 | { |
| 13392 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 13393 | { |
| 13394 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 13395 | } |
| 13396 | } |
| 13397 | //start timer |
| 13398 | vosStatus = vos_timer_start( &pPeStatsReqListEntry->hPeStatsTimer, pPeStatsReqListEntry->periodicity ); |
| 13399 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13400 | { |
| 13401 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:cannot start hPeStatsTimer timer\n")); |
| 13402 | return; |
| 13403 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13404 | pPeStatsReqListEntry->timerRunning = TRUE; |
| 13405 | |
| 13406 | } |
| 13407 | |
| 13408 | } |
| 13409 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13410 | void csrRoamStatsClientTimerHandler(void *pv) |
| 13411 | { |
| 13412 | tCsrStatsClientReqInfo *pStaEntry = (tCsrStatsClientReqInfo *)pv; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13413 | if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pStaEntry->timer)) |
| 13414 | { |
| 13415 | #if 0 |
| 13416 | // TODO Stats fix for multisession |
| 13417 | //start the timer |
| 13418 | vosStatus = vos_timer_start( &pStaEntry->timer, pStaEntry->periodicity ); |
| 13419 | |
| 13420 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13421 | { |
| 13422 | smsLog(pStaEntry->pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13423 | } |
| 13424 | #endif |
| 13425 | } |
| 13426 | #if 0 |
| 13427 | //send up the stats report |
| 13428 | csrRoamReportStatistics(pStaEntry->pMac, pStaEntry->statsMask, pStaEntry->callback, |
| 13429 | pStaEntry->staId, pStaEntry->pContext); |
| 13430 | #endif |
| 13431 | } |
| 13432 | |
| 13433 | |
| 13434 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13435 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId) |
| 13436 | { |
| 13437 | tAniGetPEStatsReq *pMsg; |
| 13438 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13439 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetPEStatsReq)); |
| 13440 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 13441 | { |
| 13442 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to allocate mem for stats req \n"); |
| 13443 | return status; |
| 13444 | } |
| 13445 | // need to initiate a stats request to PE |
| 13446 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_STATISTICS_REQ); |
| 13447 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq); |
| 13448 | pMsg->staId = staId; |
| 13449 | pMsg->statsMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13450 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13451 | if(!HAL_STATUS_SUCCESS(status)) |
| 13452 | { |
| 13453 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to send down the stats req \n"); |
| 13454 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13455 | return status; |
| 13456 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13457 | void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg) |
| 13458 | { |
| 13459 | tAniGetPEStatsRsp *pSmeStatsRsp; |
| 13460 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13461 | tListElem *pEntry = NULL; |
| 13462 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 13463 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 13464 | tANI_U32 tempMask = 0; |
| 13465 | tANI_U8 counter = 0; |
| 13466 | tANI_U8 *pStats = NULL; |
| 13467 | tANI_U32 length = 0; |
| 13468 | v_PVOID_t pvosGCtx; |
| 13469 | v_S7_t rssi = 0; |
| 13470 | tANI_U32 *pRssi = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13471 | pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg; |
| 13472 | if(pSmeStatsRsp->rc) |
| 13473 | { |
| 13474 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:stats rsp from PE shows failure\n")); |
| 13475 | goto post_update; |
| 13476 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13477 | tempMask = pSmeStatsRsp->statsMask; |
| 13478 | pStats = ((tANI_U8 *)&pSmeStatsRsp->statsMask) + sizeof(pSmeStatsRsp->statsMask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13479 | /* subtract all statistics from this length, and after processing the entire |
| 13480 | * 'stat' part of the message, if the length is not zero, then rssi is piggy packed |
| 13481 | * in this 'stats' message. |
| 13482 | */ |
| 13483 | length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13484 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 13485 | while(tempMask) |
| 13486 | { |
| 13487 | if(tempMask & 1) |
| 13488 | { |
| 13489 | switch(counter) |
| 13490 | { |
| 13491 | case eCsrSummaryStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13492 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:summary stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13493 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 13494 | pStats, sizeof(tCsrSummaryStatsInfo)); |
| 13495 | if(!HAL_STATUS_SUCCESS(status)) |
| 13496 | { |
| 13497 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy summary stats\n")); |
| 13498 | } |
| 13499 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 13500 | length -= sizeof(tCsrSummaryStatsInfo); |
| 13501 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13502 | case eCsrGlobalClassAStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13503 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassA stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13504 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 13505 | pStats, sizeof(tCsrGlobalClassAStatsInfo)); |
| 13506 | if(!HAL_STATUS_SUCCESS(status)) |
| 13507 | { |
| 13508 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassA stats\n")); |
| 13509 | } |
| 13510 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
| 13511 | length -= sizeof(tCsrGlobalClassAStatsInfo); |
| 13512 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13513 | case eCsrGlobalClassBStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13514 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassB stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13515 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 13516 | pStats, sizeof(tCsrGlobalClassBStatsInfo)); |
| 13517 | if(!HAL_STATUS_SUCCESS(status)) |
| 13518 | { |
| 13519 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassB stats\n")); |
| 13520 | } |
| 13521 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
| 13522 | length -= sizeof(tCsrGlobalClassBStatsInfo); |
| 13523 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13524 | case eCsrGlobalClassCStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13525 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassC stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13526 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 13527 | pStats, sizeof(tCsrGlobalClassCStatsInfo)); |
| 13528 | if(!HAL_STATUS_SUCCESS(status)) |
| 13529 | { |
| 13530 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy ClassC stats\n")); |
| 13531 | } |
| 13532 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
| 13533 | length -= sizeof(tCsrGlobalClassCStatsInfo); |
| 13534 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13535 | case eCsrPerStaStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13536 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:PerSta stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13537 | if( CSR_MAX_STA > pSmeStatsRsp->staId ) |
| 13538 | { |
| 13539 | status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId], |
| 13540 | pStats, sizeof(tCsrPerStaStatsInfo)); |
| 13541 | } |
| 13542 | else |
| 13543 | { |
| 13544 | status = eHAL_STATUS_FAILURE; |
| 13545 | smsLog( pMac, LOGE, FL("csrRoamStatsRspProcessor:out bound staId:%d\n"), pSmeStatsRsp->staId); |
| 13546 | VOS_ASSERT( 0 ); |
| 13547 | } |
| 13548 | if(!HAL_STATUS_SUCCESS(status)) |
| 13549 | { |
| 13550 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy PerSta stats\n")); |
| 13551 | } |
| 13552 | pStats += sizeof(tCsrPerStaStatsInfo); |
| 13553 | length -= sizeof(tCsrPerStaStatsInfo); |
| 13554 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13555 | default: |
| 13556 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type\n")); |
| 13557 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13558 | } |
| 13559 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13560 | tempMask >>=1; |
| 13561 | counter++; |
| 13562 | } |
| 13563 | pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 13564 | if (length != 0) |
| 13565 | { |
| 13566 | pRssi = (tANI_U32*)pStats; |
| 13567 | rssi = (v_S7_t)*pRssi; |
| 13568 | } |
| 13569 | else |
| 13570 | { |
| 13571 | /* If riva is not sending rssi, continue to use the hack */ |
| 13572 | rssi = RSSI_HACK_BMPS; |
| 13573 | } |
| 13574 | WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13575 | post_update: |
| 13576 | //make sure to update the pe stats req list |
| 13577 | pEntry = csrRoamFindInPeStatsReqList(pMac, pSmeStatsRsp->statsMask); |
| 13578 | if(pEntry) |
| 13579 | { |
| 13580 | pPeStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
| 13581 | pPeStaEntry->rspPending = FALSE; |
| 13582 | |
| 13583 | } |
| 13584 | //check the one timer cases |
| 13585 | pEntry = csrRoamCheckClientReqList(pMac, pSmeStatsRsp->statsMask); |
| 13586 | if(pEntry) |
| 13587 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13588 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13589 | if(pTempStaEntry->timerExpired) |
| 13590 | { |
| 13591 | //send up the stats report |
| 13592 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 13593 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 13594 | //also remove from the client list |
| 13595 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 13596 | pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13597 | } |
| 13598 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13599 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13600 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 13601 | { |
| 13602 | tListElem *pEntry = NULL; |
| 13603 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13604 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13605 | if(!pEntry) |
| 13606 | { |
| 13607 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13608 | smsLog(pMac, LOG2, "csrRoamFindInPeStatsReqList: List empty, no request to PE\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13609 | return NULL; |
| 13610 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13611 | while( pEntry ) |
| 13612 | { |
| 13613 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13614 | if(pTempStaEntry->statsMask == statsMask) |
| 13615 | { |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13616 | smsLog(pMac, LOG3, "csrRoamFindInPeStatsReqList: match found\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13617 | break; |
| 13618 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13619 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13620 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13621 | return pEntry; |
| 13622 | } |
| 13623 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13624 | tListElem * csrRoamChecknUpdateClientReqList(tpAniSirGlobal pMac, tCsrStatsClientReqInfo *pStaEntry, |
| 13625 | tANI_BOOLEAN update) |
| 13626 | { |
| 13627 | tListElem *pEntry; |
| 13628 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13629 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13630 | if(!pEntry) |
| 13631 | { |
| 13632 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13633 | smsLog(pMac, LOG2, "csrRoamChecknUpdateClientReqList: List empty, no request from " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13634 | "upper layer client(s)\n"); |
| 13635 | return NULL; |
| 13636 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13637 | while( pEntry ) |
| 13638 | { |
| 13639 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13640 | if((pTempStaEntry->requesterId == pStaEntry->requesterId) && |
| 13641 | (pTempStaEntry->statsMask == pStaEntry->statsMask)) |
| 13642 | { |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13643 | smsLog(pMac, LOG3, "csrRoamChecknUpdateClientReqList: match found\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13644 | if(update) |
| 13645 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13646 | pTempStaEntry->periodicity = pStaEntry->periodicity; |
| 13647 | pTempStaEntry->callback = pStaEntry->callback; |
| 13648 | pTempStaEntry->pContext = pStaEntry->pContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13649 | } |
| 13650 | break; |
| 13651 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13652 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13653 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13654 | return pEntry; |
| 13655 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13656 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 13657 | { |
| 13658 | tListElem *pEntry; |
| 13659 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13660 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13661 | if(!pEntry) |
| 13662 | { |
| 13663 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13664 | smsLog(pMac, LOG2, "csrRoamCheckClientReqList: List empty, no request from " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13665 | "upper layer client(s)\n"); |
| 13666 | return NULL; |
| 13667 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13668 | while( pEntry ) |
| 13669 | { |
| 13670 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13671 | if((pTempStaEntry->statsMask & ~(1 << eCsrGlobalClassDStats)) == statsMask) |
| 13672 | { |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 13673 | smsLog(pMac, LOG3, "csrRoamCheckClientReqList: match found\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13674 | break; |
| 13675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13676 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 13677 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13678 | return pEntry; |
| 13679 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13680 | eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac, |
| 13681 | csrRoamLinkQualityIndCallback callback, |
| 13682 | void *pContext) |
| 13683 | { |
| 13684 | pMac->roam.linkQualityIndInfo.callback = callback; |
| 13685 | pMac->roam.linkQualityIndInfo.context = pContext; |
| 13686 | if( NULL == callback ) |
| 13687 | { |
| 13688 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being deregistered"); |
| 13689 | } |
| 13690 | else |
| 13691 | { |
| 13692 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being registered"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13693 | /* do we need to invoke the callback to notify client of initial value ?? */ |
| 13694 | } |
| 13695 | return eHAL_STATUS_SUCCESS; |
| 13696 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13697 | void csrRoamVccTrigger(tpAniSirGlobal pMac) |
| 13698 | { |
| 13699 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 13700 | tANI_U32 ul_mac_loss = 0; |
| 13701 | tANI_U32 ul_mac_loss_trigger_threshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13702 | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 13703 | /*------------------------------------------------------------------------- |
| 13704 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13705 | Check for a change in link quality and notify client if necessary |
| 13706 | -------------------------------------------------------------------------*/ |
| 13707 | ul_mac_loss_trigger_threshold = |
| 13708 | pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13709 | VOS_ASSERT( ul_mac_loss_trigger_threshold != 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13710 | smsLog(pMac, LOGW, "csrRoamVccTrigger: UL_MAC_LOSS_THRESHOLD is %d\n", |
| 13711 | ul_mac_loss_trigger_threshold ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13712 | if(ul_mac_loss_trigger_threshold < ul_mac_loss) |
| 13713 | { |
| 13714 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is POOR \n"); |
| 13715 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 13716 | } |
| 13717 | else |
| 13718 | { |
| 13719 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is GOOD\n"); |
| 13720 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 13721 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13722 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link qual : *** UL_MAC_LOSS %d *** ", |
| 13723 | ul_mac_loss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13724 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 13725 | { |
| 13726 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality changed: trigger necessary\n"); |
| 13727 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 13728 | { |
| 13729 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality indication %d\n", |
| 13730 | newVccLinkQuality ); |
| 13731 | |
| 13732 | /* we now invoke the callback once to notify client of initial value */ |
| 13733 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 13734 | pMac->roam.linkQualityIndInfo.context ); |
| 13735 | //event: EVENT_WLAN_VCC |
| 13736 | } |
| 13737 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13738 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
| 13739 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13740 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13741 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 13742 | v_U8_t rssiNotification, |
| 13743 | void * context) |
| 13744 | { |
| 13745 | tpAniSirGlobal pMac = PMAC_STRUCT( context ); |
| 13746 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 13747 | // TODO : Session info unavailable |
| 13748 | tANI_U32 sessionId = 0; |
| 13749 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 13750 | /*------------------------------------------------------------------------- |
| 13751 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13752 | Check for a change in link quality and notify client if necessary |
| 13753 | -------------------------------------------------------------------------*/ |
| 13754 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: RSSI trigger threshold is %d\n", |
| 13755 | pMac->roam.configParam.vccRssiThreshold); |
| 13756 | if(!csrIsConnStateConnectedInfra(pMac, sessionId)) |
| 13757 | { |
| 13758 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: ignoring the indication as we are not connected\n"); |
| 13759 | return VOS_STATUS_SUCCESS; |
| 13760 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13761 | if(WLANTL_HO_THRESHOLD_DOWN == rssiNotification) |
| 13762 | { |
| 13763 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is POOR\n"); |
| 13764 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 13765 | } |
| 13766 | else if(WLANTL_HO_THRESHOLD_UP == rssiNotification) |
| 13767 | { |
| 13768 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is GOOD \n"); |
| 13769 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 13770 | } |
| 13771 | else |
| 13772 | { |
| 13773 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: unknown rssi notification %d\n", rssiNotification); |
| 13774 | //Set to this so the code below won't do anything |
| 13775 | newVccLinkQuality = pMac->roam.vccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13776 | VOS_ASSERT(0); |
| 13777 | } |
| 13778 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13779 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 13780 | { |
| 13781 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality changed: trigger necessary\n"); |
| 13782 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 13783 | { |
| 13784 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality indication %d\n", |
| 13785 | newVccLinkQuality); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13786 | /* we now invoke the callback once to notify client of initial value */ |
| 13787 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 13788 | pMac->roam.linkQualityIndInfo.context ); |
| 13789 | //event: EVENT_WLAN_VCC |
| 13790 | } |
| 13791 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13792 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13793 | return status; |
| 13794 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13795 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 13796 | tDblLinkList *pStaList, |
| 13797 | tCsrStatsClientReqInfo *pStaEntry) |
| 13798 | { |
| 13799 | tCsrStatsClientReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13800 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13801 | //if same entity requested for same set of stats with different periodicity & |
| 13802 | // callback update it |
| 13803 | if(NULL == csrRoamChecknUpdateClientReqList(pMac, pStaEntry, TRUE)) |
| 13804 | { |
| 13805 | |
| 13806 | status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrStatsClientReqInfo)); |
| 13807 | if (!HAL_STATUS_SUCCESS(status)) |
| 13808 | { |
| 13809 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoList: couldn't allocate memory for the " |
| 13810 | "entry\n"); |
| 13811 | return NULL; |
| 13812 | } |
| 13813 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13814 | pNewStaEntry->callback = pStaEntry->callback; |
| 13815 | pNewStaEntry->pContext = pStaEntry->pContext; |
| 13816 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 13817 | pNewStaEntry->requesterId = pStaEntry->requesterId; |
| 13818 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 13819 | pNewStaEntry->pPeStaEntry = pStaEntry->pPeStaEntry; |
| 13820 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 13821 | pNewStaEntry->staId = pStaEntry->staId; |
| 13822 | pNewStaEntry->timerExpired = pStaEntry->timerExpired; |
| 13823 | |
| 13824 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
| 13825 | } |
| 13826 | return pNewStaEntry; |
| 13827 | } |
| 13828 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13829 | tCsrPeStatsReqInfo * csrRoamInsertEntryIntoPeStatsReqList( tpAniSirGlobal pMac, |
| 13830 | tDblLinkList *pStaList, |
| 13831 | tCsrPeStatsReqInfo *pStaEntry) |
| 13832 | { |
| 13833 | tCsrPeStatsReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13834 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13835 | status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrPeStatsReqInfo)); |
| 13836 | if (!HAL_STATUS_SUCCESS(status)) |
| 13837 | { |
| 13838 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoPeStatsReqList: couldn't allocate memory for the " |
| 13839 | "entry\n"); |
| 13840 | return NULL; |
| 13841 | } |
| 13842 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13843 | pNewStaEntry->hPeStatsTimer = pStaEntry->hPeStatsTimer; |
| 13844 | pNewStaEntry->numClient = pStaEntry->numClient; |
| 13845 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 13846 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 13847 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 13848 | pNewStaEntry->staId = pStaEntry->staId; |
| 13849 | pNewStaEntry->timerRunning = pStaEntry->timerRunning; |
| 13850 | pNewStaEntry->rspPending = pStaEntry->rspPending; |
| 13851 | |
| 13852 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13853 | return pNewStaEntry; |
| 13854 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13855 | eHalStatus csrGetRssi(tpAniSirGlobal pMac, |
| 13856 | tCsrRssiCallback callback, |
| 13857 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 13858 | { |
| 13859 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13860 | vos_msg_t msg; |
| 13861 | tANI_U32 sessionId; |
| 13862 | |
| 13863 | tAniGetRssiReq *pMsg; |
| 13864 | smsLog(pMac, LOG2, FL("called")); |
| 13865 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetRssiReq)); |
| 13866 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 13867 | { |
| 13868 | smsLog(pMac, LOGE, " csrGetRssi: failed to allocate mem for req \n"); |
| 13869 | return status; |
| 13870 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13871 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 13872 | |
| 13873 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_RSSI_REQ); |
| 13874 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 13875 | pMsg->sessionId = sessionId; |
| 13876 | pMsg->staId = staId; |
| 13877 | pMsg->rssiCallback = callback; |
| 13878 | pMsg->pDevContext = pContext; |
| 13879 | pMsg->pVosContext = pVosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13880 | msg.type = eWNI_SME_GET_RSSI_REQ; |
| 13881 | msg.bodyptr = pMsg; |
| 13882 | msg.reserved = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13883 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 13884 | { |
| 13885 | smsLog(pMac, LOGE, " csrGetRssi failed to post msg to self \n"); |
| 13886 | palFreeMemory(pMac->hHdd, (void *)pMsg); |
| 13887 | status = eHAL_STATUS_FAILURE; |
| 13888 | } |
| 13889 | smsLog(pMac, LOG2, FL("returned")); |
| 13890 | return status; |
| 13891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13892 | eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, |
| 13893 | tANI_U32 statsMask, |
| 13894 | tCsrStatsCallback callback, |
| 13895 | tANI_U32 periodicity, tANI_BOOLEAN cache, |
| 13896 | tANI_U8 staId, void *pContext) |
| 13897 | { |
| 13898 | tCsrStatsClientReqInfo staEntry; |
| 13899 | tCsrStatsClientReqInfo *pStaEntry = NULL; |
| 13900 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 13901 | tListElem *pEntry = NULL; |
| 13902 | tANI_BOOLEAN found = FALSE; |
| 13903 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13904 | tANI_BOOLEAN insertInClientList = FALSE; |
| 13905 | VOS_STATUS vosStatus; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13906 | WLANTL_TRANSFER_STA_TYPE *pTlStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13907 | |
| 13908 | if( csrIsAllSessionDisconnected(pMac) ) |
| 13909 | { |
| 13910 | //smsLog(pMac, LOGW, "csrGetStatistics: wrong state curState(%d) not connected\n", pMac->roam.curState); |
| 13911 | return eHAL_STATUS_FAILURE; |
| 13912 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13913 | if((!statsMask) && (!callback)) |
| 13914 | { |
| 13915 | //msg |
| 13916 | smsLog(pMac, LOGW, "csrGetStatistics: statsMask & callback empty in the request\n"); |
| 13917 | return eHAL_STATUS_FAILURE; |
| 13918 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13919 | //for the search list method for deregister |
| 13920 | staEntry.requesterId = requesterId; |
| 13921 | staEntry.statsMask = statsMask; |
| 13922 | //requester wants to deregister or just an error |
| 13923 | if((statsMask) && (!callback)) |
| 13924 | { |
| 13925 | pEntry = csrRoamChecknUpdateClientReqList(pMac, &staEntry, FALSE); |
| 13926 | if(!pEntry) |
| 13927 | { |
| 13928 | //msg |
| 13929 | smsLog(pMac, LOGW, "csrGetStatistics: callback is empty in the request & couldn't " |
| 13930 | "find any existing request in statsClientReqList\n"); |
| 13931 | return eHAL_STATUS_FAILURE; |
| 13932 | } |
| 13933 | else |
| 13934 | { |
| 13935 | //clean up & return |
| 13936 | pStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 13937 | if(NULL != pStaEntry->pPeStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13938 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13939 | pStaEntry->pPeStaEntry->numClient--; |
| 13940 | //check if we need to delete the entry from peStatsReqList too |
| 13941 | if(!pStaEntry->pPeStaEntry->numClient) |
| 13942 | { |
| 13943 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pStaEntry->pPeStaEntry); |
| 13944 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13945 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 13946 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13947 | //check if we need to stop the tl stats timer too |
| 13948 | pMac->roam.tlStatsReqInfo.numClient--; |
| 13949 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 13950 | { |
| 13951 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 13952 | { |
| 13953 | status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 13954 | if(!HAL_STATUS_SUCCESS(status)) |
| 13955 | { |
| 13956 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot stop TlStatsTimer timer\n")); |
| 13957 | return eHAL_STATUS_FAILURE; |
| 13958 | } |
| 13959 | } |
| 13960 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 13961 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 13962 | } |
| 13963 | vos_timer_stop( &pStaEntry->timer ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13964 | // Destroy the vos timer... |
| 13965 | vosStatus = vos_timer_destroy( &pStaEntry->timer ); |
| 13966 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 13967 | { |
| 13968 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer\n")); |
| 13969 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13970 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 13971 | pStaEntry = NULL; |
| 13972 | return eHAL_STATUS_SUCCESS; |
| 13973 | } |
| 13974 | } |
| 13975 | |
| 13976 | if(cache && !periodicity) |
| 13977 | { |
| 13978 | //return the cached stats |
| 13979 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 13980 | } |
| 13981 | else |
| 13982 | { |
| 13983 | //add the request in the client req list |
| 13984 | staEntry.callback = callback; |
| 13985 | staEntry.pContext = pContext; |
| 13986 | staEntry.periodicity = periodicity; |
| 13987 | staEntry.pPeStaEntry = NULL; |
| 13988 | staEntry.staId = staId; |
| 13989 | staEntry.pMac = pMac; |
| 13990 | staEntry.timerExpired = FALSE; |
| 13991 | |
| 13992 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13993 | //if periodic report requested with non cached result from PE/TL |
| 13994 | if(periodicity) |
| 13995 | { |
| 13996 | |
| 13997 | //if looking for stats from PE |
| 13998 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 13999 | { |
| 14000 | |
| 14001 | //check if same request made already & waiting for rsp |
| 14002 | pPeStaEntry = csrRoamCheckPeStatsReqList(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), |
| 14003 | periodicity, &found, staId); |
| 14004 | if(!pPeStaEntry) |
| 14005 | { |
| 14006 | //bail out, maxed out on number of req for PE |
| 14007 | return eHAL_STATUS_FAILURE; |
| 14008 | } |
| 14009 | else |
| 14010 | { |
| 14011 | staEntry.pPeStaEntry = pPeStaEntry; |
| 14012 | } |
| 14013 | |
| 14014 | } |
| 14015 | //request stats from TL rightaway if requested by client, update tlStatsReqInfo if needed |
| 14016 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 14017 | { |
| 14018 | if(cache && pMac->roam.tlStatsReqInfo.numClient) |
| 14019 | { |
| 14020 | smsLog(pMac, LOGE, FL("csrGetStatistics:Looking for cached stats from TL\n")); |
| 14021 | } |
| 14022 | else |
| 14023 | { |
| 14024 | |
| 14025 | //update periodicity |
| 14026 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 14027 | { |
| 14028 | pMac->roam.tlStatsReqInfo.periodicity = |
| 14029 | CSR_ROAM_MIN(periodicity, pMac->roam.tlStatsReqInfo.periodicity); |
| 14030 | } |
| 14031 | else |
| 14032 | { |
| 14033 | pMac->roam.tlStatsReqInfo.periodicity = periodicity; |
| 14034 | } |
| 14035 | if(pMac->roam.tlStatsReqInfo.periodicity < CSR_MIN_TL_STAT_QUERY_PERIOD) |
| 14036 | { |
| 14037 | pMac->roam.tlStatsReqInfo.periodicity = CSR_MIN_TL_STAT_QUERY_PERIOD; |
| 14038 | } |
| 14039 | |
| 14040 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 14041 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14042 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 14043 | if(NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14044 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14045 | //req TL for class D stats |
| 14046 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId)) |
| 14047 | { |
| 14048 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL\n")); |
| 14049 | } |
| 14050 | else |
| 14051 | { |
| 14052 | //save in SME |
| 14053 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 14054 | } |
| 14055 | vos_mem_free(pTlStats); |
| 14056 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14057 | } |
| 14058 | else |
| 14059 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14060 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14061 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14062 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14063 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 14064 | { |
| 14065 | //start timer |
| 14066 | status = palTimerStart(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 14067 | pMac->roam.tlStatsReqInfo.periodicity * PAL_TIMER_TO_MS_UNIT, eANI_BOOLEAN_FALSE); |
| 14068 | if(!HAL_STATUS_SUCCESS(status)) |
| 14069 | { |
| 14070 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start TlStatsTimer timer\n")); |
| 14071 | return eHAL_STATUS_FAILURE; |
| 14072 | } |
| 14073 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 14074 | } |
| 14075 | } |
| 14076 | } |
| 14077 | pMac->roam.tlStatsReqInfo.numClient++; |
| 14078 | } |
| 14079 | |
| 14080 | insertInClientList = TRUE; |
| 14081 | } |
| 14082 | //if one time report requested with non cached result from PE/TL |
| 14083 | else if(!cache && !periodicity) |
| 14084 | { |
| 14085 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 14086 | { |
| 14087 | //send down a req |
| 14088 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 14089 | if(!HAL_STATUS_SUCCESS(status)) |
| 14090 | { |
| 14091 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to send down stats req to PE\n")); |
| 14092 | } |
| 14093 | //so that when the stats rsp comes back from PE we respond to upper layer |
| 14094 | //right away |
| 14095 | staEntry.timerExpired = TRUE; |
| 14096 | insertInClientList = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14097 | } |
| 14098 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 14099 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14100 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
| 14101 | if(NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14102 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14103 | //req TL for class D stats |
| 14104 | if(!VOS_IS_STATUS_SUCCESS(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId))) |
| 14105 | { |
| 14106 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL\n")); |
| 14107 | } |
| 14108 | else |
| 14109 | { |
| 14110 | //save in SME |
| 14111 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 14112 | } |
| 14113 | vos_mem_free(pTlStats); |
| 14114 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14115 | } |
| 14116 | else |
| 14117 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14118 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14119 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14120 | |
| 14121 | } |
| 14122 | //if looking for stats from TL only |
| 14123 | if(!insertInClientList) |
| 14124 | { |
| 14125 | //return the stats |
| 14126 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 14127 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14128 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14129 | if(insertInClientList) |
| 14130 | { |
| 14131 | pStaEntry = csrRoamInsertEntryIntoList(pMac, &pMac->roam.statsClientReqList, &staEntry); |
| 14132 | if(!pStaEntry) |
| 14133 | { |
| 14134 | //msg |
| 14135 | smsLog(pMac, LOGW, "csrGetStatistics: Failed to insert req in statsClientReqList\n"); |
| 14136 | return eHAL_STATUS_FAILURE; |
| 14137 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14138 | pStaEntry->periodicity = periodicity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14139 | //Init & start timer if needed |
| 14140 | if(periodicity) |
| 14141 | { |
| 14142 | vosStatus = vos_timer_init( &pStaEntry->timer, VOS_TIMER_TYPE_SW, |
| 14143 | csrRoamStatsClientTimerHandler, pStaEntry ); |
| 14144 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14145 | { |
| 14146 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot init StatsClient timer\n")); |
| 14147 | return eHAL_STATUS_FAILURE; |
| 14148 | } |
| 14149 | vosStatus = vos_timer_start( &pStaEntry->timer, periodicity ); |
| 14150 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14151 | { |
| 14152 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer\n")); |
| 14153 | return eHAL_STATUS_FAILURE; |
| 14154 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14155 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14156 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14157 | } |
| 14158 | return eHAL_STATUS_SUCCESS; |
| 14159 | } |
| 14160 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14161 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 14162 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId) |
| 14163 | { |
| 14164 | tANI_BOOLEAN found = FALSE; |
| 14165 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14166 | tCsrPeStatsReqInfo staEntry; |
| 14167 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
| 14168 | tListElem *pStaEntry = NULL; |
| 14169 | VOS_STATUS vosStatus; |
| 14170 | tPmcPowerState powerState; |
| 14171 | *pFound = FALSE; |
| 14172 | |
| 14173 | pStaEntry = csrRoamFindInPeStatsReqList(pMac, statsMask); |
| 14174 | if(pStaEntry) |
| 14175 | { |
| 14176 | pTempStaEntry = GET_BASE_ADDR( pStaEntry, tCsrPeStatsReqInfo, link ); |
| 14177 | if(pTempStaEntry->periodicity) |
| 14178 | { |
| 14179 | pTempStaEntry->periodicity = |
| 14180 | CSR_ROAM_MIN(periodicity, pTempStaEntry->periodicity); |
| 14181 | } |
| 14182 | else |
| 14183 | { |
| 14184 | pTempStaEntry->periodicity = periodicity; |
| 14185 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14186 | pTempStaEntry->numClient++; |
| 14187 | found = TRUE; |
| 14188 | } |
| 14189 | else |
| 14190 | { |
| 14191 | palZeroMemory(pMac->hHdd, &staEntry, sizeof(tCsrPeStatsReqInfo)); |
| 14192 | staEntry.numClient = 1; |
| 14193 | staEntry.periodicity = periodicity; |
| 14194 | staEntry.pMac = pMac; |
| 14195 | staEntry.rspPending = FALSE; |
| 14196 | staEntry.staId = staId; |
| 14197 | staEntry.statsMask = statsMask; |
| 14198 | staEntry.timerRunning = FALSE; |
| 14199 | pTempStaEntry = csrRoamInsertEntryIntoPeStatsReqList(pMac, &pMac->roam.peStatsReqList, &staEntry); |
| 14200 | if(!pTempStaEntry) |
| 14201 | { |
| 14202 | //msg |
| 14203 | smsLog(pMac, LOGW, "csrRoamCheckPeStatsReqList: Failed to insert req in peStatsReqList\n"); |
| 14204 | return NULL; |
| 14205 | } |
| 14206 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14207 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 14208 | if(ePMC_FULL_POWER == powerState) |
| 14209 | { |
| 14210 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 14211 | { |
| 14212 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 14213 | } |
| 14214 | } |
| 14215 | else |
| 14216 | { |
| 14217 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 14218 | { |
| 14219 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 14220 | } |
| 14221 | } |
| 14222 | if(!pTempStaEntry->timerRunning) |
| 14223 | { |
| 14224 | //send down a req in case of one time req, for periodic ones wait for timer to expire |
| 14225 | if(!pTempStaEntry->rspPending && |
| 14226 | !pTempStaEntry->periodicity) |
| 14227 | { |
| 14228 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 14229 | if(!HAL_STATUS_SUCCESS(status)) |
| 14230 | { |
| 14231 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:failed to send down stats req to PE\n")); |
| 14232 | } |
| 14233 | else |
| 14234 | { |
| 14235 | pTempStaEntry->rspPending = TRUE; |
| 14236 | } |
| 14237 | } |
| 14238 | if(pTempStaEntry->periodicity) |
| 14239 | { |
| 14240 | if(!found) |
| 14241 | { |
| 14242 | |
| 14243 | vosStatus = vos_timer_init( &pTempStaEntry->hPeStatsTimer, VOS_TIMER_TYPE_SW, |
| 14244 | csrRoamPeStatsTimerHandler, pTempStaEntry ); |
| 14245 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14246 | { |
| 14247 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot init hPeStatsTimer timer\n")); |
| 14248 | return NULL; |
| 14249 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14250 | } |
| 14251 | //start timer |
| 14252 | smsLog(pMac, LOG1, "csrRoamCheckPeStatsReqList:peStatsTimer period %d\n", pTempStaEntry->periodicity); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14253 | vosStatus = vos_timer_start( &pTempStaEntry->hPeStatsTimer, pTempStaEntry->periodicity ); |
| 14254 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14255 | { |
| 14256 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot start hPeStatsTimer timer\n")); |
| 14257 | return NULL; |
| 14258 | } |
| 14259 | pTempStaEntry->timerRunning = TRUE; |
| 14260 | } |
| 14261 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14262 | *pFound = found; |
| 14263 | return pTempStaEntry; |
| 14264 | } |
| 14265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14266 | /* |
| 14267 | pStaEntry is no longer invalid upon the return of this function. |
| 14268 | */ |
| 14269 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry) |
| 14270 | { |
| 14271 | if(pEntry) |
| 14272 | { |
| 14273 | if(csrLLRemoveEntry(&pMac->roam.statsClientReqList, pEntry, LL_ACCESS_LOCK)) |
| 14274 | { |
| 14275 | palFreeMemory(pMac->hHdd, GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14276 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14277 | } |
| 14278 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14279 | |
| 14280 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry) |
| 14281 | { |
| 14282 | tListElem *pEntry; |
| 14283 | tCsrPeStatsReqInfo *pTempStaEntry; |
| 14284 | VOS_STATUS vosStatus; |
| 14285 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14286 | if(!pEntry) |
| 14287 | { |
| 14288 | //list empty |
| 14289 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: List empty, no stats req for PE\n"); |
| 14290 | return; |
| 14291 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14292 | while( pEntry ) |
| 14293 | { |
| 14294 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14295 | if( pTempStaEntry && pTempStaEntry->statsMask == pPeStaEntry->statsMask) |
| 14296 | { |
| 14297 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: match found\n"); |
| 14298 | if(pTempStaEntry->timerRunning) |
| 14299 | { |
| 14300 | vosStatus = vos_timer_stop( &pTempStaEntry->hPeStatsTimer ); |
| 14301 | /* If we are not able to stop the timer here, just remove |
| 14302 | * the entry from the linked list. Destroy the timer object |
| 14303 | * and free the memory in the timer CB |
| 14304 | */ |
| 14305 | if( vosStatus == VOS_STATUS_SUCCESS ) |
| 14306 | { |
| 14307 | /* the timer is successfully stopped */ |
| 14308 | pTempStaEntry->timerRunning = FALSE; |
| 14309 | |
| 14310 | /* Destroy the timer */ |
| 14311 | vosStatus = vos_timer_destroy( &pTempStaEntry->hPeStatsTimer ); |
| 14312 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14313 | { |
| 14314 | smsLog(pMac, LOGE, FL("csrRoamRemoveEntryFromPeStatsReqList:failed to destroy hPeStatsTimer timer\n")); |
| 14315 | } |
| 14316 | } |
| 14317 | else |
| 14318 | { |
| 14319 | // the timer could not be stopped. Hence destroy and free the |
| 14320 | // memory for the PE stat entry in the timer CB. |
| 14321 | pTempStaEntry->timerStopFailed = TRUE; |
| 14322 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14323 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14324 | |
| 14325 | if(csrLLRemoveEntry(&pMac->roam.peStatsReqList, pEntry, LL_ACCESS_LOCK)) |
| 14326 | { |
| 14327 | // Only free the memory if we could stop the timer successfully |
| 14328 | if(!pTempStaEntry->timerStopFailed) |
| 14329 | { |
| 14330 | palFreeMemory(pMac->hHdd, pTempStaEntry); |
| 14331 | pTempStaEntry = NULL; |
| 14332 | } |
| 14333 | break; |
| 14334 | } |
| 14335 | |
| 14336 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14337 | } |
| 14338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14339 | return; |
| 14340 | } |
| 14341 | |
| 14342 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14343 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14344 | { |
| 14345 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14346 | pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = pTlStats->rxBcntCRCok; |
| 14347 | pMac->roam.classDStatsInfo.rx_bc_byte_cnt = pTlStats->rxBCBcnt; |
| 14348 | pMac->roam.classDStatsInfo.rx_bc_frm_cnt = pTlStats->rxBCFcnt; |
| 14349 | pMac->roam.classDStatsInfo.rx_byte_cnt = pTlStats->rxBcnt; |
| 14350 | pMac->roam.classDStatsInfo.rx_mc_byte_cnt = pTlStats->rxMCBcnt; |
| 14351 | pMac->roam.classDStatsInfo.rx_mc_frm_cnt = pTlStats->rxMCFcnt; |
| 14352 | pMac->roam.classDStatsInfo.rx_rate = pTlStats->rxRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14353 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14354 | pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = pTlStats->rxUCBcnt; |
| 14355 | pMac->roam.classDStatsInfo.rx_uc_frm_cnt = pTlStats->rxUCFcnt; |
| 14356 | pMac->roam.classDStatsInfo.tx_bc_byte_cnt = pTlStats->txBCBcnt; |
| 14357 | pMac->roam.classDStatsInfo.tx_bc_frm_cnt = pTlStats->txBCFcnt; |
| 14358 | pMac->roam.classDStatsInfo.tx_mc_byte_cnt = pTlStats->txMCBcnt; |
| 14359 | pMac->roam.classDStatsInfo.tx_mc_frm_cnt = pTlStats->txMCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14360 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14361 | pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = pTlStats->txUCBcnt; |
| 14362 | pMac->roam.classDStatsInfo.tx_uc_frm_cnt = pTlStats->txUCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14363 | |
| 14364 | } |
| 14365 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14366 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 14367 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext) |
| 14368 | { |
| 14369 | tANI_U8 stats[500]; |
| 14370 | tANI_U8 *pStats = NULL; |
| 14371 | tANI_U32 tempMask = 0; |
| 14372 | tANI_U8 counter = 0; |
| 14373 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14374 | if(!callback) |
| 14375 | { |
| 14376 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report callback NULL\n")); |
| 14377 | return; |
| 14378 | } |
| 14379 | if(!statsMask) |
| 14380 | { |
| 14381 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report statsMask is 0\n")); |
| 14382 | return; |
| 14383 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14384 | pStats = stats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14385 | tempMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14386 | while(tempMask) |
| 14387 | { |
| 14388 | if(tempMask & 1) |
| 14389 | { |
| 14390 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 14391 | switch(counter) |
| 14392 | { |
| 14393 | case eCsrSummaryStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14394 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:summary stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14395 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 14396 | sizeof(tCsrSummaryStatsInfo)); |
| 14397 | if(!HAL_STATUS_SUCCESS(status)) |
| 14398 | { |
| 14399 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy summary stats\n")); |
| 14400 | } |
| 14401 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 14402 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14403 | case eCsrGlobalClassAStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14404 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassA stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14405 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 14406 | sizeof(tCsrGlobalClassAStatsInfo)); |
| 14407 | if(!HAL_STATUS_SUCCESS(status)) |
| 14408 | { |
| 14409 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassA stats\n")); |
| 14410 | } |
| 14411 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14412 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14413 | case eCsrGlobalClassBStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14414 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassB stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14415 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 14416 | sizeof(tCsrGlobalClassBStatsInfo)); |
| 14417 | if(!HAL_STATUS_SUCCESS(status)) |
| 14418 | { |
| 14419 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassB stats\n")); |
| 14420 | } |
| 14421 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14422 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14423 | case eCsrGlobalClassCStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14424 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassC stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14425 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 14426 | sizeof(tCsrGlobalClassCStatsInfo)); |
| 14427 | if(!HAL_STATUS_SUCCESS(status)) |
| 14428 | { |
| 14429 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassC stats\n")); |
| 14430 | } |
| 14431 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14432 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14433 | case eCsrGlobalClassDStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14434 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassD stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14435 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classDStatsInfo, |
| 14436 | sizeof(tCsrGlobalClassDStatsInfo)); |
| 14437 | if(!HAL_STATUS_SUCCESS(status)) |
| 14438 | { |
| 14439 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassD stats\n")); |
| 14440 | } |
| 14441 | pStats += sizeof(tCsrGlobalClassDStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14442 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14443 | case eCsrPerStaStats: |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14444 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:PerSta stats\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14445 | status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.perStaStatsInfo[staId], |
| 14446 | sizeof(tCsrPerStaStatsInfo)); |
| 14447 | if(!HAL_STATUS_SUCCESS(status)) |
| 14448 | { |
| 14449 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy PerSta stats\n")); |
| 14450 | } |
| 14451 | pStats += sizeof(tCsrPerStaStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14452 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14453 | default: |
| 14454 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:unknown stats type\n")); |
| 14455 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14456 | } |
| 14457 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14458 | tempMask >>=1; |
| 14459 | counter++; |
| 14460 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14461 | callback(stats, pContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14462 | } |
| 14463 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14464 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac) |
| 14465 | { |
| 14466 | tListElem *pEntry = NULL; |
| 14467 | tListElem *pPrevEntry = NULL; |
| 14468 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 14469 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14470 | VOS_STATUS vosStatus; |
| 14471 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14472 | if(!pEntry) |
| 14473 | { |
| 14474 | //list empty |
| 14475 | smsLog(pMac, LOGW, "csrRoamDeregStatisticsReq: List empty, no request from " |
| 14476 | "upper layer client(s)\n"); |
| 14477 | return status; |
| 14478 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14479 | while( pEntry ) |
| 14480 | { |
| 14481 | if(pPrevEntry) |
| 14482 | { |
| 14483 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 14484 | //send up the stats report |
| 14485 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 14486 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 14487 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 14488 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14489 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14490 | if (pTempStaEntry->pPeStaEntry) //pPeStaEntry can be NULL |
| 14491 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14492 | pTempStaEntry->pPeStaEntry->numClient--; |
| 14493 | //check if we need to delete the entry from peStatsReqList too |
| 14494 | if(!pTempStaEntry->pPeStaEntry->numClient) |
| 14495 | { |
| 14496 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry); |
| 14497 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14498 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14499 | //check if we need to stop the tl stats timer too |
| 14500 | pMac->roam.tlStatsReqInfo.numClient--; |
| 14501 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 14502 | { |
| 14503 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 14504 | { |
| 14505 | status = palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 14506 | if(!HAL_STATUS_SUCCESS(status)) |
| 14507 | { |
| 14508 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:cannot stop TlStatsTimer timer\n")); |
| 14509 | //we will continue |
| 14510 | } |
| 14511 | } |
| 14512 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 14513 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 14514 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14515 | if (pTempStaEntry->periodicity) |
| 14516 | { |
| 14517 | //While creating StaEntry in csrGetStatistics, |
| 14518 | //Initializing and starting timer only when periodicity is set. |
| 14519 | //So Stop and Destroy timer only when periodicity is set. |
| 14520 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14521 | vos_timer_stop( &pTempStaEntry->timer ); |
| 14522 | // Destroy the vos timer... |
| 14523 | vosStatus = vos_timer_destroy( &pTempStaEntry->timer ); |
| 14524 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14525 | { |
| 14526 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer\n")); |
| 14527 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14528 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14529 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14530 | |
| 14531 | pPrevEntry = pEntry; |
| 14532 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14533 | } |
| 14534 | //the last one |
| 14535 | if(pPrevEntry) |
| 14536 | { |
| 14537 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 14538 | //send up the stats report |
| 14539 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 14540 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 14541 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 14542 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14543 | return status; |
| 14544 | |
| 14545 | } |
| 14546 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14547 | eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 14548 | tRequestFullPowerReason *pReason, |
| 14549 | tANI_BOOLEAN *pfNeedPower ) |
| 14550 | { |
| 14551 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 14552 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
| 14553 | tPmcState pmcState; |
| 14554 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14555 | // TODO : Session info unavailable |
| 14556 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14557 | if( pfNeedPower ) |
| 14558 | { |
| 14559 | *pfNeedPower = eANI_BOOLEAN_FALSE; |
| 14560 | } |
| 14561 | //We only handle CSR commands |
| 14562 | if( !(eSmeCsrCommandMask & pCommand->command) ) |
| 14563 | { |
| 14564 | return eHAL_STATUS_SUCCESS; |
| 14565 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14566 | //Check PMC state first |
| 14567 | pmcState = pmcGetPmcState( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14568 | switch( pmcState ) |
| 14569 | { |
| 14570 | case REQUEST_IMPS: |
| 14571 | case IMPS: |
| 14572 | if( eSmeCommandScan == pCommand->command ) |
| 14573 | { |
| 14574 | switch( pCommand->u.scanCmd.reason ) |
| 14575 | { |
| 14576 | case eCsrScanGetResult: |
| 14577 | case eCsrScanBGScanAbort: |
| 14578 | case eCsrScanBGScanEnable: |
| 14579 | case eCsrScanGetScanChnInfo: |
| 14580 | //Internal process, no need for full power |
| 14581 | fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 14582 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14583 | default: |
| 14584 | //Other scans are real scan, ask for power |
| 14585 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14586 | break; |
| 14587 | } //switch |
| 14588 | } |
| 14589 | else |
| 14590 | { |
| 14591 | //ask for power for roam and status change |
| 14592 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14593 | } |
| 14594 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14595 | case REQUEST_BMPS: |
| 14596 | case BMPS: |
| 14597 | case REQUEST_START_UAPSD: |
| 14598 | case UAPSD: |
| 14599 | //We treat WOWL same as BMPS |
| 14600 | case REQUEST_ENTER_WOWL: |
| 14601 | case WOWL: |
| 14602 | if( eSmeCommandRoam == pCommand->command ) |
| 14603 | { |
| 14604 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 14605 | tCsrScanResult *pScanResult; |
| 14606 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14607 | switch ( pCommand->u.roamCmd.roamReason ) |
| 14608 | { |
| 14609 | case eCsrForcedDisassoc: |
| 14610 | case eCsrForcedDisassocMICFailure: |
| 14611 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 14612 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14613 | break; |
| 14614 | case eCsrSmeIssuedDisassocForHandoff: |
| 14615 | case eCsrForcedDeauth: |
| 14616 | case eCsrHddIssuedReassocToSameAP: |
| 14617 | case eCsrSmeIssuedReassocToSameAP: |
| 14618 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14619 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14620 | case eCsrCapsChange: |
| 14621 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14622 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14623 | default: |
| 14624 | //Check whether the profile is already connected. If so, no need for full power |
| 14625 | //Note: IBSS is ignored for now because we don't support powersave in IBSS |
| 14626 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && pBSSList ) |
| 14627 | { |
| 14628 | //Only need to check the first one |
| 14629 | pEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 14630 | if( pEntry ) |
| 14631 | { |
| 14632 | pScanResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link); |
| 14633 | #if 0 |
| 14634 | // TODO : Session Specific info pConnectBssDesc |
| 14635 | if( csrIsBssIdEqual( pMac, &pScanResult->Result.BssDescriptor, pMac->roam.pConnectBssDesc ) && |
| 14636 | csrIsSsidEqual( pMac, pMac->roam.pConnectBssDesc, |
| 14637 | &pScanResult->Result.BssDescriptor, (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ) ) ) |
| 14638 | { |
| 14639 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 14640 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 14641 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 14642 | // a new Association. |
| 14643 | if(csrIsSameProfile(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 14644 | { |
| 14645 | if(csrRoamIsSameProfileKeys(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 14646 | { |
| 14647 | //Done, eventually, the command reaches eCsrReassocToSelfNoCapChange; |
| 14648 | //No need for full power |
| 14649 | //Set the flag so the code later can avoid to do the above |
| 14650 | //check again. |
| 14651 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_TRUE; |
| 14652 | break; |
| 14653 | } |
| 14654 | } |
| 14655 | } |
| 14656 | #endif |
| 14657 | } |
| 14658 | } |
| 14659 | //If we are here, full power is needed |
| 14660 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14661 | break; |
| 14662 | } |
| 14663 | } |
| 14664 | else if( eSmeCommandWmStatusChange == pCommand->command ) |
| 14665 | { |
| 14666 | //need full power for all |
| 14667 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14668 | reason = eSME_LINK_DISCONNECTED_BY_OTHER; |
| 14669 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14670 | #ifdef FEATURE_WLAN_TDLS |
| 14671 | else if( eSmeCommandTdlsAddPeer == pCommand->command ) |
| 14672 | { |
| 14673 | //TDLS link is getting established. need full power |
| 14674 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14675 | reason = eSME_FULL_PWR_NEEDED_BY_TDLS_PEER_SETUP; |
| 14676 | } |
| 14677 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14678 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14679 | case REQUEST_STOP_UAPSD: |
| 14680 | case REQUEST_EXIT_WOWL: |
| 14681 | if( eSmeCommandRoam == pCommand->command ) |
| 14682 | { |
| 14683 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 14684 | switch ( pCommand->u.roamCmd.roamReason ) |
| 14685 | { |
| 14686 | case eCsrForcedDisassoc: |
| 14687 | case eCsrForcedDisassocMICFailure: |
| 14688 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 14689 | break; |
| 14690 | default: |
| 14691 | break; |
| 14692 | } |
| 14693 | } |
| 14694 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14695 | case STOPPED: |
| 14696 | case REQUEST_STANDBY: |
| 14697 | case STANDBY: |
| 14698 | case LOW_POWER: |
| 14699 | //We are not supposed to do anything |
| 14700 | smsLog( pMac, LOGE, FL( " cannot process because PMC is in stopped/standby state %d\n" ), pmcState ); |
| 14701 | status = eHAL_STATUS_FAILURE; |
| 14702 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14703 | case FULL_POWER: |
| 14704 | case REQUEST_FULL_POWER: |
| 14705 | default: |
| 14706 | //No need to ask for full power. This has to be FULL_POWER state |
| 14707 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14708 | } //switch |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14709 | if( pReason ) |
| 14710 | { |
| 14711 | *pReason = reason; |
| 14712 | } |
| 14713 | if( pfNeedPower ) |
| 14714 | { |
| 14715 | *pfNeedPower = fNeedFullPower; |
| 14716 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14717 | return ( status ); |
| 14718 | } |
| 14719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14720 | static eHalStatus csrRequestFullPower( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 14721 | { |
| 14722 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14723 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 14724 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14725 | status = csrIsFullPowerNeeded( pMac, pCommand, &reason, &fNeedFullPower ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14726 | if( fNeedFullPower && HAL_STATUS_SUCCESS( status ) ) |
| 14727 | { |
| 14728 | status = pmcRequestFullPower(pMac, csrFullPowerCallback, pMac, reason); |
| 14729 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14730 | return ( status ); |
| 14731 | } |
| 14732 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14733 | tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac ) |
| 14734 | { |
| 14735 | tSmeCmd *pCmd = smeGetCommandBuffer( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14736 | if( pCmd ) |
| 14737 | { |
| 14738 | pMac->roam.sPendingCommands++; |
| 14739 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14740 | return ( pCmd ); |
| 14741 | } |
| 14742 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14743 | void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 14744 | { |
| 14745 | if (pMac->roam.sPendingCommands > 0) |
| 14746 | { |
| 14747 | //All command allocated through csrGetCommandBuffer need to |
| 14748 | //decrement the pending count when releasing. |
| 14749 | pMac->roam.sPendingCommands--; |
| 14750 | smeReleaseCommand( pMac, pCommand ); |
| 14751 | } |
| 14752 | else |
| 14753 | { |
| 14754 | smsLog(pMac, LOGE, FL( "no pending commands")); |
| 14755 | VOS_ASSERT(0); |
| 14756 | } |
| 14757 | } |
| 14758 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14759 | //Return SUCCESS is the command is queued, failed |
| 14760 | eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority ) |
| 14761 | { |
| 14762 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14763 | if( (eSmeCommandScan == pCommand->command) && pMac->scan.fDropScanCmd ) |
| 14764 | { |
| 14765 | smsLog(pMac, LOGW, FL(" drop scan (scan reason %d) command"), |
| 14766 | pCommand->u.scanCmd.reason); |
| 14767 | return eHAL_STATUS_CSR_WRONG_STATE; |
| 14768 | } |
| 14769 | |
| 14770 | //We can call request full power first before putting the command into pending Q |
| 14771 | //because we are holding SME lock at this point. |
| 14772 | status = csrRequestFullPower( pMac, pCommand ); |
| 14773 | if( HAL_STATUS_SUCCESS( status ) ) |
| 14774 | { |
| 14775 | tANI_BOOLEAN fNoCmdPending; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14776 | //make sure roamCmdPendingList is not empty first |
| 14777 | fNoCmdPending = csrLLIsListEmpty( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_FALSE ); |
| 14778 | if( fNoCmdPending ) |
| 14779 | { |
| 14780 | smePushCommand( pMac, pCommand, fHighPriority ); |
| 14781 | } |
| 14782 | else |
| 14783 | { |
| 14784 | //Other commands are waiting for PMC callback, queue the new command to the pending Q |
| 14785 | //no list lock is needed since SME lock is held |
| 14786 | if( !fHighPriority ) |
| 14787 | { |
| 14788 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14789 | } |
| 14790 | else { |
| 14791 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14792 | } |
| 14793 | } |
| 14794 | } |
| 14795 | else if( eHAL_STATUS_PMC_PENDING == status ) |
| 14796 | { |
| 14797 | //no list lock is needed since SME lock is held |
| 14798 | if( !fHighPriority ) |
| 14799 | { |
| 14800 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14801 | } |
| 14802 | else { |
| 14803 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 14804 | } |
| 14805 | //Let caller know the command is queue |
| 14806 | status = eHAL_STATUS_SUCCESS; |
| 14807 | } |
| 14808 | else |
| 14809 | { |
| 14810 | //Not to decrease pMac->roam.sPendingCommands here. Caller will decrease it when it |
| 14811 | //release the command. |
| 14812 | smsLog( pMac, LOGE, FL( " cannot queue command %d\n" ), pCommand->command ); |
| 14813 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14814 | return ( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14815 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14816 | #ifdef WLAN_SOFTAP_FEATURE |
| 14817 | eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs* pAPWPSIES ) |
| 14818 | { |
| 14819 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14820 | tSirUpdateAPWPSIEsReq *pMsg; |
| 14821 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 14822 | |
| 14823 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14824 | if (NULL == pSession) |
| 14825 | { |
| 14826 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 14827 | return eHAL_STATUS_FAILURE; |
| 14828 | } |
| 14829 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14830 | do |
| 14831 | { |
| 14832 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPSIEsReq) ); |
| 14833 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 14834 | palZeroMemory( pMac->hHdd, pMsg, sizeof(tSirUpdateAPWPSIEsReq) ); |
| 14835 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPDATE_APWPSIE_REQ); |
| 14836 | |
| 14837 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 14838 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14839 | // transactionId |
| 14840 | *pBuf = 0; |
| 14841 | *( pBuf + 1 ) = 0; |
| 14842 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14843 | // bssId |
| 14844 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 14845 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14846 | //sessionId |
| 14847 | *pBuf++ = (tANI_U8)sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14848 | // APWPSIEs |
| 14849 | palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *)pBuf, pAPWPSIES, sizeof(tSirAPWPSIEs)); |
| 14850 | pBuf += sizeof(tSirAPWPSIEs); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14851 | 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] | 14852 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14853 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14854 | return ( status ); |
| 14855 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14856 | eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie) |
| 14857 | { |
| 14858 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14859 | tSirUpdateAPWPARSNIEsReq *pMsg; |
| 14860 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14861 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14862 | if (NULL == pSession) |
| 14863 | { |
| 14864 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 14865 | return eHAL_STATUS_FAILURE; |
| 14866 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14867 | do |
| 14868 | { |
| 14869 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPARSNIEsReq) ); |
| 14870 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 14871 | palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirUpdateAPWPARSNIEsReq ) ); |
| 14872 | 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] | 14873 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 14874 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14875 | // transactionId |
| 14876 | *pBuf = 0; |
| 14877 | *( pBuf + 1 ) = 0; |
| 14878 | pBuf += sizeof(tANI_U16); |
| 14879 | |
| 14880 | // bssId |
| 14881 | palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) ); |
| 14882 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14883 | // sessionId |
| 14884 | *pBuf++ = (tANI_U8)sessionId; |
| 14885 | |
| 14886 | // APWPARSNIEs |
| 14887 | palCopyMemory( pMac->hHdd, (tSirRSNie *)pBuf, pAPSirRSNie, sizeof(tSirRSNie)); |
| 14888 | pBuf += sizeof(tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14889 | 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] | 14890 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14891 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14892 | return ( status ); |
| 14893 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14894 | #endif //#ifdef WLAN_SOFTAP_FEATURE |
| 14895 | |
| 14896 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 14897 | //eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tCsrBssid preAuthBssid, tANI_U8 channelId) |
| 14898 | eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription) |
| 14899 | { |
| 14900 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 14901 | tpSirFTPreAuthReq pftPreAuthReq; |
| 14902 | tANI_U16 auth_req_len = 0; |
| 14903 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14904 | auth_req_len = sizeof(tSirFTPreAuthReq); |
| 14905 | pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len); |
| 14906 | if (pftPreAuthReq == NULL) |
| 14907 | { |
| 14908 | smsLog(pMac, LOGE, FL("Memory allocation for FT Preauth request failed")); |
| 14909 | return eHAL_STATUS_RESOURCES; |
| 14910 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14911 | // Save the SME Session ID here. We need it while processing the preauth response |
| 14912 | pMac->ft.ftSmeContext.smeSessionId = sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14913 | vos_mem_zero(pftPreAuthReq, auth_req_len); |
| 14914 | |
| 14915 | pftPreAuthReq->pbssDescription = (tpSirBssDescription)vos_mem_malloc( |
| 14916 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 14917 | |
| 14918 | pftPreAuthReq->messageType = pal_cpu_to_be16(eWNI_SME_FT_PRE_AUTH_REQ); |
| 14919 | |
| 14920 | pftPreAuthReq->preAuthchannelNum = pBssDescription->channelId; |
| 14921 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14922 | palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->currbssId, (void *)pSession->connectedProfile.bssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14923 | palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->preAuthbssId, (void *)pBssDescription->bssId, sizeof(tSirMacAddr)); |
| 14924 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14925 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 14926 | if (csrRoamIs11rAssoc(pMac) && |
| 14927 | (pMac->roam.roamSession[sessionId].connectedProfile.AuthType != eCSR_AUTH_TYPE_OPEN_SYSTEM)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14928 | { |
| 14929 | pftPreAuthReq->ft_ies_length = (tANI_U16)pMac->ft.ftSmeContext.auth_ft_ies_length; |
| 14930 | palCopyMemory(pMac->hHdd, pftPreAuthReq->ft_ies, pMac->ft.ftSmeContext.auth_ft_ies, |
| 14931 | pMac->ft.ftSmeContext.auth_ft_ies_length); |
| 14932 | } |
| 14933 | else |
| 14934 | #endif |
| 14935 | { |
| 14936 | pftPreAuthReq->ft_ies_length = 0; |
| 14937 | } |
Madan Mohan Koyyalamudi | 613b0a4 | 2012-10-31 15:55:53 -0700 | [diff] [blame] | 14938 | vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription, |
| 14939 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 14940 | pftPreAuthReq->length = pal_cpu_to_be16(auth_req_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14941 | return palSendMBMessage(pMac->hHdd, pftPreAuthReq); |
| 14942 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14943 | /*-------------------------------------------------------------------------- |
| 14944 | * This will receive and process the FT Pre Auth Rsp from the current |
| 14945 | * associated ap. |
| 14946 | * |
| 14947 | * This will invoke the hdd call back. This is so that hdd can now |
| 14948 | * send the FTIEs from the Auth Rsp (Auth Seq 2) to the supplicant. |
| 14949 | ------------------------------------------------------------------------*/ |
| 14950 | void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp ) |
| 14951 | { |
| 14952 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 14953 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14954 | #ifdef FEATURE_WLAN_LFR |
| 14955 | tCsrRoamInfo roamInfo; |
| 14956 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14957 | |
| 14958 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 14959 | smsLog( pMac, LOGE, FL("Preauth response status code 0x%x"), pFTPreAuthRsp->status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14960 | #endif |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 14961 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 14962 | status = csrNeighborRoamPreauthRspHandler(pMac, pFTPreAuthRsp->status); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 14963 | if (status != eHAL_STATUS_SUCCESS) { |
| 14964 | /* |
| 14965 | * Bail out if pre-auth was not even processed. |
| 14966 | */ |
| 14967 | smsLog(pMac, LOGW, FL("Preauth was not processed: %d"), status); |
| 14968 | return; |
| 14969 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14970 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14971 | /* The below function calls/timers should be invoked only if the pre-auth is successful */ |
| 14972 | if (VOS_STATUS_SUCCESS != (VOS_STATUS)pFTPreAuthRsp->status) |
| 14973 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14974 | // Implies a success |
| 14975 | pMac->ft.ftSmeContext.FTState = eFT_AUTH_COMPLETE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14976 | // Indicate SME QoS module the completion of Preauth success. This will trigger the creation of RIC IEs |
| 14977 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = pFTPreAuthRsp; |
| 14978 | 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] | 14979 | /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, |
| 14980 | * actual transition from the current to handoff AP is triggered */ |
| 14981 | status = palTimerStart(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer, |
| 14982 | 60 * PAL_TIMER_TO_MS_UNIT, |
| 14983 | eANI_BOOLEAN_FALSE); |
| 14984 | if (eHAL_STATUS_SUCCESS != status) |
| 14985 | { |
| 14986 | smsLog(pMac, LOGE, FL("Preauth reassoc interval timer start failed to start with status %d\n"), status); |
| 14987 | return; |
| 14988 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14989 | // Save the received response |
| 14990 | palCopyMemory(pMac->hHdd, (void *)&pMac->ft.ftSmeContext.preAuthbssId, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 14991 | if (csrRoamIs11rAssoc(pMac)) |
| 14992 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, NULL, 0, |
| 14993 | eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE); |
| 14994 | |
| 14995 | // Currently we dont do anything special for CCX connection. |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14996 | #ifdef FEATURE_WLAN_LFR |
| 14997 | // If Legacy Fast Roaming is enabled, signal the supplicant |
| 14998 | // 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] | 14999 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15000 | { |
| 15001 | // Save the bssid from the received response |
| 15002 | palCopyMemory(pMac->hHdd, (void *)&roamInfo.bssid, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 15003 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_PMK_NOTIFY, 0); |
| 15004 | } |
| 15005 | |
| 15006 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15007 | |
| 15008 | // Done with it, init it. |
| 15009 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL; |
| 15010 | } |
| 15011 | #endif |
| 15012 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 15013 | void csrRoamJoinRetryTimerHandler(void *pv) |
| 15014 | { |
| 15015 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 15016 | tpAniSirGlobal pMac = pInfo->pMac; |
| 15017 | tANI_U32 sessionId = pInfo->sessionId; |
| 15018 | tCsrRoamSession *pSession; |
| 15019 | |
| 15020 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 15021 | { |
| 15022 | smsLog( pMac, LOGE, FL( " retrying the last roam profile on session %d\n" ), sessionId ); |
| 15023 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15024 | if(pSession->pCurRoamProfile && csrIsConnStateDisconnected(pMac, sessionId)) |
| 15025 | { |
| 15026 | if( !HAL_STATUS_SUCCESS(csrRoamJoinLastProfile(pMac, sessionId)) ) |
| 15027 | { |
| 15028 | smsLog( pMac, LOGE, FL( " fail to retry the last roam profile\n" ) ); |
| 15029 | } |
| 15030 | } |
| 15031 | } |
| 15032 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15033 | eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 15034 | { |
| 15035 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15036 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15037 | |
| 15038 | if(pSession->pCurRoamProfile && pSession->maxRetryCount) |
| 15039 | { |
| 15040 | smsLog(pMac, LOGE, FL(" call sessionId %d retry count %d left\n "), sessionId, pSession->maxRetryCount); |
| 15041 | pSession->maxRetryCount--; |
| 15042 | pSession->joinRetryTimerInfo.pMac = pMac; |
| 15043 | pSession->joinRetryTimerInfo.sessionId = (tANI_U8)sessionId; |
| 15044 | status = palTimerStart(pMac->hHdd, pSession->hTimerJoinRetry, interval, eANI_BOOLEAN_FALSE); |
| 15045 | if(!HAL_STATUS_SUCCESS(status)) |
| 15046 | { |
| 15047 | smsLog(pMac, LOGE, FL(" fail to start timer status %s \n "), status); |
| 15048 | } |
| 15049 | } |
| 15050 | else |
| 15051 | { |
| 15052 | smsLog(pMac, LOGE, FL(" not to start timer due to no profile or reach mac ret (%d)\n "), |
| 15053 | pSession->maxRetryCount); |
| 15054 | } |
| 15055 | |
| 15056 | return (status); |
| 15057 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15058 | eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 15059 | { |
| 15060 | smsLog(pMac, LOGE, " csrRoamStopJoinRetryTimer \n "); |
| 15061 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 15062 | { |
| 15063 | return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerJoinRetry)); |
| 15064 | } |
| 15065 | |
| 15066 | return eHAL_STATUS_SUCCESS; |
| 15067 | } |
| 15068 | #endif |
| 15069 | |
| 15070 | |
| 15071 | /* |
| 15072 | pBuf points to the beginning of the message |
| 15073 | LIM packs disassoc rsp as below, |
| 15074 | messageType - 2 bytes |
| 15075 | messageLength - 2 bytes |
| 15076 | sessionId - 1 byte |
| 15077 | transactionId - 2 bytes (tANI_U16) |
| 15078 | reasonCode - 4 bytes (sizeof(tSirResultCodes)) |
| 15079 | peerMacAddr - 6 bytes |
| 15080 | The rest is conditionally defined of (WNI_POLARIS_FW_PRODUCT == AP) and not used |
| 15081 | */ |
| 15082 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp) |
| 15083 | { |
| 15084 | if(pBuf && pRsp) |
| 15085 | { |
| 15086 | pBuf += 4; //skip type and length |
| 15087 | pRsp->sessionId = *pBuf++; |
| 15088 | pal_get_U16( pBuf, (tANI_U16 *)&pRsp->transactionId ); |
| 15089 | pBuf += 2; |
| 15090 | pal_get_U32( pBuf, (tANI_U32 *)&pRsp->statusCode ); |
| 15091 | pBuf += 4; |
| 15092 | vos_mem_copy(pRsp->peerMacAddr, pBuf, 6); |
| 15093 | } |
| 15094 | } |
| 15095 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 15096 | eHalStatus csrGetDefaultCountryCodeFrmNv(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 15097 | { |
| 15098 | static uNvTables nvTables; |
| 15099 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15100 | VOS_STATUS vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 15101 | |
| 15102 | /* read the country code from NV and use it */ |
| 15103 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 15104 | { |
| 15105 | palCopyMemory( pMac->hHdd, pCountry, |
| 15106 | nvTables.defaultCountryTable.countryCode, |
| 15107 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 15108 | return status; |
| 15109 | } |
| 15110 | else |
| 15111 | { |
| 15112 | palCopyMemory( pMac->hHdd, pCountry, |
| 15113 | "XXX", |
| 15114 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 15115 | status = eHAL_STATUS_FAILURE; |
| 15116 | return status; |
| 15117 | } |
| 15118 | } |
| 15119 | |
| 15120 | eHalStatus csrGetCurrentCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 15121 | { |
| 15122 | palCopyMemory( pMac->hHdd, pCountry, |
| 15123 | pMac->scan.countryCode11d, |
| 15124 | WNI_CFG_COUNTRY_CODE_LEN ); |
| 15125 | return eHAL_STATUS_SUCCESS; |
| 15126 | } |