Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 0fb93dd | 2014-02-19 00:32:59 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2014 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 | |
| 22 | /* |
| 23 | * Copyright (c) 2012-2014 Qualcomm Atheros, Inc. |
| 24 | * All Rights Reserved. |
| 25 | * Qualcomm Atheros Confidential and Proprietary. |
| 26 | * |
| 27 | */ |
| 28 | |
| 29 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 30 | /** ------------------------------------------------------------------------- * |
| 31 | ------------------------------------------------------------------------- * |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 32 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 33 | |
| 34 | \file csrApiRoam.c |
| 35 | |
| 36 | Implementation for the Common Roaming interfaces. |
| 37 | |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 38 | Copyright (C) 2008 Qualcomm, Incorporated |
| 39 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 40 | |
| 41 | ========================================================================== */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | /*=========================================================================== |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 43 | EDIT HISTORY FOR FILE |
| 44 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 45 | This section contains comments describing changes made to the module. |
| 46 | Notice that changes are listed in reverse chronological order. |
| 47 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 48 | when who what, where, why |
| 49 | ---------- --- -------------------------------------------------------- |
| 50 | 06/03/10 js Added support to hostapd driven |
| 51 | * deauth/disassoc/mic failure |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 52 | ===========================================================================*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 53 | #include "aniGlobal.h" //for tpAniSirGlobal |
| 54 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | #include "halMsgApi.h" //for HAL_STA_INVALID_IDX. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 56 | #include "limUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 57 | #include "palApi.h" |
| 58 | #include "csrInsideApi.h" |
| 59 | #include "smsDebug.h" |
| 60 | #include "logDump.h" |
| 61 | #include "smeQosInternal.h" |
| 62 | #include "wlan_qct_tl.h" |
| 63 | #include "smeInside.h" |
| 64 | #include "vos_diag_core_event.h" |
| 65 | #include "vos_diag_core_log.h" |
| 66 | #include "csrApi.h" |
| 67 | #include "pmc.h" |
| 68 | #include "vos_nvitem.h" |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 69 | #include "macTrace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 70 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 71 | #include "csrNeighborRoam.h" |
| 72 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 73 | #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) |
| 74 | #include "csrEse.h" |
| 75 | #endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 76 | #define CSR_NUM_IBSS_START_CHANNELS_50 4 |
| 77 | #define CSR_NUM_IBSS_START_CHANNELS_24 3 |
| 78 | #define CSR_DEF_IBSS_START_CHANNEL_50 36 |
| 79 | #define CSR_DEF_IBSS_START_CHANNEL_24 1 |
Srikant Kuppa | 2062aaf | 2012-12-27 17:36:41 -0800 | [diff] [blame] | 80 | #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] | 81 | #define CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD ( 120 * PAL_TIMER_TO_SEC_UNIT ) // 120 seconds, for WPS |
| 82 | /*--------------------------------------------------------------------------- |
| 83 | OBIWAN recommends [8 10]% : pick 9% |
| 84 | ---------------------------------------------------------------------------*/ |
| 85 | #define CSR_VCC_UL_MAC_LOSS_THRESHOLD 9 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 86 | /*--------------------------------------------------------------------------- |
| 87 | OBIWAN recommends -85dBm |
| 88 | ---------------------------------------------------------------------------*/ |
| 89 | #define CSR_VCC_RSSI_THRESHOLD 80 |
| 90 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD 500 //ms |
| 91 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS 2000 //ms |
| 92 | #define CSR_MIN_TL_STAT_QUERY_PERIOD 500 //ms |
| 93 | #define CSR_DIAG_LOG_STAT_PERIOD 3000 //ms |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 94 | //We use constatnt 4 here |
| 95 | //This macro returns true when higher AC parameter is bigger than lower AC for a difference |
| 96 | //The bigger the number, the less chance of TX |
| 97 | //It must put lower AC as the first parameter. |
| 98 | #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] | 99 | //Flag to send/do not send disassoc frame over the air |
| 100 | #define CSR_DONT_SEND_DISASSOC_OVER_THE_AIR 1 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 101 | #define RSSI_HACK_BMPS (-40) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 102 | #define MAX_CB_VALUE_IN_INI (2) |
| 103 | |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 104 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 105 | static tANI_BOOLEAN bRoamScanOffloadStarted = VOS_FALSE; |
| 106 | #endif |
| 107 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | /*-------------------------------------------------------------------------- |
| 109 | Static Type declarations |
| 110 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 111 | static tCsrRoamSession csrRoamRoamSession[CSR_ROAM_SESSION_MAX]; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 112 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 113 | /*-------------------------------------------------------------------------- |
| 114 | Type declarations |
| 115 | ------------------------------------------------------------------------*/ |
| 116 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 117 | int diagAuthTypeFromCSRType(eCsrAuthType authType) |
| 118 | { |
| 119 | int n = AUTH_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 120 | switch(authType) |
| 121 | { |
| 122 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 123 | n = AUTH_SHARED; |
| 124 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | case eCSR_AUTH_TYPE_WPA: |
| 126 | n = AUTH_WPA_EAP; |
| 127 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 128 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 129 | n = AUTH_WPA_PSK; |
| 130 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 131 | case eCSR_AUTH_TYPE_RSN: |
| 132 | n = AUTH_WPA2_EAP; |
| 133 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 134 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 135 | #ifdef WLAN_FEATURE_11W |
| 136 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 137 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 138 | n = AUTH_WPA2_PSK; |
| 139 | break; |
| 140 | #ifdef FEATURE_WLAN_WAPI |
| 141 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 142 | n = AUTH_WAPI_CERT; |
| 143 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 144 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 145 | n = AUTH_WAPI_PSK; |
| 146 | break; |
| 147 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 148 | default: |
| 149 | break; |
| 150 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 151 | return (n); |
| 152 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 153 | int diagEncTypeFromCSRType(eCsrEncryptionType encType) |
| 154 | { |
| 155 | int n = ENC_MODE_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 156 | switch(encType) |
| 157 | { |
| 158 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 159 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 160 | n = ENC_MODE_WEP40; |
| 161 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 162 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 163 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 164 | n = ENC_MODE_WEP104; |
| 165 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 166 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 167 | n = ENC_MODE_TKIP; |
| 168 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 169 | case eCSR_ENCRYPT_TYPE_AES: |
| 170 | n = ENC_MODE_AES; |
| 171 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 172 | #ifdef FEATURE_WLAN_WAPI |
| 173 | case eCSR_ENCRYPT_TYPE_WPI: |
| 174 | n = ENC_MODE_SMS4; |
| 175 | break; |
| 176 | #endif /* FEATURE_WLAN_WAPI */ |
| 177 | default: |
| 178 | break; |
| 179 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 180 | return (n); |
| 181 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 182 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 183 | static const tANI_U8 csrStartIbssChannels50[ CSR_NUM_IBSS_START_CHANNELS_50 ] = { 36, 40, 44, 48}; |
| 184 | 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] | 185 | static void initConfigParam(tpAniSirGlobal pMac); |
| 186 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 187 | eCsrRoamCompleteResult Result, void *Context ); |
| 188 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 189 | tCsrRoamProfile *pProfile, |
| 190 | tANI_BOOLEAN *pfSameIbss ); |
| 191 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirSmeNewBssInfo *pNewBss ); |
| 192 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 193 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes); |
| 194 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 195 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac); |
| 196 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ); |
| 197 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac); |
| 198 | eHalStatus csrRoamClose(tpAniSirGlobal pMac); |
| 199 | void csrRoamMICErrorTimerHandler(void *pv); |
| 200 | void csrRoamTKIPCounterMeasureTimerHandler(void *pv); |
| 201 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2); |
| 202 | |
| 203 | static eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 204 | static eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 205 | static void csrRoamRoamingTimerHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 206 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval); |
| 207 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac); |
| 208 | static void csrRoamWaitForKeyTimeOutHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 209 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 210 | static eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 211 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ); |
| 212 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 213 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 214 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 215 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 216 | tANI_U8 *pKeyRsc ); |
| 217 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 218 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, |
| 219 | tCsrRoamProfile *pProfile ); |
| 220 | void csrRoamStatisticsTimerHandler(void *pv); |
| 221 | void csrRoamStatsGlobalClassDTimerHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 222 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid); |
| 223 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 224 | v_U8_t rssiNotification, |
| 225 | void * context); |
| 226 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 227 | void csrRoamVccTrigger(tpAniSirGlobal pMac); |
| 228 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId); |
| 229 | /* |
| 230 | pStaEntry is no longer invalid upon the return of this function. |
| 231 | */ |
| 232 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 233 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile,tANI_U8 operationChn, eCsrBand *pBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 234 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 235 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 236 | tDblLinkList *pStaList, |
| 237 | tCsrStatsClientReqInfo *pStaEntry); |
| 238 | void csrRoamStatsClientTimerHandler(void *pv); |
| 239 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 240 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId); |
| 241 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 242 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 243 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 244 | void csrRoamTlStatsTimerHandler(void *pv); |
| 245 | void csrRoamPeStatsTimerHandler(void *pv); |
| 246 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 247 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry); |
| 248 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 249 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac); |
| 250 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ); |
| 251 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ); |
| 252 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ); |
| 253 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 254 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ); |
| 255 | //static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ); |
| 256 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
| 257 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac); |
| 258 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 259 | void csrRoamJoinRetryTimerHandler(void *pv); |
| 260 | #endif |
| 261 | extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 262 | extern void btampEstablishLogLinkHdlr(void* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 263 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 264 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 265 | |
| 266 | //Initialize global variables |
| 267 | static void csrRoamInitGlobals(tpAniSirGlobal pMac) |
| 268 | { |
| 269 | if(pMac) |
| 270 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 271 | vos_mem_zero(&csrRoamRoamSession, sizeof(csrRoamRoamSession)); |
| 272 | pMac->roam.roamSession = csrRoamRoamSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 273 | } |
| 274 | return; |
| 275 | } |
| 276 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 277 | static void csrRoamDeInitGlobals(tpAniSirGlobal pMac) |
| 278 | { |
| 279 | if(pMac) |
| 280 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 281 | pMac->roam.roamSession = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | } |
| 283 | return; |
| 284 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 285 | eHalStatus csrOpen(tpAniSirGlobal pMac) |
| 286 | { |
| 287 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 288 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 289 | static uNvTables nvTables; |
| 290 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 291 | v_REGDOMAIN_t regId; |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 292 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 293 | tANI_U32 i; |
| 294 | |
| 295 | do |
| 296 | { |
| 297 | /* Initialize CSR Roam Globals */ |
| 298 | csrRoamInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 299 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 300 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i); |
| 301 | |
| 302 | initConfigParam(pMac); |
| 303 | if(!HAL_STATUS_SUCCESS((status = csrScanOpen(pMac)))) |
| 304 | break; |
| 305 | if(!HAL_STATUS_SUCCESS((status = csrRoamOpen(pMac)))) |
| 306 | break; |
| 307 | pMac->roam.nextRoamId = 1; //Must not be 0 |
| 308 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.statsClientReqList))) |
| 309 | break; |
| 310 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.peStatsReqList))) |
| 311 | break; |
| 312 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.roamCmdPendingList))) |
| 313 | break; |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 314 | |
| 315 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 316 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 317 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 318 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 319 | vos_mem_copy(pMac->scan.countryCodeDefault, nvTables.defaultCountryTable.countryCode, |
| 320 | WNI_CFG_COUNTRY_CODE_LEN); |
| 321 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 322 | } |
| 323 | else |
| 324 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 325 | smsLog( pMac, LOGE, FL(" fail to get NV_FIELD_IMAGE") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 326 | //hardcoded for now |
| 327 | pMac->scan.countryCodeDefault[0] = 'U'; |
| 328 | pMac->scan.countryCodeDefault[1] = 'S'; |
| 329 | pMac->scan.countryCodeDefault[2] = 'I'; |
| 330 | //status = eHAL_STATUS_SUCCESS; |
| 331 | } |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 332 | smsLog( pMac, LOG1, FL(" country Code from nvRam %.2s"), pMac->scan.countryCodeDefault ); |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 333 | |
| 334 | if (!('0' == pMac->scan.countryCodeDefault[0] && |
| 335 | '0' == pMac->scan.countryCodeDefault[1])) |
| 336 | { |
| 337 | csrGetRegulatoryDomainForCountry(pMac, pMac->scan.countryCodeDefault, |
| 338 | ®Id, COUNTRY_NV); |
| 339 | } |
| 340 | else |
| 341 | { |
| 342 | regId = REGDOMAIN_WORLD; |
| 343 | } |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 344 | WDA_SetRegDomain(pMac, regId, eSIR_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 345 | pMac->scan.domainIdDefault = regId; |
| 346 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 347 | vos_mem_copy(pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault, |
| 348 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 349 | status = csrInitGetChannels( pMac ); |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 350 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 351 | }while(0); |
| 352 | |
| 353 | return (status); |
| 354 | } |
| 355 | |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 356 | /* -------------------------------------------------------------------------- |
| 357 | \fn csrInitChannels |
| 358 | \brief This function must be called to initialize CSR channel lists |
| 359 | \return eHalStatus |
| 360 | ----------------------------------------------------------------------------*/ |
| 361 | eHalStatus csrInitChannels(tpAniSirGlobal pMac) |
| 362 | { |
| 363 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 364 | static uNvTables nvTables; |
| 365 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 366 | v_REGDOMAIN_t regId; |
| 367 | |
| 368 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 369 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 370 | { |
| 371 | vos_mem_copy(pMac->scan.countryCodeDefault, |
| 372 | nvTables.defaultCountryTable.countryCode, |
| 373 | WNI_CFG_COUNTRY_CODE_LEN); |
| 374 | } |
| 375 | else |
| 376 | { |
| 377 | smsLog( pMac, LOGE, FL(" fail to get NV_FIELD_IMAGE") ); |
| 378 | //hardcoded for now |
| 379 | pMac->scan.countryCodeDefault[0] = 'U'; |
| 380 | pMac->scan.countryCodeDefault[1] = 'S'; |
| 381 | pMac->scan.countryCodeDefault[2] = 'I'; |
| 382 | } |
| 383 | smsLog( pMac, LOG1, FL(" country Code from nvRam %.2s"), pMac->scan.countryCodeDefault ); |
| 384 | |
| 385 | if (!('0' == pMac->scan.countryCodeDefault[0] && |
| 386 | '0' == pMac->scan.countryCodeDefault[1])) |
| 387 | { |
| 388 | csrGetRegulatoryDomainForCountry(pMac, pMac->scan.countryCodeDefault, |
| 389 | ®Id, COUNTRY_NV); |
| 390 | } |
| 391 | else |
| 392 | { |
| 393 | regId = REGDOMAIN_WORLD; |
| 394 | } |
| 395 | |
| 396 | WDA_SetRegDomain(pMac, regId, eSIR_TRUE); |
| 397 | pMac->scan.domainIdDefault = regId; |
| 398 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
| 399 | vos_mem_copy(pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault, |
| 400 | WNI_CFG_COUNTRY_CODE_LEN); |
| 401 | status = csrInitGetChannels( pMac ); |
| 402 | |
| 403 | return status; |
| 404 | } |
| 405 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | eHalStatus csrSetRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode) |
| 407 | { |
| 408 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 409 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 410 | v_REGDOMAIN_t regId; |
| 411 | v_U8_t cntryCodeLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 412 | if(NULL == apCntryCode) |
| 413 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 414 | smsLog( pMac, LOGE, FL(" Invalid country Code Pointer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 415 | return eHAL_STATUS_FAILURE; |
| 416 | } |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 417 | smsLog( pMac, LOG1, FL(" country Code %.2s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 418 | /* To get correct Regulatory domain from NV table |
| 419 | * 2 character Country code should be used |
| 420 | * 3rd charater is optional for indoor/outdoor setting */ |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 421 | cntryCodeLength = WNI_CFG_COUNTRY_CODE_LEN; |
| 422 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 423 | cntryCodeLength = strlen(apCntryCode); |
Madan Mohan Koyyalamudi | b666eb1 | 2012-09-18 17:29:47 -0700 | [diff] [blame] | 424 | |
| 425 | if (cntryCodeLength > WNI_CFG_COUNTRY_CODE_LEN) |
| 426 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 427 | smsLog( pMac, LOGW, FL(" Invalid Country Code Length") ); |
Madan Mohan Koyyalamudi | b666eb1 | 2012-09-18 17:29:47 -0700 | [diff] [blame] | 428 | return eHAL_STATUS_FAILURE; |
| 429 | } |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 430 | */ |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 431 | status = csrGetRegulatoryDomainForCountry(pMac, apCntryCode, ®Id, |
| 432 | COUNTRY_USER); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 433 | if (status != eHAL_STATUS_SUCCESS) |
| 434 | { |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 435 | smsLog( pMac, LOGE, FL(" fail to get regId for country Code %.2s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 436 | return status; |
| 437 | } |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 438 | status = WDA_SetRegDomain(hHal, regId, eSIR_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 439 | if (status != eHAL_STATUS_SUCCESS) |
| 440 | { |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 441 | smsLog( pMac, LOGE, FL(" fail to get regId for country Code %.2s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 442 | return status; |
| 443 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 444 | pMac->scan.domainIdDefault = regId; |
| 445 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 446 | /* Clear CC field */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 447 | vos_mem_set(pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN, 0); |
| 448 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 449 | /* Copy 2 or 3 bytes country code */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 450 | vos_mem_copy(pMac->scan.countryCodeDefault, apCntryCode, cntryCodeLength); |
| 451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 452 | /* If 2 bytes country code, 3rd byte must be filled with space */ |
| 453 | if((WNI_CFG_COUNTRY_CODE_LEN - 1) == cntryCodeLength) |
| 454 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 455 | vos_mem_set(pMac->scan.countryCodeDefault + 2, 1, 0x20); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 456 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 457 | vos_mem_copy(pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault, |
| 458 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 459 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 460 | return status; |
| 461 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 462 | eHalStatus csrSetChannels(tHalHandle hHal, tCsrConfigParam *pParam ) |
| 463 | { |
| 464 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 465 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 466 | tANI_U8 index = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 467 | vos_mem_copy(pParam->Csr11dinfo.countryCode, pMac->scan.countryCodeCurrent, |
| 468 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 469 | for ( index = 0; index < pMac->scan.base20MHzChannels.numChannels ; index++) |
| 470 | { |
| 471 | pParam->Csr11dinfo.Channels.channelList[index] = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 472 | pParam->Csr11dinfo.ChnPower[index].firstChannel = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 473 | pParam->Csr11dinfo.ChnPower[index].numChannels = 1; |
| 474 | pParam->Csr11dinfo.ChnPower[index].maxtxPower = pMac->scan.defaultPowerTable[index].pwr; |
| 475 | } |
| 476 | pParam->Csr11dinfo.Channels.numChannels = pMac->scan.base20MHzChannels.numChannels; |
| 477 | |
| 478 | return status; |
| 479 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 480 | eHalStatus csrClose(tpAniSirGlobal pMac) |
| 481 | { |
| 482 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 483 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 484 | csrRoamClose(pMac); |
| 485 | csrScanClose(pMac); |
| 486 | csrLLClose(&pMac->roam.statsClientReqList); |
| 487 | csrLLClose(&pMac->roam.peStatsReqList); |
| 488 | csrLLClose(&pMac->roam.roamCmdPendingList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 489 | /* DeInit Globals */ |
| 490 | csrRoamDeInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 491 | return (status); |
| 492 | } |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 493 | |
Leela Venkata Kiran Kumar Reddy Chirala | c6663f7 | 2014-02-03 21:04:58 -0800 | [diff] [blame] | 494 | eHalStatus csrUpdateChannelList(tpAniSirGlobal pMac) |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 495 | { |
| 496 | tSirUpdateChanList *pChanList; |
Leela Venkata Kiran Kumar Reddy Chirala | c6663f7 | 2014-02-03 21:04:58 -0800 | [diff] [blame] | 497 | tCsrScanStruct *pScan = &pMac->scan; |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 498 | tANI_U8 numChan = pScan->base20MHzChannels.numChannels; |
| 499 | tANI_U32 bufLen = sizeof(tSirUpdateChanList) + |
| 500 | (sizeof(tSirUpdateChanParam) * (numChan - 1)); |
| 501 | vos_msg_t msg; |
| 502 | tANI_U8 i; |
| 503 | |
| 504 | pChanList = (tSirUpdateChanList *) vos_mem_malloc(bufLen); |
| 505 | if (!pChanList) |
| 506 | { |
| 507 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 508 | "Failed to allocate memory for tSirUpdateChanList"); |
| 509 | return eHAL_STATUS_FAILED_ALLOC; |
| 510 | } |
| 511 | |
| 512 | msg.type = WDA_UPDATE_CHAN_LIST_REQ; |
| 513 | msg.reserved = 0; |
| 514 | msg.bodyptr = pChanList; |
| 515 | pChanList->numChan = numChan; |
| 516 | for (i = 0; i < pChanList->numChan; i++) |
| 517 | { |
| 518 | pChanList->chanParam[i].chanId = pScan->defaultPowerTable[i].chanId; |
Leela Venkata Kiran Kumar Reddy Chirala | c6663f7 | 2014-02-03 21:04:58 -0800 | [diff] [blame] | 519 | pChanList->chanParam[i].pwr = cfgGetRegulatoryMaxTransmitPower(pMac, |
| 520 | pScan->defaultPowerTable[i].chanId); |
| 521 | if (vos_nv_getChannelEnabledState(pChanList->chanParam[i].chanId) == |
| 522 | NV_CHANNEL_DFS) |
| 523 | pChanList->chanParam[i].dfsSet = VOS_TRUE; |
| 524 | else |
| 525 | pChanList->chanParam[i].dfsSet = VOS_FALSE; |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 526 | } |
| 527 | |
| 528 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 529 | { |
| 530 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
| 531 | "%s: Failed to post msg to WDA", __func__); |
| 532 | vos_mem_free(pChanList); |
| 533 | return eHAL_STATUS_FAILURE; |
| 534 | } |
| 535 | |
| 536 | return eHAL_STATUS_SUCCESS; |
| 537 | } |
| 538 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 539 | eHalStatus csrStart(tpAniSirGlobal pMac) |
| 540 | { |
| 541 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 542 | tANI_U32 i; |
| 543 | |
| 544 | do |
| 545 | { |
| 546 | //save the global vos context |
| 547 | pMac->roam.gVosContext = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 548 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 549 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, i ); |
| 550 | |
| 551 | status = csrRoamStart(pMac); |
| 552 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 553 | pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE; |
| 554 | status = pmcRegisterPowerSaveCheck(pMac, csrCheckPSReady, pMac); |
| 555 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 556 | pMac->roam.sPendingCommands = 0; |
| 557 | csrScanEnable(pMac); |
| 558 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 559 | status = csrNeighborRoamInit(pMac); |
| 560 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
| 561 | pMac->roam.tlStatsReqInfo.numClient = 0; |
| 562 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 563 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 564 | //init the link quality indication also |
| 565 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND; |
| 566 | if(!HAL_STATUS_SUCCESS(status)) |
| 567 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 568 | smsLog(pMac, LOGW, " csrStart: Couldn't Init HO control blk "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 569 | break; |
| 570 | } |
Leela Venkata Kiran Kumar Reddy Chirala | c6663f7 | 2014-02-03 21:04:58 -0800 | [diff] [blame] | 571 | #ifdef QCA_WIFI_2_0 |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 572 | if (pMac->fScanOffload) |
| 573 | { |
| 574 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 575 | "Scan offload is enabled, update default chan list"); |
Leela Venkata Kiran Kumar Reddy Chirala | c6663f7 | 2014-02-03 21:04:58 -0800 | [diff] [blame] | 576 | status = csrUpdateChannelList(pMac); |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 577 | } |
Leela Venkata Kiran Kumar Reddy Chirala | c6663f7 | 2014-02-03 21:04:58 -0800 | [diff] [blame] | 578 | #else |
| 579 | status = csrUpdateChannelList(pMac); |
| 580 | #endif |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 581 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 582 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 583 | #if defined(ANI_LOGDUMP) |
| 584 | csrDumpInit(pMac); |
| 585 | #endif //#if defined(ANI_LOGDUMP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 586 | return (status); |
| 587 | } |
| 588 | |
Kiet Lam | a72a232 | 2013-11-15 11:18:11 +0530 | [diff] [blame] | 589 | eHalStatus csrStop(tpAniSirGlobal pMac, tHalStopType stopType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 590 | { |
| 591 | tANI_U32 sessionId; |
| 592 | tANI_U32 i; |
| 593 | |
| 594 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 595 | { |
| 596 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 597 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 598 | csrScanDisable(pMac); |
| 599 | pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE; |
| 600 | pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 601 | csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE ); |
| 602 | |
| 603 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 604 | csrNeighborRoamClose(pMac); |
| 605 | #endif |
| 606 | csrScanFlushResult(pMac); //Do we want to do this? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 607 | // deregister from PMC since we register during csrStart() |
| 608 | // (ignore status since there is nothing we can do if it fails) |
| 609 | (void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 610 | //Reset the domain back to the deault |
| 611 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 612 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 613 | |
| 614 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 615 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 616 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 617 | pMac->roam.curSubState[i] = eCSR_ROAM_SUBSTATE_NONE; |
| 618 | } |
| 619 | |
Kiet Lam | a72a232 | 2013-11-15 11:18:11 +0530 | [diff] [blame] | 620 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 621 | /* When HAL resets all the context information |
| 622 | * in HAL is lost, so we might need to send the |
| 623 | * scan offload request again when it comes |
| 624 | * out of reset for scan offload to be functional |
| 625 | */ |
| 626 | if (HAL_STOP_TYPE_SYS_RESET == stopType) |
| 627 | { |
| 628 | bRoamScanOffloadStarted = VOS_FALSE; |
| 629 | } |
| 630 | #endif |
| 631 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 632 | return (eHAL_STATUS_SUCCESS); |
| 633 | } |
| 634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 635 | eHalStatus csrReady(tpAniSirGlobal pMac) |
| 636 | { |
| 637 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 638 | csrScanGetSupportedChannels( pMac ); |
| 639 | //WNI_CFG_VALID_CHANNEL_LIST should be set by this time |
| 640 | //use it to init the background scan list |
| 641 | csrInitBGScanChannelList(pMac); |
| 642 | /* HDD issues the init scan */ |
| 643 | csrScanStartResultAgingTimer(pMac); |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 644 | /* If the gScanAgingTime is set to '0' then scan results aging timeout |
| 645 | based on timer feature is not enabled*/ |
| 646 | if(0 != pMac->scan.scanResultCfgAgingTime ) |
| 647 | { |
| 648 | csrScanStartResultCfgAgingTimer(pMac); |
| 649 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 650 | //Store the AC weights in TL for later use |
| 651 | WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 652 | status = csrInitChannelList( pMac ); |
| 653 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 654 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 655 | smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 656 | status ); |
| 657 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 658 | return (status); |
| 659 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 660 | void csrSetDefaultDot11Mode( tpAniSirGlobal pMac ) |
| 661 | { |
| 662 | v_U32_t wniDot11mode = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 663 | wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode); |
| 664 | ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE); |
| 665 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 666 | void csrSetGlobalCfgs( tpAniSirGlobal pMac ) |
| 667 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 668 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 669 | ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 670 | ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 671 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 672 | ((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled), |
| 673 | NULL, eANI_BOOLEAN_FALSE); |
| 674 | 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] | 675 | /* 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 |
| 676 | * Once session is established we will use the session related params stored in PE session for CB mode |
| 677 | */ |
| 678 | 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] | 679 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE); |
| 680 | |
| 681 | //Update the operating mode to configured value during initialization, |
| 682 | //So that client can advertise full capabilities in Probe request frame. |
| 683 | csrSetDefaultDot11Mode( pMac ); |
| 684 | } |
| 685 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 686 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac) |
| 687 | { |
| 688 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 689 | tANI_U32 i; |
| 690 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 691 | do |
| 692 | { |
| 693 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 694 | { |
| 695 | pSession = CSR_GET_SESSION( pMac, i ); |
| 696 | pSession->roamingTimerInfo.pMac = pMac; |
| 697 | pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 698 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 699 | pMac->roam.WaitForKeyTimerInfo.pMac = pMac; |
| 700 | pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 701 | status = vos_timer_init(&pMac->roam.hTimerWaitForKey, VOS_TIMER_TYPE_SW, |
| 702 | csrRoamWaitForKeyTimeOutHandler, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 703 | &pMac->roam.WaitForKeyTimerInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 704 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 705 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 706 | smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 707 | break; |
| 708 | } |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 709 | status = vos_timer_init(&pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 710 | VOS_TIMER_TYPE_SW, csrRoamTlStatsTimerHandler, pMac); |
| 711 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 712 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 713 | smsLog(pMac, LOGE, FL("cannot allocate memory for summary Statistics timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 714 | return eHAL_STATUS_FAILURE; |
| 715 | } |
| 716 | }while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 717 | return (status); |
| 718 | } |
| 719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 720 | eHalStatus csrRoamClose(tpAniSirGlobal pMac) |
| 721 | { |
| 722 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 723 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 724 | { |
| 725 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 726 | } |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 727 | vos_timer_stop(&pMac->roam.hTimerWaitForKey); |
| 728 | vos_timer_destroy(&pMac->roam.hTimerWaitForKey); |
| 729 | vos_timer_stop(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 730 | vos_timer_destroy(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 731 | return (eHAL_STATUS_SUCCESS); |
| 732 | } |
| 733 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 734 | eHalStatus csrRoamStart(tpAniSirGlobal pMac) |
| 735 | { |
| 736 | (void)pMac; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 737 | return (eHAL_STATUS_SUCCESS); |
| 738 | } |
| 739 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 740 | void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 741 | { |
| 742 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 743 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 744 | csrRoamDeregStatisticsReq(pMac); |
| 745 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 746 | eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState) |
| 747 | { |
| 748 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Srinivas Girigowda | c84c57c | 2013-02-19 17:41:56 -0800 | [diff] [blame] | 749 | if ( CSR_IS_SESSION_VALID(pMac, sessionId) && (NULL != pState) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 750 | { |
| 751 | status = eHAL_STATUS_SUCCESS; |
| 752 | *pState = pMac->roam.roamSession[sessionId].connectState; |
| 753 | } |
| 754 | return (status); |
| 755 | } |
| 756 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 757 | eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 758 | { |
| 759 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 760 | tANI_U32 size = 0; |
| 761 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 762 | |
| 763 | if(!pSession) |
| 764 | { |
| 765 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 766 | return eHAL_STATUS_FAILURE; |
| 767 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 768 | |
| 769 | if(pProfile) |
| 770 | { |
| 771 | if(pSession->pConnectBssDesc) |
| 772 | { |
| 773 | do |
| 774 | { |
| 775 | size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length); |
| 776 | if(size) |
| 777 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 778 | pProfile->pBssDesc = vos_mem_malloc(size); |
| 779 | if ( NULL != pProfile->pBssDesc ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 780 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 781 | vos_mem_copy(pProfile->pBssDesc, |
| 782 | pSession->pConnectBssDesc, size); |
| 783 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 784 | } |
| 785 | else |
| 786 | break; |
| 787 | } |
| 788 | else |
| 789 | { |
| 790 | pProfile->pBssDesc = NULL; |
| 791 | } |
| 792 | pProfile->AuthType = pSession->connectedProfile.AuthType; |
| 793 | pProfile->EncryptionType = pSession->connectedProfile.EncryptionType; |
| 794 | pProfile->mcEncryptionType = pSession->connectedProfile.mcEncryptionType; |
| 795 | pProfile->BSSType = pSession->connectedProfile.BSSType; |
| 796 | pProfile->operationChannel = pSession->connectedProfile.operationChannel; |
| 797 | pProfile->CBMode = pSession->connectedProfile.CBMode; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 798 | vos_mem_copy(&pProfile->bssid, &pSession->connectedProfile.bssid, |
| 799 | sizeof(tCsrBssid)); |
| 800 | vos_mem_copy(&pProfile->SSID, &pSession->connectedProfile.SSID, |
| 801 | sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 802 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 803 | if (pSession->connectedProfile.MDID.mdiePresent) |
| 804 | { |
| 805 | pProfile->MDID.mdiePresent = 1; |
| 806 | pProfile->MDID.mobilityDomain = pSession->connectedProfile.MDID.mobilityDomain; |
| 807 | } |
| 808 | else |
| 809 | { |
| 810 | pProfile->MDID.mdiePresent = 0; |
| 811 | pProfile->MDID.mobilityDomain = 0; |
| 812 | } |
| 813 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 814 | #ifdef FEATURE_WLAN_ESE |
| 815 | pProfile->isESEAssoc = pSession->connectedProfile.isESEAssoc; |
| 816 | if (csrIsAuthTypeESE(pSession->connectedProfile.AuthType)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 817 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 818 | vos_mem_copy (pProfile->eseCckmInfo.krk, |
| 819 | pSession->connectedProfile.eseCckmInfo.krk, |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 820 | CSR_KRK_KEY_LEN); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 821 | pProfile->eseCckmInfo.reassoc_req_num= |
| 822 | pSession->connectedProfile.eseCckmInfo.reassoc_req_num; |
| 823 | pProfile->eseCckmInfo.krk_plumbed = |
| 824 | pSession->connectedProfile.eseCckmInfo.krk_plumbed; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 825 | } |
| 826 | #endif |
| 827 | }while(0); |
| 828 | } |
| 829 | } |
| 830 | |
| 831 | return (status); |
| 832 | } |
| 833 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 834 | eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 835 | { |
| 836 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | fec1ecb | 2013-05-03 08:10:33 -0700 | [diff] [blame] | 837 | |
| 838 | if((csrIsConnStateConnected(pMac, sessionId)) || |
| 839 | (csrIsConnStateIbss(pMac, sessionId))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 840 | { |
| 841 | if(pProfile) |
| 842 | { |
| 843 | status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile); |
| 844 | } |
| 845 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 846 | return (status); |
| 847 | } |
Jeff Johnson | fec1ecb | 2013-05-03 08:10:33 -0700 | [diff] [blame] | 848 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 849 | eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile) |
| 850 | { |
| 851 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 852 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 853 | if (pProfile->pBssDesc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 854 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 855 | vos_mem_free(pProfile->pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 856 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 857 | if (pProfile->pAddIEAssoc) |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 858 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 859 | vos_mem_free(pProfile->pAddIEAssoc); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 860 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 861 | vos_mem_set(pProfile, sizeof(tCsrRoamConnectedProfile), 0); |
| 862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 863 | pProfile->AuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 864 | return (status); |
| 865 | } |
| 866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 867 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ) |
| 868 | { |
| 869 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 870 | if( pConnectedInfo->pbFrames ) |
| 871 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 872 | vos_mem_free(pConnectedInfo->pbFrames); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 873 | pConnectedInfo->pbFrames = NULL; |
| 874 | } |
| 875 | pConnectedInfo->nBeaconLength = 0; |
| 876 | pConnectedInfo->nAssocReqLength = 0; |
| 877 | pConnectedInfo->nAssocRspLength = 0; |
| 878 | pConnectedInfo->staId = 0; |
| 879 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 880 | pConnectedInfo->nRICRspLength = 0; |
| 881 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 882 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 883 | pConnectedInfo->nTspecIeLength = 0; |
| 884 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 885 | return ( status ); |
| 886 | } |
| 887 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 888 | |
| 889 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 890 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 891 | void csrReleaseCommandPreauth(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 892 | { |
| 893 | csrReinitPreauthCmd(pMac, pCommand); |
| 894 | csrReleaseCommand( pMac, pCommand ); |
| 895 | } |
| 896 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 897 | void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 898 | { |
| 899 | csrReinitRoamCmd(pMac, pCommand); |
| 900 | csrReleaseCommand( pMac, pCommand ); |
| 901 | } |
| 902 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 903 | void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 904 | { |
| 905 | csrReinitScanCmd(pMac, pCommand); |
| 906 | csrReleaseCommand( pMac, pCommand ); |
| 907 | } |
| 908 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 909 | void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 910 | { |
| 911 | csrReinitWmStatusChangeCmd(pMac, pCommand); |
| 912 | csrReleaseCommand( pMac, pCommand ); |
| 913 | } |
| 914 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 915 | void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 916 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 917 | vos_mem_set(&pCommand->u.setKeyCmd, sizeof(tSetKeyCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 918 | } |
| 919 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 920 | void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 921 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 922 | vos_mem_set(&pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 923 | } |
| 924 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 925 | void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 926 | { |
| 927 | csrReinitSetKeyCmd(pMac, pCommand); |
| 928 | csrReleaseCommand( pMac, pCommand ); |
| 929 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 930 | void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 931 | { |
| 932 | csrReinitRemoveKeyCmd(pMac, pCommand); |
| 933 | csrReleaseCommand( pMac, pCommand ); |
| 934 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 935 | void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping ) |
| 936 | { |
| 937 | |
| 938 | if( eSmeCsrCommandMask & pCommand->command ) |
| 939 | { |
| 940 | switch (pCommand->command) |
| 941 | { |
| 942 | case eSmeCommandScan: |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 943 | // We need to inform the requester before dropping the scan command |
Jeff Johnson | c7c54b1 | 2013-11-17 11:49:03 -0800 | [diff] [blame] | 944 | smsLog( pMac, LOGW, "%s: Drop scan reason %d callback %p", |
| 945 | __func__, pCommand->u.scanCmd.reason, |
| 946 | pCommand->u.scanCmd.callback); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 947 | if (NULL != pCommand->u.scanCmd.callback) |
| 948 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 949 | smsLog( pMac, LOGW, "%s callback scan requester", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 950 | csrScanCallCallback(pMac, pCommand, eCSR_SCAN_ABORT); |
| 951 | } |
| 952 | csrReleaseCommandScan( pMac, pCommand ); |
| 953 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 954 | case eSmeCommandRoam: |
| 955 | csrReleaseCommandRoam( pMac, pCommand ); |
| 956 | break; |
| 957 | |
| 958 | case eSmeCommandWmStatusChange: |
| 959 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 960 | break; |
| 961 | |
| 962 | case eSmeCommandSetKey: |
| 963 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 964 | break; |
| 965 | |
| 966 | case eSmeCommandRemoveKey: |
| 967 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 968 | break; |
| 969 | |
| 970 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 971 | smsLog( pMac, LOGW, " CSR abort standard command %d", pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 972 | csrReleaseCommand( pMac, pCommand ); |
| 973 | break; |
| 974 | } |
| 975 | } |
| 976 | } |
| 977 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 978 | void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId) |
| 979 | { |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 980 | smsLog(pMac, LOG1, FL("CSR RoamSubstate: [ %s <== %s ]"), |
| 981 | macTraceGetcsrRoamSubState(NewSubstate), |
| 982 | macTraceGetcsrRoamSubState(pMac->roam.curSubState[sessionId])); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 983 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 984 | if(pMac->roam.curSubState[sessionId] == NewSubstate) |
| 985 | { |
| 986 | return; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 987 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 988 | pMac->roam.curSubState[sessionId] = NewSubstate; |
| 989 | } |
| 990 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 991 | eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId) |
| 992 | { |
| 993 | eCsrRoamState PreviousState; |
| 994 | |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 995 | smsLog(pMac, LOG1, FL("CSR RoamState[%hu]: [ %s <== %s ]"), sessionId, |
| 996 | macTraceGetcsrRoamState(NewRoamState), |
| 997 | macTraceGetcsrRoamState(pMac->roam.curState[sessionId])); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 998 | |
| 999 | PreviousState = pMac->roam.curState[sessionId]; |
| 1000 | |
| 1001 | if ( NewRoamState != pMac->roam.curState[sessionId] ) |
| 1002 | { |
| 1003 | // Whenever we transition OUT of the Roaming state, clear the Roaming substate... |
| 1004 | if ( CSR_IS_ROAM_JOINING(pMac, sessionId) ) |
| 1005 | { |
| 1006 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 1007 | } |
| 1008 | |
| 1009 | pMac->roam.curState[sessionId] = NewRoamState; |
| 1010 | } |
| 1011 | return( PreviousState ); |
| 1012 | } |
| 1013 | |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1014 | void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_S8 bestApRssi, tANI_U8 catOffset) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1015 | { |
| 1016 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1017 | if(catOffset) |
| 1018 | { |
| 1019 | pMac->roam.configParam.bCatRssiOffset = catOffset; |
| 1020 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 1021 | { |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1022 | pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)bestApRssi - pMac->roam.configParam.nSelect5GHzMargin - (int)(i * catOffset); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1023 | } |
| 1024 | } |
| 1025 | } |
| 1026 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1027 | static void initConfigParam(tpAniSirGlobal pMac) |
| 1028 | { |
| 1029 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1030 | pMac->roam.configParam.agingCount = CSR_AGING_COUNT; |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 1031 | pMac->roam.configParam.channelBondingMode24GHz = |
| 1032 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 1033 | pMac->roam.configParam.channelBondingMode5GHz = |
| 1034 | WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1035 | pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 1036 | pMac->roam.configParam.eBand = eCSR_BAND_ALL; |
| 1037 | pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 1038 | pMac->roam.configParam.FragmentationThreshold = eCSR_DOT11_FRAG_THRESH_DEFAULT; |
| 1039 | pMac->roam.configParam.HeartbeatThresh24 = 40; |
| 1040 | pMac->roam.configParam.HeartbeatThresh50 = 40; |
| 1041 | pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE; |
| 1042 | pMac->roam.configParam.Is11dSupportEnabledOriginal = eANI_BOOLEAN_FALSE; |
| 1043 | pMac->roam.configParam.Is11eSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1044 | pMac->roam.configParam.Is11hSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1045 | pMac->roam.configParam.RTSThreshold = 2346; |
| 1046 | pMac->roam.configParam.shortSlotTime = eANI_BOOLEAN_TRUE; |
| 1047 | pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto; |
| 1048 | pMac->roam.configParam.ProprietaryRatesEnabled = eANI_BOOLEAN_TRUE; |
| 1049 | pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO; |
| 1050 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 1051 | pMac->roam.configParam.scanAgeTimeNCNPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS; |
| 1052 | pMac->roam.configParam.scanAgeTimeNCPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS; |
| 1053 | pMac->roam.configParam.scanAgeTimeCNPS = CSR_SCAN_AGING_TIME_CONNECT_NO_PS; |
| 1054 | pMac->roam.configParam.scanAgeTimeCPS = CSR_SCAN_AGING_TIME_CONNECT_W_PS; |
| 1055 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 1056 | { |
| 1057 | pMac->roam.configParam.BssPreferValue[i] = i; |
| 1058 | } |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1059 | csrAssignRssiForCategory(pMac, CSR_BEST_RSSI_VALUE, CSR_DEFAULT_RSSI_DB_GAP); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1060 | pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME; |
| 1061 | pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE; |
| 1062 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1063 | pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE; |
| 1064 | pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE; |
| 1065 | pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; |
| 1066 | pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; |
| 1067 | pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME; |
| 1068 | pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME; |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1069 | pMac->roam.configParam.nActiveMaxChnTimeBtc = CSR_ACTIVE_MAX_CHANNEL_TIME_BTC; |
| 1070 | pMac->roam.configParam.nActiveMinChnTimeBtc = CSR_ACTIVE_MIN_CHANNEL_TIME_BTC; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 1071 | pMac->roam.configParam.disableAggWithBtc = eANI_BOOLEAN_TRUE; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1072 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1073 | pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC; |
| 1074 | pMac->roam.configParam.nActiveMinChnTimeConc = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC; |
| 1075 | pMac->roam.configParam.nPassiveMaxChnTimeConc = CSR_PASSIVE_MAX_CHANNEL_TIME_CONC; |
| 1076 | pMac->roam.configParam.nPassiveMinChnTimeConc = CSR_PASSIVE_MIN_CHANNEL_TIME_CONC; |
| 1077 | pMac->roam.configParam.nRestTimeConc = CSR_REST_TIME_CONC; |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1078 | pMac->roam.configParam.nNumStaChanCombinedConc = CSR_NUM_STA_CHAN_COMBINED_CONC; |
| 1079 | pMac->roam.configParam.nNumP2PChanCombinedConc = CSR_NUM_P2P_CHAN_COMBINED_CONC; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1080 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1081 | pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default |
| 1082 | pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; |
| 1083 | pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; |
| 1084 | pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1085 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1086 | pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0; |
| 1087 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1088 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1089 | pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3; |
| 1090 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120; |
| 1091 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = 125; |
| 1092 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20; |
| 1093 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40; |
| 1094 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = 200; |
| 1095 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels = 3; |
| 1096 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[0] = 1; |
| 1097 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[1] = 6; |
| 1098 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11; |
| 1099 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1100 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1101 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1102 | #ifdef WLAN_FEATURE_11AC |
| 1103 | pMac->roam.configParam.nVhtChannelWidth = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1; |
| 1104 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1105 | |
| 1106 | pMac->roam.configParam.addTSWhenACMIsOff = 0; |
| 1107 | pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE; |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1108 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1109 | //Remove this code once SLM_Sessionization is supported |
| 1110 | //BMPS_WORKAROUND_NOT_NEEDED |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1111 | pMac->roam.configParam.doBMPSWorkaround = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1112 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1113 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1114 | eCsrBand csrGetCurrentBand(tHalHandle hHal) |
| 1115 | { |
| 1116 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1117 | return pMac->roam.configParam.bandCapability; |
| 1118 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1119 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1120 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1121 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1122 | /* |
| 1123 | This function flushes the roam scan cache |
| 1124 | */ |
| 1125 | eHalStatus csrFlushRoamScanRoamChannelList(tpAniSirGlobal pMac) |
| 1126 | { |
| 1127 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1128 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1129 | |
| 1130 | /* Free up the memory first (if required) */ |
| 1131 | if (NULL != pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 1132 | { |
| 1133 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 1134 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 1135 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
| 1136 | } |
| 1137 | return status; |
| 1138 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1139 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1140 | |
| 1141 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1142 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1143 | /* |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1144 | This function flushes the roam scan cache |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1145 | */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1146 | eHalStatus csrFlushCfgBgScanRoamChannelList(tpAniSirGlobal pMac) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1147 | { |
| 1148 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1149 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1150 | |
| 1151 | /* Free up the memory first (if required) */ |
| 1152 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1153 | { |
| 1154 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 1155 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1156 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1157 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1158 | return status; |
| 1159 | } |
| 1160 | |
| 1161 | |
| 1162 | |
| 1163 | /* |
| 1164 | This function flushes the roam scan cache and creates fresh cache |
| 1165 | based on the input channel list |
| 1166 | */ |
| 1167 | eHalStatus csrCreateBgScanRoamChannelList(tpAniSirGlobal pMac, |
| 1168 | const tANI_U8 *pChannelList, |
| 1169 | const tANI_U8 numChannels) |
| 1170 | { |
| 1171 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1172 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1173 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1174 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = numChannels; |
| 1175 | |
| 1176 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = |
| 1177 | vos_mem_malloc(pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
| 1178 | |
| 1179 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1180 | { |
| 1181 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 1182 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
| 1183 | return eHAL_STATUS_RESOURCES; |
| 1184 | } |
| 1185 | |
| 1186 | /* Update the roam global structure */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1187 | vos_mem_copy(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
| 1188 | pChannelList, |
| 1189 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1190 | return status; |
| 1191 | } |
| 1192 | |
| 1193 | /* This function modifies the bgscan channel list set via config ini or |
| 1194 | runtime, whenever the band changes. |
| 1195 | if the band is auto, then no operation is performed on the channel list |
| 1196 | if the band is 2.4G, then make sure channel list contains only 2.4G valid channels |
| 1197 | if the band is 5G, then make sure channel list contains only 5G valid channels |
| 1198 | */ |
| 1199 | eHalStatus csrUpdateBgScanConfigIniChannelList(tpAniSirGlobal pMac, |
| 1200 | eCsrBand eBand) |
| 1201 | { |
| 1202 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1203 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1204 | tANI_U8 outNumChannels = 0; |
| 1205 | tANI_U8 inNumChannels = 0; |
| 1206 | tANI_U8 *inPtr = NULL; |
| 1207 | tANI_U8 i = 0; |
| 1208 | tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1209 | |
| 1210 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1211 | |
| 1212 | { |
| 1213 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1214 | "No update required for channel list " |
| 1215 | "either cfg.ini channel list is not set up or " |
| 1216 | "auto band (Band %d)", eBand); |
| 1217 | return status; |
| 1218 | } |
| 1219 | |
| 1220 | inNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
| 1221 | inPtr = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 1222 | if (eCSR_BAND_24 == eBand) |
| 1223 | { |
| 1224 | for (i = 0; i < inNumChannels; i++) |
| 1225 | { |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 1226 | if (CSR_IS_CHANNEL_24GHZ(inPtr[i]) && csrRoamIsChannelValid(pMac, inPtr[i])) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1227 | { |
| 1228 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1229 | } |
| 1230 | } |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1231 | csrFlushCfgBgScanRoamChannelList(pMac); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1232 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1233 | } |
| 1234 | else if (eCSR_BAND_5G == eBand) |
| 1235 | { |
| 1236 | for (i = 0; i < inNumChannels; i++) |
| 1237 | { |
| 1238 | /* Add 5G Non-DFS channel */ |
| 1239 | if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) && |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 1240 | csrRoamIsChannelValid(pMac, inPtr[i]) && |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1241 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1242 | { |
| 1243 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1244 | } |
| 1245 | } |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1246 | csrFlushCfgBgScanRoamChannelList(pMac); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1247 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1248 | } |
| 1249 | else if (eCSR_BAND_ALL == eBand) |
| 1250 | { |
| 1251 | for (i = 0; i < inNumChannels; i++) |
| 1252 | { |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 1253 | if (csrRoamIsChannelValid(pMac, inPtr[i]) && |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1254 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1255 | { |
| 1256 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1257 | } |
| 1258 | } |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1259 | csrFlushCfgBgScanRoamChannelList(pMac); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1260 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1261 | } |
| 1262 | else |
| 1263 | { |
| 1264 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 1265 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 1266 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 1267 | } |
| 1268 | |
| 1269 | return status; |
| 1270 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1271 | #endif |
| 1272 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1273 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1274 | /* This function modifies the roam scan channel list as per AP neighbor |
| 1275 | report; AP neighbor report may be empty or may include only other AP |
| 1276 | channels; in any case, we merge the channel list with the learned occupied |
| 1277 | channels list. |
| 1278 | if the band is 2.4G, then make sure channel list contains only 2.4G valid channels |
| 1279 | if the band is 5G, then make sure channel list contains only 5G valid channels |
| 1280 | */ |
| 1281 | eHalStatus csrCreateRoamScanChannelList(tpAniSirGlobal pMac, |
| 1282 | tANI_U8 *pChannelList, |
| 1283 | tANI_U8 numChannels, |
| 1284 | const eCsrBand eBand) |
| 1285 | { |
| 1286 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1287 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1288 | tANI_U8 outNumChannels = 0; |
| 1289 | tANI_U8 inNumChannels = numChannels; |
| 1290 | tANI_U8 *inPtr = pChannelList; |
| 1291 | tANI_U8 i = 0; |
| 1292 | tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1293 | tANI_U8 tmpChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1294 | tANI_U8 mergedOutputNumOfChannels = 0; |
| 1295 | tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 1296 | |
| 1297 | /* Create a Union of occupied channel list learnt by the DUT along with the Neighbor |
| 1298 | * report Channels. This increases the chances of the DUT to get a candidate AP while |
| 1299 | * roaming even if the Neighbor Report is not able to provide sufficient information. */ |
| 1300 | if (pMac->scan.occupiedChannels.numChannels) |
| 1301 | { |
| 1302 | csrNeighborRoamMergeChannelLists(pMac, |
| 1303 | &pMac->scan.occupiedChannels.channelList[0], |
| 1304 | pMac->scan.occupiedChannels.numChannels, |
| 1305 | inPtr, |
| 1306 | inNumChannels, |
| 1307 | &mergedOutputNumOfChannels); |
| 1308 | inNumChannels = mergedOutputNumOfChannels; |
| 1309 | } |
| 1310 | |
| 1311 | if (eCSR_BAND_24 == eBand) |
| 1312 | { |
| 1313 | for (i = 0; i < inNumChannels; i++) |
| 1314 | { |
| 1315 | if (CSR_IS_CHANNEL_24GHZ(inPtr[i]) && csrRoamIsChannelValid(pMac, inPtr[i])) |
| 1316 | { |
| 1317 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1318 | } |
| 1319 | } |
| 1320 | } |
| 1321 | else if (eCSR_BAND_5G == eBand) |
| 1322 | { |
| 1323 | for (i = 0; i < inNumChannels; i++) |
| 1324 | { |
| 1325 | /* Add 5G Non-DFS channel */ |
| 1326 | if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) && |
| 1327 | csrRoamIsChannelValid(pMac, inPtr[i]) && |
| 1328 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1329 | { |
| 1330 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1331 | } |
| 1332 | } |
| 1333 | } |
| 1334 | else if (eCSR_BAND_ALL == eBand) |
| 1335 | { |
| 1336 | for (i = 0; i < inNumChannels; i++) |
| 1337 | { |
| 1338 | if (csrRoamIsChannelValid(pMac, inPtr[i]) && |
| 1339 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1340 | { |
| 1341 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1342 | } |
| 1343 | } |
| 1344 | } |
| 1345 | else |
| 1346 | { |
| 1347 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 1348 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 1349 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1350 | } |
| 1351 | |
| 1352 | /* if roaming within band is enabled, then select only the |
| 1353 | in band channels . |
| 1354 | This is required only if the band capability is set to ALL, |
| 1355 | E.g., if band capability is only 2.4G then all the channels in the |
| 1356 | list are already filtered for 2.4G channels, hence ignore this check*/ |
| 1357 | |
| 1358 | if ((eCSR_BAND_ALL == eBand) && CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac)) |
| 1359 | { |
| 1360 | csrNeighborRoamChannelsFilterByCurrentBand( |
| 1361 | pMac, |
| 1362 | ChannelList, |
| 1363 | outNumChannels, |
| 1364 | tmpChannelList, |
| 1365 | &outNumChannels); |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 1366 | vos_mem_copy(ChannelList, |
| 1367 | tmpChannelList, outNumChannels); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1368 | } |
| 1369 | |
| 1370 | /* Prepare final roam scan channel list */ |
| 1371 | if(outNumChannels) |
| 1372 | { |
| 1373 | /* Clear the channel list first */ |
| 1374 | if (NULL != currChannelListInfo->ChannelList) |
| 1375 | { |
| 1376 | vos_mem_free(currChannelListInfo->ChannelList); |
| 1377 | currChannelListInfo->ChannelList = NULL; |
| 1378 | currChannelListInfo->numOfChannels = 0; |
| 1379 | } |
| 1380 | |
| 1381 | currChannelListInfo->ChannelList = vos_mem_malloc(outNumChannels * sizeof(tANI_U8)); |
| 1382 | if (NULL == currChannelListInfo->ChannelList) |
| 1383 | { |
| 1384 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
| 1385 | "Failed to allocate memory for roam scan channel list"); |
| 1386 | currChannelListInfo->numOfChannels = 0; |
| 1387 | return VOS_STATUS_E_RESOURCES; |
| 1388 | } |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 1389 | vos_mem_copy(currChannelListInfo->ChannelList, |
| 1390 | ChannelList, outNumChannels); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1391 | } |
| 1392 | return status; |
| 1393 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1394 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1395 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1396 | eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand) |
| 1397 | { |
| 1398 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1399 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1400 | if (CSR_IS_PHY_MODE_A_ONLY(pMac) && |
| 1401 | (eBand == eCSR_BAND_24)) |
| 1402 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1403 | /* DOT11 mode configured to 11a only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1404 | request to change the band to 2.4 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1405 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1406 | "failed to set band cfg80211 = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1407 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1408 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1409 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1410 | if ((CSR_IS_PHY_MODE_B_ONLY(pMac) || |
| 1411 | CSR_IS_PHY_MODE_G_ONLY(pMac)) && |
| 1412 | (eBand == eCSR_BAND_5G)) |
| 1413 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1414 | /* DOT11 mode configured to 11b/11g only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1415 | request to change the band to 5 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1416 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1417 | "failed to set band dot11mode = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1418 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1419 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1420 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1421 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1422 | "Band changed to %u (0 - ALL, 1 - 2.4 GHZ, 2 - 5GHZ)", eBand); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1423 | pMac->roam.configParam.eBand = eBand; |
| 1424 | pMac->roam.configParam.bandCapability = eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1425 | csrScanGetSupportedChannels( pMac ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1426 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 1427 | if (!csrRoamIsRoamOffloadScanEnabled(pMac)) |
| 1428 | csrUpdateBgScanConfigIniChannelList( pMac, eBand ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1429 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1430 | status = csrInitGetChannels( pMac ); |
| 1431 | if (eHAL_STATUS_SUCCESS == status) |
| 1432 | csrInitChannelList( hHal ); |
| 1433 | return status; |
| 1434 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1435 | |
| 1436 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1437 | /* The funcns csrConvertCBIniValueToPhyCBState and csrConvertPhyCBStateToIniValue have been |
| 1438 | * introduced to convert the ini value to the ENUM used in csr and MAC for CB state |
| 1439 | * Ideally we should have kept the ini value and enum value same and representing the same |
| 1440 | * cb values as in 11n standard i.e. |
| 1441 | * Set to 1 (SCA) if the secondary channel is above the primary channel |
| 1442 | * Set to 3 (SCB) if the secondary channel is below the primary channel |
| 1443 | * Set to 0 (SCN) if no secondary channel is present |
| 1444 | * However, since our driver is already distributed we will keep the ini definition as it is which is: |
| 1445 | * 0 - secondary none |
| 1446 | * 1 - secondary LOW |
| 1447 | * 2 - secondary HIGH |
| 1448 | * and convert to enum value used within the driver in csrChangeDefaultConfigParam using this funcn |
| 1449 | * The enum values are as follows: |
| 1450 | * PHY_SINGLE_CHANNEL_CENTERED = 0 |
| 1451 | * PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1 |
| 1452 | * PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 1453 | */ |
| 1454 | ePhyChanBondState csrConvertCBIniValueToPhyCBState(v_U32_t cbIniValue) |
| 1455 | { |
| 1456 | |
| 1457 | ePhyChanBondState phyCbState; |
| 1458 | switch (cbIniValue) { |
| 1459 | // secondary none |
| 1460 | case 0: |
| 1461 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1462 | break; |
| 1463 | // secondary LOW |
| 1464 | case 1: |
| 1465 | phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 1466 | break; |
| 1467 | // secondary HIGH |
| 1468 | case 2: |
| 1469 | phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 1470 | break; |
| 1471 | #ifdef WLAN_FEATURE_11AC |
| 1472 | case 3: |
| 1473 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
| 1474 | break; |
| 1475 | case 4: |
| 1476 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1477 | break; |
| 1478 | case 5: |
| 1479 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1480 | break; |
| 1481 | case 6: |
| 1482 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
| 1483 | break; |
| 1484 | case 7: |
| 1485 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
| 1486 | break; |
| 1487 | case 8: |
| 1488 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 1489 | break; |
| 1490 | case 9: |
| 1491 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
| 1492 | break; |
| 1493 | #endif |
| 1494 | default: |
| 1495 | // If an invalid value is passed, disable CHANNEL BONDING |
| 1496 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1497 | break; |
| 1498 | } |
| 1499 | return phyCbState; |
| 1500 | } |
| 1501 | |
| 1502 | v_U32_t csrConvertPhyCBStateToIniValue(ePhyChanBondState phyCbState) |
| 1503 | { |
| 1504 | |
| 1505 | v_U32_t cbIniValue; |
| 1506 | switch (phyCbState) { |
| 1507 | // secondary none |
| 1508 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 1509 | cbIniValue = 0; |
| 1510 | break; |
| 1511 | // secondary LOW |
| 1512 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 1513 | cbIniValue = 1; |
| 1514 | break; |
| 1515 | // secondary HIGH |
| 1516 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 1517 | cbIniValue = 2; |
| 1518 | break; |
| 1519 | #ifdef WLAN_FEATURE_11AC |
| 1520 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 1521 | cbIniValue = 3; |
| 1522 | break; |
| 1523 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 1524 | cbIniValue = 4; |
| 1525 | break; |
| 1526 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 1527 | cbIniValue = 5; |
| 1528 | break; |
| 1529 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 1530 | cbIniValue = 6; |
| 1531 | break; |
| 1532 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 1533 | cbIniValue = 7; |
| 1534 | break; |
| 1535 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 1536 | cbIniValue = 8; |
| 1537 | break; |
| 1538 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 1539 | cbIniValue = 9; |
| 1540 | break; |
| 1541 | #endif |
| 1542 | default: |
| 1543 | // return some invalid value |
| 1544 | cbIniValue = 10; |
| 1545 | break; |
| 1546 | } |
| 1547 | return cbIniValue; |
| 1548 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1549 | |
| 1550 | eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1551 | { |
| 1552 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1553 | |
| 1554 | if(pParam) |
| 1555 | { |
| 1556 | pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode; |
| 1557 | pMac->roam.configParam.Is11eSupportEnabled = pParam->Is11eSupportEnabled; |
| 1558 | pMac->roam.configParam.FragmentationThreshold = pParam->FragmentationThreshold; |
| 1559 | pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled; |
| 1560 | pMac->roam.configParam.Is11dSupportEnabledOriginal = pParam->Is11dSupportEnabled; |
| 1561 | pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled; |
| 1562 | |
| 1563 | pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode; |
Mohit Khanna | 7ed53f0 | 2012-09-11 17:52:10 -0700 | [diff] [blame] | 1564 | pMac->roam.configParam.fAllowMCCGODiffBI = pParam->fAllowMCCGODiffBI; |
| 1565 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1566 | /* channelBondingMode5GHz plays a dual role right now |
| 1567 | * 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 |
| 1568 | * This is how channelBondingMode5GHz works now and this is kept intact to avoid any cfg.ini change |
| 1569 | */ |
| 1570 | if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI) |
| 1571 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1572 | smsLog( pMac, LOGW, "Invalid CB value from ini in 2.4GHz band %d, CB DISABLED", pParam->channelBondingMode24GHz); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1573 | } |
| 1574 | pMac->roam.configParam.channelBondingMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode24GHz); |
| 1575 | if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI) |
| 1576 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1577 | smsLog( pMac, LOGW, "Invalid CB value from ini in 5GHz band %d, CB DISABLED", pParam->channelBondingMode5GHz); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1578 | } |
| 1579 | pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1580 | pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold; |
| 1581 | pMac->roam.configParam.phyMode = pParam->phyMode; |
| 1582 | pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime; |
| 1583 | pMac->roam.configParam.HeartbeatThresh24 = pParam->HeartbeatThresh24; |
| 1584 | pMac->roam.configParam.HeartbeatThresh50 = pParam->HeartbeatThresh50; |
| 1585 | pMac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled; |
| 1586 | pMac->roam.configParam.TxRate = pParam->TxRate; |
| 1587 | pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; |
| 1588 | pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; |
| 1589 | pMac->roam.configParam.bandCapability = pParam->bandCapability; |
| 1590 | pMac->roam.configParam.cbChoice = pParam->cbChoice; |
| 1591 | pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 1592 | pMac->roam.configParam.disableAggWithBtc = pParam->disableAggWithBtc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1593 | //if HDD passed down non zero values then only update, |
| 1594 | //otherwise keep using the defaults |
c_hpothu | 059edb0 | 2014-03-12 21:44:28 +0530 | [diff] [blame] | 1595 | if (pParam->nInitialDwellTime) |
| 1596 | { |
| 1597 | pMac->roam.configParam.nInitialDwellTime = |
| 1598 | pParam->nInitialDwellTime; |
| 1599 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1600 | if (pParam->nActiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1601 | { |
| 1602 | pMac->roam.configParam.nActiveMaxChnTime = pParam->nActiveMaxChnTime; |
| 1603 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1604 | if (pParam->nActiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1605 | { |
| 1606 | pMac->roam.configParam.nActiveMinChnTime = pParam->nActiveMinChnTime; |
| 1607 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1608 | if (pParam->nPassiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1609 | { |
| 1610 | pMac->roam.configParam.nPassiveMaxChnTime = pParam->nPassiveMaxChnTime; |
| 1611 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1612 | if (pParam->nPassiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1613 | { |
| 1614 | pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime; |
| 1615 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1616 | if (pParam->nActiveMaxChnTimeBtc) |
| 1617 | { |
| 1618 | pMac->roam.configParam.nActiveMaxChnTimeBtc = pParam->nActiveMaxChnTimeBtc; |
| 1619 | } |
| 1620 | if (pParam->nActiveMinChnTimeBtc) |
| 1621 | { |
| 1622 | pMac->roam.configParam.nActiveMinChnTimeBtc = pParam->nActiveMinChnTimeBtc; |
| 1623 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1624 | #ifdef WLAN_AP_STA_CONCURRENCY |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1625 | if (pParam->nActiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1626 | { |
| 1627 | pMac->roam.configParam.nActiveMaxChnTimeConc = pParam->nActiveMaxChnTimeConc; |
| 1628 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1629 | if (pParam->nActiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1630 | { |
| 1631 | pMac->roam.configParam.nActiveMinChnTimeConc = pParam->nActiveMinChnTimeConc; |
| 1632 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1633 | if (pParam->nPassiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1634 | { |
| 1635 | pMac->roam.configParam.nPassiveMaxChnTimeConc = pParam->nPassiveMaxChnTimeConc; |
| 1636 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1637 | if (pParam->nPassiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1638 | { |
| 1639 | pMac->roam.configParam.nPassiveMinChnTimeConc = pParam->nPassiveMinChnTimeConc; |
| 1640 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1641 | if (pParam->nRestTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1642 | { |
| 1643 | pMac->roam.configParam.nRestTimeConc = pParam->nRestTimeConc; |
| 1644 | } |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1645 | if (pParam->nNumStaChanCombinedConc) |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1646 | { |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1647 | pMac->roam.configParam.nNumStaChanCombinedConc = pParam->nNumStaChanCombinedConc; |
| 1648 | } |
| 1649 | if (pParam->nNumP2PChanCombinedConc) |
| 1650 | { |
| 1651 | pMac->roam.configParam.nNumP2PChanCombinedConc = pParam->nNumP2PChanCombinedConc; |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1652 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1653 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1654 | //if upper layer wants to disable idle scan altogether set it to 0 |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1655 | if (pParam->impsSleepTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1656 | { |
| 1657 | //Change the unit from second to microsecond |
| 1658 | tANI_U32 impsSleepTime = pParam->impsSleepTime * PAL_TIMER_TO_SEC_UNIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1659 | if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime) |
| 1660 | { |
| 1661 | pMac->roam.configParam.impsSleepTime = impsSleepTime; |
| 1662 | } |
| 1663 | else |
| 1664 | { |
| 1665 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 1666 | } |
| 1667 | } |
| 1668 | else |
| 1669 | { |
| 1670 | pMac->roam.configParam.impsSleepTime = 0; |
| 1671 | } |
| 1672 | pMac->roam.configParam.eBand = pParam->eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1673 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, pMac->roam.configParam.phyMode, |
| 1674 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1675 | //if HDD passed down non zero values for age params, then only update, |
| 1676 | //otherwise keep using the defaults |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1677 | if (pParam->nScanResultAgeCount) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1678 | { |
| 1679 | pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount; |
| 1680 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1681 | if(pParam->scanAgeTimeNCNPS) |
| 1682 | { |
| 1683 | pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS; |
| 1684 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1685 | if(pParam->scanAgeTimeNCPS) |
| 1686 | { |
| 1687 | pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS; |
| 1688 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1689 | if(pParam->scanAgeTimeCNPS) |
| 1690 | { |
| 1691 | pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS; |
| 1692 | } |
| 1693 | if(pParam->scanAgeTimeCPS) |
| 1694 | { |
| 1695 | pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS; |
| 1696 | } |
c_hpothu | 0d5a735 | 2014-03-22 12:30:25 +0530 | [diff] [blame] | 1697 | if (pParam->initialScanSkipDFSCh) |
| 1698 | { |
| 1699 | pMac->roam.configParam.initialScanSkipDFSCh = |
| 1700 | pParam->initialScanSkipDFSCh; |
| 1701 | } |
| 1702 | |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1703 | csrAssignRssiForCategory(pMac, CSR_BEST_RSSI_VALUE, pParam->bCatRssiOffset); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1704 | pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime; |
| 1705 | pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels; |
| 1706 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority; |
| 1707 | pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch; |
| 1708 | pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1709 | pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold; |
| 1710 | pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1711 | pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled; |
| 1712 | pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity; |
| 1713 | pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS; |
| 1714 | //Assign this before calling CsrInit11dInfo |
| 1715 | pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1716 | if( csrIs11dSupported( pMac ) ) |
| 1717 | { |
| 1718 | status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo); |
| 1719 | } |
| 1720 | else |
| 1721 | { |
| 1722 | pMac->scan.curScanType = eSIR_ACTIVE_SCAN; |
| 1723 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1724 | |
| 1725 | /* Initialize the power + channel information if 11h is enabled. |
| 1726 | If 11d is enabled this information has already been initialized */ |
| 1727 | if( csrIs11hSupported( pMac ) && !csrIs11dSupported( pMac ) ) |
| 1728 | { |
| 1729 | csrInitChannelPowerList(pMac, &pParam->Csr11dinfo); |
| 1730 | } |
| 1731 | |
| 1732 | |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 1733 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1734 | vos_mem_copy(&pMac->roam.configParam.csr11rConfig, |
| 1735 | &pParam->csr11rConfig, sizeof(tCsr11rConfigParams)); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1736 | smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1737 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1738 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1739 | pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1740 | pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1741 | pMac->roam.configParam.nImmediateRoamRssiDiff = pParam->nImmediateRoamRssiDiff; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1742 | smsLog( pMac, LOG1, "nImmediateRoamRssiDiff = %d", |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1743 | pMac->roam.configParam.nImmediateRoamRssiDiff ); |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 1744 | pMac->roam.configParam.nRoamPrefer5GHz = pParam->nRoamPrefer5GHz; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 1745 | pMac->roam.configParam.nRoamIntraBand = pParam->nRoamIntraBand; |
Srinivas Girigowda | ad34ca9 | 2013-10-22 10:54:29 -0700 | [diff] [blame] | 1746 | pMac->roam.configParam.isWESModeEnabled = pParam->isWESModeEnabled; |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 1747 | pMac->roam.configParam.nProbes = pParam->nProbes; |
| 1748 | pMac->roam.configParam.nRoamScanHomeAwayTime = pParam->nRoamScanHomeAwayTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1749 | #endif |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1750 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1751 | pMac->roam.configParam.isRoamOffloadScanEnabled = pParam->isRoamOffloadScanEnabled; |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1752 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = pParam->bFastRoamInConIniFeatureEnabled; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1753 | #endif |
| 1754 | #ifdef FEATURE_WLAN_LFR |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1755 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled; |
Sameer Thalappil | 4ae66ec | 2013-11-05 14:17:35 -0800 | [diff] [blame] | 1756 | pMac->roam.configParam.MAWCEnabled = pParam->MAWCEnabled; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1757 | #endif |
| 1758 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1759 | #ifdef FEATURE_WLAN_ESE |
| 1760 | pMac->roam.configParam.isEseIniFeatureEnabled = pParam->isEseIniFeatureEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1761 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1762 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1763 | vos_mem_copy(&pMac->roam.configParam.neighborRoamConfig, |
| 1764 | &pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams)); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1765 | smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod); |
| 1766 | smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold); |
| 1767 | smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold); |
| 1768 | smsLog( pMac, LOG1, "nNeighborScanMinChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime); |
| 1769 | smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime); |
| 1770 | smsLog( pMac, LOG1, "nMaxNeighborRetries = %d", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries); |
| 1771 | smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod); |
| 1772 | smsLog( pMac, LOG1, "nEmptyScanRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1773 | { |
| 1774 | int i; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1775 | smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1776 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1777 | { |
| 1778 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1779 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1780 | } |
| 1781 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1782 | pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff; |
| 1783 | pMac->scan.fValidateList = pParam->fValidateList; |
| 1784 | pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d; |
| 1785 | pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan; |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 1786 | pMac->scan.scanResultCfgAgingTime = pParam->scanCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1787 | pMac->roam.configParam.fScanTwice = pParam->fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1788 | pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl; |
| 1789 | /* This parameter is not available in cfg and not passed from upper layers. Instead it is initialized here |
| 1790 | * This paramtere is used in concurrency to determine if there are concurrent active sessions. |
| 1791 | * Is used as a temporary fix to disconnect all active sessions when BMPS enabled so the active session if Infra STA |
| 1792 | * will automatically connect back and resume BMPS since resume BMPS is not working when moving from concurrent to |
| 1793 | * single session |
| 1794 | */ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1795 | //Remove this code once SLM_Sessionization is supported |
| 1796 | //BMPS_WORKAROUND_NOT_NEEDED |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1797 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 1798 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1799 | #ifdef WLAN_FEATURE_11AC |
| 1800 | pMac->roam.configParam.nVhtChannelWidth = pParam->nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1801 | pMac->roam.configParam.txBFEnable= pParam->enableTxBF; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1802 | pMac->roam.configParam.txBFCsnValue = pParam->txBFCsnValue; |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 1803 | pMac->roam.configParam.enableVhtFor24GHz = pParam->enableVhtFor24GHz; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1804 | #endif |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1805 | pMac->roam.configParam.txLdpcEnable = pParam->enableTxLdpc; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 1806 | |
| 1807 | pMac->roam.configParam.isAmsduSupportInAMPDU = pParam->isAmsduSupportInAMPDU; |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1808 | pMac->roam.configParam.nSelect5GHzMargin = pParam->nSelect5GHzMargin; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 1809 | pMac->roam.configParam.isCoalesingInIBSSAllowed = |
| 1810 | pParam->isCoalesingInIBSSAllowed; |
Sandeep Puligilla | c80f26e | 2014-03-11 18:36:10 +0530 | [diff] [blame] | 1811 | pMac->roam.configParam.allowDFSChannelRoam = pParam->allowDFSChannelRoam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1812 | } |
| 1813 | |
| 1814 | return status; |
| 1815 | } |
| 1816 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1817 | eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1818 | { |
| 1819 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1820 | if(pParam) |
| 1821 | { |
| 1822 | pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode; |
| 1823 | pParam->Is11eSupportEnabled = pMac->roam.configParam.Is11eSupportEnabled; |
| 1824 | pParam->FragmentationThreshold = pMac->roam.configParam.FragmentationThreshold; |
| 1825 | pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled; |
| 1826 | pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 1827 | pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1828 | pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz); |
| 1829 | pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1830 | pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold; |
| 1831 | pParam->phyMode = pMac->roam.configParam.phyMode; |
| 1832 | pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 1833 | pParam->HeartbeatThresh24 = pMac->roam.configParam.HeartbeatThresh24; |
| 1834 | pParam->HeartbeatThresh50 = pMac->roam.configParam.HeartbeatThresh50; |
| 1835 | pParam->ProprietaryRatesEnabled = pMac->roam.configParam.ProprietaryRatesEnabled; |
| 1836 | pParam->TxRate = pMac->roam.configParam.TxRate; |
| 1837 | pParam->AdHocChannel24 = pMac->roam.configParam.AdHocChannel24; |
| 1838 | pParam->AdHocChannel5G = pMac->roam.configParam.AdHocChannel5G; |
| 1839 | pParam->bandCapability = pMac->roam.configParam.bandCapability; |
| 1840 | pParam->cbChoice = pMac->roam.configParam.cbChoice; |
| 1841 | pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1842 | pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime; |
| 1843 | pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime; |
| 1844 | pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; |
| 1845 | pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 1846 | pParam->nActiveMaxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; |
| 1847 | pParam->nActiveMinChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; |
| 1848 | pParam->disableAggWithBtc = pMac->roam.configParam.disableAggWithBtc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1849 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1850 | pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc; |
| 1851 | pParam->nActiveMinChnTimeConc = pMac->roam.configParam.nActiveMinChnTimeConc; |
| 1852 | pParam->nPassiveMaxChnTimeConc = pMac->roam.configParam.nPassiveMaxChnTimeConc; |
| 1853 | pParam->nPassiveMinChnTimeConc = pMac->roam.configParam.nPassiveMinChnTimeConc; |
| 1854 | pParam->nRestTimeConc = pMac->roam.configParam.nRestTimeConc; |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1855 | pParam->nNumStaChanCombinedConc = pMac->roam.configParam.nNumStaChanCombinedConc; |
| 1856 | pParam->nNumP2PChanCombinedConc = pMac->roam.configParam.nNumP2PChanCombinedConc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1857 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1858 | //Change the unit from microsecond to second |
| 1859 | pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT; |
| 1860 | pParam->eBand = pMac->roam.configParam.eBand; |
| 1861 | pParam->nScanResultAgeCount = pMac->roam.configParam.agingCount; |
| 1862 | pParam->scanAgeTimeNCNPS = pMac->roam.configParam.scanAgeTimeNCNPS; |
| 1863 | pParam->scanAgeTimeNCPS = pMac->roam.configParam.scanAgeTimeNCPS; |
| 1864 | pParam->scanAgeTimeCNPS = pMac->roam.configParam.scanAgeTimeCNPS; |
| 1865 | pParam->scanAgeTimeCPS = pMac->roam.configParam.scanAgeTimeCPS; |
| 1866 | pParam->bCatRssiOffset = pMac->roam.configParam.bCatRssiOffset; |
| 1867 | pParam->nRoamingTime = pMac->roam.configParam.nRoamingTime; |
| 1868 | pParam->fEnforce11dChannels = pMac->roam.configParam.fEnforce11dChannels; |
| 1869 | pParam->fSupplicantCountryCodeHasPriority = pMac->roam.configParam.fSupplicantCountryCodeHasPriority; |
| 1870 | pParam->fEnforceCountryCodeMatch = pMac->roam.configParam.fEnforceCountryCodeMatch; |
| 1871 | pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain; |
| 1872 | pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold; |
| 1873 | pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1874 | pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled; |
| 1875 | pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap; |
| 1876 | pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 1877 | pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1878 | pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff; |
| 1879 | pParam->fValidateList = pMac->roam.configParam.fValidateList; |
| 1880 | pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d; |
| 1881 | pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan; |
| 1882 | pParam->fScanTwice = pMac->roam.configParam.fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1883 | pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl; |
Madan Mohan Koyyalamudi | ed41951 | 2012-11-29 15:53:46 -0800 | [diff] [blame] | 1884 | pParam->fEnableMCCMode = pMac->roam.configParam.fenableMCCMode; |
Madan Mohan Koyyalamudi | 057bd80 | 2012-11-29 16:02:39 -0800 | [diff] [blame] | 1885 | pParam->fAllowMCCGODiffBI = pMac->roam.configParam.fAllowMCCGODiffBI; |
Sunil Ravi | 39b2e53 | 2013-01-20 23:45:53 -0800 | [diff] [blame] | 1886 | pParam->scanCfgAgingTime = pMac->scan.scanResultCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1887 | |
| 1888 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1889 | vos_mem_copy(&pParam->neighborRoamConfig, |
| 1890 | &pMac->roam.configParam.neighborRoamConfig, |
| 1891 | sizeof(tCsrNeighborRoamConfigParams)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1892 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1893 | #ifdef WLAN_FEATURE_11AC |
| 1894 | pParam->nVhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1895 | pParam->enableTxBF = pMac->roam.configParam.txBFEnable; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1896 | pParam->txBFCsnValue = pMac->roam.configParam.txBFCsnValue; |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 1897 | pParam->enableVhtFor24GHz = pMac->roam.configParam.enableVhtFor24GHz; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1898 | #endif |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1899 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1900 | vos_mem_copy(&pMac->roam.configParam.csr11rConfig, |
| 1901 | &pParam->csr11rConfig, sizeof(tCsr11rConfigParams)); |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1902 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1903 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1904 | pParam->isFastTransitionEnabled = pMac->roam.configParam.isFastTransitionEnabled; |
| 1905 | pParam->RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff; |
| 1906 | pParam->nImmediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff; |
| 1907 | pParam->nRoamPrefer5GHz = pMac->roam.configParam.nRoamPrefer5GHz; |
| 1908 | pParam->nRoamIntraBand = pMac->roam.configParam.nRoamIntraBand; |
Srinivas Girigowda | ad34ca9 | 2013-10-22 10:54:29 -0700 | [diff] [blame] | 1909 | pParam->isWESModeEnabled = pMac->roam.configParam.isWESModeEnabled; |
Srinivas Girigowda | 6cf0b82 | 2013-06-27 14:00:20 -0700 | [diff] [blame] | 1910 | pParam->nProbes = pMac->roam.configParam.nProbes; |
| 1911 | pParam->nRoamScanHomeAwayTime = pMac->roam.configParam.nRoamScanHomeAwayTime; |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1912 | #endif |
| 1913 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1914 | pParam->isRoamOffloadScanEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled; |
| 1915 | pParam->bFastRoamInConIniFeatureEnabled = pMac->roam.configParam.bFastRoamInConIniFeatureEnabled; |
| 1916 | #endif |
| 1917 | #ifdef FEATURE_WLAN_LFR |
| 1918 | pParam->isFastRoamIniFeatureEnabled = pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
| 1919 | #endif |
| 1920 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1921 | #ifdef FEATURE_WLAN_ESE |
| 1922 | pParam->isEseIniFeatureEnabled = pMac->roam.configParam.isEseIniFeatureEnabled; |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1923 | #endif |
| 1924 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1925 | vos_mem_copy(&pParam->neighborRoamConfig, |
| 1926 | &pMac->roam.configParam.neighborRoamConfig, |
| 1927 | sizeof(tCsrNeighborRoamConfigParams)); |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1928 | { |
| 1929 | int i; |
| 1930 | smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
| 1931 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1932 | { |
| 1933 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1934 | } |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1935 | } |
| 1936 | #endif |
| 1937 | |
Venkata Prathyusha Kuntupalli | f2695c1 | 2013-04-17 15:41:23 -0700 | [diff] [blame] | 1938 | pParam->enableTxLdpc = pMac->roam.configParam.txLdpcEnable; |
krunal soni | 4f087d2 | 2013-07-29 16:32:26 -0700 | [diff] [blame] | 1939 | |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 1940 | pParam->isAmsduSupportInAMPDU = pMac->roam.configParam.isAmsduSupportInAMPDU; |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1941 | pParam->nSelect5GHzMargin = pMac->roam.configParam.nSelect5GHzMargin; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 1942 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 1943 | pParam->isCoalesingInIBSSAllowed = |
| 1944 | pMac->roam.configParam.isCoalesingInIBSSAllowed; |
Sandeep Puligilla | c80f26e | 2014-03-11 18:36:10 +0530 | [diff] [blame] | 1945 | pParam->allowDFSChannelRoam = |
| 1946 | pMac->roam.configParam.allowDFSChannelRoam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1947 | csrSetChannels(pMac, pParam); |
| 1948 | |
| 1949 | status = eHAL_STATUS_SUCCESS; |
| 1950 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1951 | return (status); |
| 1952 | } |
| 1953 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1954 | eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded) |
| 1955 | { |
| 1956 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 1957 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1958 | tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE; |
| 1959 | eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1960 | do |
| 1961 | { |
| 1962 | if(eCSR_BAND_24 == eBand) |
| 1963 | { |
| 1964 | if(CSR_IS_RADIO_A_ONLY(pMac)) break; |
| 1965 | if((eCSR_DOT11_MODE_11a & phyMode) || (eCSR_DOT11_MODE_11a_ONLY & phyMode)) break; |
| 1966 | } |
| 1967 | if(eCSR_BAND_5G == eBand) |
| 1968 | { |
| 1969 | if(CSR_IS_RADIO_BG_ONLY(pMac)) break; |
| 1970 | if((eCSR_DOT11_MODE_11b & phyMode) || (eCSR_DOT11_MODE_11b_ONLY & phyMode) || |
| 1971 | (eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1972 | ) |
| 1973 | { |
| 1974 | break; |
| 1975 | } |
| 1976 | } |
| 1977 | if((0 == phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode)) |
| 1978 | { |
| 1979 | newPhyMode = eCSR_DOT11_MODE_TAURUS; |
| 1980 | } |
| 1981 | else if(eCSR_DOT11_MODE_AUTO & phyMode) |
| 1982 | { |
| 1983 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1984 | } |
| 1985 | else |
| 1986 | { |
| 1987 | //Check for dual band and higher capability first |
| 1988 | if(eCSR_DOT11_MODE_11n_ONLY & phyMode) |
| 1989 | { |
| 1990 | if(eCSR_DOT11_MODE_11n_ONLY != phyMode) break; |
| 1991 | newPhyMode = eCSR_DOT11_MODE_11n_ONLY; |
| 1992 | } |
| 1993 | else if(eCSR_DOT11_MODE_11a_ONLY & phyMode) |
| 1994 | { |
| 1995 | if(eCSR_DOT11_MODE_11a_ONLY != phyMode) break; |
| 1996 | if(eCSR_BAND_24 == eBand) break; |
| 1997 | newPhyMode = eCSR_DOT11_MODE_11a_ONLY; |
| 1998 | eBand = eCSR_BAND_5G; |
| 1999 | } |
| 2000 | else if(eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 2001 | { |
| 2002 | if(eCSR_DOT11_MODE_11g_ONLY != phyMode) break; |
| 2003 | if(eCSR_BAND_5G == eBand) break; |
| 2004 | newPhyMode = eCSR_DOT11_MODE_11g_ONLY; |
| 2005 | eBand = eCSR_BAND_24; |
| 2006 | } |
| 2007 | else if(eCSR_DOT11_MODE_11b_ONLY & phyMode) |
| 2008 | { |
| 2009 | if(eCSR_DOT11_MODE_11b_ONLY != phyMode) break; |
| 2010 | if(eCSR_BAND_5G == eBand) break; |
| 2011 | newPhyMode = eCSR_DOT11_MODE_11b_ONLY; |
| 2012 | eBand = eCSR_BAND_24; |
| 2013 | } |
| 2014 | else if(eCSR_DOT11_MODE_11n & phyMode) |
| 2015 | { |
| 2016 | newPhyMode = eCSR_DOT11_MODE_11n; |
| 2017 | } |
| 2018 | else if(eCSR_DOT11_MODE_abg & phyMode) |
| 2019 | { |
| 2020 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 2021 | } |
| 2022 | else if(eCSR_DOT11_MODE_11a & phyMode) |
| 2023 | { |
| 2024 | if((eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11b & phyMode)) |
| 2025 | { |
| 2026 | if(eCSR_BAND_ALL == eBand) |
| 2027 | { |
| 2028 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 2029 | } |
| 2030 | else |
| 2031 | { |
| 2032 | //bad setting |
| 2033 | break; |
| 2034 | } |
| 2035 | } |
| 2036 | else |
| 2037 | { |
| 2038 | newPhyMode = eCSR_DOT11_MODE_11a; |
| 2039 | eBand = eCSR_BAND_5G; |
| 2040 | } |
| 2041 | } |
| 2042 | else if(eCSR_DOT11_MODE_11g & phyMode) |
| 2043 | { |
| 2044 | newPhyMode = eCSR_DOT11_MODE_11g; |
| 2045 | eBand = eCSR_BAND_24; |
| 2046 | } |
| 2047 | else if(eCSR_DOT11_MODE_11b & phyMode) |
| 2048 | { |
| 2049 | newPhyMode = eCSR_DOT11_MODE_11b; |
| 2050 | eBand = eCSR_BAND_24; |
| 2051 | } |
| 2052 | else |
| 2053 | { |
| 2054 | //We will never be here |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2055 | smsLog( pMac, LOGE, FL(" cannot recognize the phy mode 0x%08X"), phyMode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2056 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 2057 | } |
| 2058 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2059 | //Done validating |
| 2060 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2061 | //Now we need to check whether a restart is needed. |
| 2062 | if(eBand != pMac->roam.configParam.eBand) |
| 2063 | { |
| 2064 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 2065 | break; |
| 2066 | } |
| 2067 | if(newPhyMode != pMac->roam.configParam.phyMode) |
| 2068 | { |
| 2069 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 2070 | break; |
| 2071 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2072 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2073 | if(HAL_STATUS_SUCCESS(status)) |
| 2074 | { |
| 2075 | pMac->roam.configParam.eBand = eBand; |
| 2076 | pMac->roam.configParam.phyMode = newPhyMode; |
| 2077 | if(pfRestartNeeded) |
| 2078 | { |
| 2079 | *pfRestartNeeded = fRestartNeeded; |
| 2080 | } |
| 2081 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2082 | return (status); |
| 2083 | } |
| 2084 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2085 | void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList ) |
| 2086 | { |
| 2087 | tANI_U8 Index; |
| 2088 | tANI_U8 cChannels; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2089 | // for dual band NICs, don't need to trim the channel list.... |
| 2090 | if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) ) |
| 2091 | { |
| 2092 | // 2.4 GHz band operation requires the channel list to be trimmed to |
| 2093 | // the 2.4 GHz channels only... |
| 2094 | if ( CSR_IS_24_BAND_ONLY( pMac ) ) |
| 2095 | { |
| 2096 | for( Index = 0, cChannels = 0; Index < pChannelList->numChannels; |
| 2097 | Index++ ) |
| 2098 | { |
| 2099 | if ( CSR_IS_CHANNEL_24GHZ(pChannelList->channelList[ Index ]) ) |
| 2100 | { |
| 2101 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 2102 | cChannels++; |
| 2103 | } |
| 2104 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2105 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 2106 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 2107 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 2108 | // only if we need to. |
| 2109 | // |
| 2110 | // The amount of memory to clear is the number of channesl that we trimmed |
| 2111 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 2112 | |
| 2113 | if ( pChannelList->numChannels > cChannels ) |
| 2114 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2115 | vos_mem_set(&pChannelList->channelList[ cChannels ], |
| 2116 | sizeof( pChannelList->channelList[ 0 ] ) * |
| 2117 | ( pChannelList->numChannels - cChannels ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2118 | } |
| 2119 | |
| 2120 | pChannelList->numChannels = cChannels; |
| 2121 | } |
| 2122 | else if ( CSR_IS_5G_BAND_ONLY( pMac ) ) |
| 2123 | { |
| 2124 | for ( Index = 0, cChannels = 0; Index < pChannelList->numChannels; Index++ ) |
| 2125 | { |
| 2126 | if ( CSR_IS_CHANNEL_5GHZ(pChannelList->channelList[ Index ]) ) |
| 2127 | { |
| 2128 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 2129 | cChannels++; |
| 2130 | } |
| 2131 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2132 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 2133 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 2134 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 2135 | // only if we need to. |
| 2136 | // |
| 2137 | // The amount of memory to clear is the number of channesl that we trimmed |
| 2138 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 2139 | if ( pChannelList->numChannels > cChannels ) |
| 2140 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2141 | vos_mem_set(&pChannelList->channelList[ cChannels ], |
| 2142 | sizeof( pChannelList->channelList[ 0 ] ) * |
| 2143 | ( pChannelList->numChannels - cChannels ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2144 | } |
| 2145 | |
| 2146 | pChannelList->numChannels = cChannels; |
| 2147 | } |
| 2148 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2149 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2150 | #define INFRA_AP_DEFAULT_CHANNEL 6 |
| 2151 | eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum) |
| 2152 | { |
| 2153 | tANI_U8 index= 0; |
| 2154 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2155 | for (index=0; index < pMac->scan.base20MHzChannels.numChannels ;index++) |
| 2156 | { |
| 2157 | if(pMac->scan.base20MHzChannels.channelList[ index ] == chnNum){ |
| 2158 | status = eHAL_STATUS_SUCCESS; |
| 2159 | break; |
| 2160 | } |
| 2161 | } |
| 2162 | return status; |
| 2163 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2164 | |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2166 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac) |
| 2167 | { |
| 2168 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2169 | tANI_U8 num20MHzChannelsFound = 0; |
| 2170 | VOS_STATUS vosStatus; |
| 2171 | tANI_U8 Index = 0; |
| 2172 | tANI_U8 num40MHzChannelsFound = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2173 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2174 | |
| 2175 | //TODO: this interface changed to include the 40MHz channel list |
| 2176 | // this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation |
| 2177 | // Read the scan channel list (including the power limit) from EEPROM |
| 2178 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 2179 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 2180 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 2181 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2182 | smsLog( pMac, LOGE, FL("failed to get channels ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2183 | status = eHAL_STATUS_FAILURE; |
| 2184 | } |
| 2185 | else |
| 2186 | { |
| 2187 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 2188 | { |
| 2189 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2190 | } |
| 2191 | pMac->scan.numChannelsDefault = num20MHzChannelsFound; |
| 2192 | // Move the channel list to the global data |
| 2193 | // structure -- this will be used as the scan list |
| 2194 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 2195 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2196 | pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[ Index ].chanId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2197 | } |
| 2198 | pMac->scan.base20MHzChannels.numChannels = num20MHzChannelsFound; |
| 2199 | if(num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 2200 | { |
| 2201 | num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2202 | } |
| 2203 | for ( Index = 0; Index < num40MHzChannelsFound; Index++) |
| 2204 | { |
| 2205 | pMac->scan.base40MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable40MHz[ Index ].chanId; |
| 2206 | } |
| 2207 | pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound; |
| 2208 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2209 | return (status); |
| 2210 | } |
| 2211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2212 | eHalStatus csrInitChannelList( tHalHandle hHal ) |
| 2213 | { |
| 2214 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2215 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2216 | csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels); |
| 2217 | csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels); |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 2218 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_FALSE); |
| 2219 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2220 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2221 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2222 | |
| 2223 | return (status); |
| 2224 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2225 | eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, |
| 2226 | tCsrUpdateConfigParam *pUpdateConfigParam) |
| 2227 | { |
| 2228 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2229 | tCsr11dinfo *ps11dinfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2230 | ps11dinfo = &pUpdateConfigParam->Csr11dinfo; |
| 2231 | status = CsrInit11dInfo(pMac, ps11dinfo); |
| 2232 | return status; |
| 2233 | } |
| 2234 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2235 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2236 | { |
| 2237 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2238 | tANI_U8 index; |
| 2239 | tANI_U32 count=0; |
| 2240 | tSirMacChanInfo *pChanInfo; |
| 2241 | tSirMacChanInfo *pChanInfoStart; |
| 2242 | tANI_BOOLEAN applyConfig = TRUE; |
| 2243 | |
Mihir Shete | bc866f6 | 2014-02-13 16:08:53 +0530 | [diff] [blame] | 2244 | pMac->scan.currentCountryRSSI = -128; |
| 2245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2246 | if(!ps11dinfo) |
| 2247 | { |
| 2248 | return (status); |
| 2249 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2250 | if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) ) |
| 2251 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2252 | pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels; |
| 2253 | vos_mem_copy(pMac->scan.base20MHzChannels.channelList, |
| 2254 | ps11dinfo->Channels.channelList, |
| 2255 | ps11dinfo->Channels.numChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2256 | } |
| 2257 | else |
| 2258 | { |
| 2259 | //No change |
| 2260 | return (eHAL_STATUS_SUCCESS); |
| 2261 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2262 | //legacy maintenance |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2263 | |
| 2264 | vos_mem_copy(pMac->scan.countryCodeDefault, ps11dinfo->countryCode, |
| 2265 | WNI_CFG_COUNTRY_CODE_LEN); |
| 2266 | |
| 2267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2268 | //Tush: at csropen get this initialized with default, during csr reset if this |
| 2269 | // already set with some value no need initilaize with default again |
| 2270 | if(0 == pMac->scan.countryCodeCurrent[0]) |
| 2271 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2272 | vos_mem_copy(pMac->scan.countryCodeCurrent, ps11dinfo->countryCode, |
| 2273 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2274 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2275 | // need to add the max power channel list |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2276 | pChanInfo = vos_mem_malloc(sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2277 | if (pChanInfo != NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2278 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2279 | vos_mem_set(pChanInfo, |
| 2280 | sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN , |
| 2281 | 0); |
| 2282 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2283 | pChanInfoStart = pChanInfo; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2284 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2285 | { |
| 2286 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2287 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2288 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2289 | pChanInfo++; |
| 2290 | count++; |
| 2291 | } |
| 2292 | if(count) |
| 2293 | { |
| 2294 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2295 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2296 | vos_mem_free(pChanInfoStart); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2297 | } |
| 2298 | //Only apply them to CFG when not in STOP state. Otherwise they will be applied later |
| 2299 | if( HAL_STATUS_SUCCESS(status) ) |
| 2300 | { |
| 2301 | for( index = 0; index < CSR_ROAM_SESSION_MAX; index++ ) |
| 2302 | { |
| 2303 | if((CSR_IS_SESSION_VALID(pMac, index)) && CSR_IS_ROAM_STOP(pMac, index)) |
| 2304 | { |
| 2305 | applyConfig = FALSE; |
| 2306 | } |
| 2307 | } |
| 2308 | |
| 2309 | if(TRUE == applyConfig) |
| 2310 | { |
| 2311 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2312 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2313 | } |
| 2314 | |
| 2315 | } |
| 2316 | return (status); |
| 2317 | } |
| 2318 | /* Initialize the Channel + Power List in the local cache and in the CFG */ |
| 2319 | eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2320 | { |
| 2321 | tANI_U8 index; |
| 2322 | tANI_U32 count=0; |
| 2323 | tSirMacChanInfo *pChanInfo; |
| 2324 | tSirMacChanInfo *pChanInfoStart; |
| 2325 | |
| 2326 | if(!ps11dinfo || !pMac) |
| 2327 | { |
| 2328 | return eHAL_STATUS_FAILURE; |
| 2329 | } |
| 2330 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2331 | pChanInfo = vos_mem_malloc(sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2332 | if (pChanInfo != NULL) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2333 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2334 | vos_mem_set(pChanInfo, |
| 2335 | sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN, |
| 2336 | 0); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2337 | pChanInfoStart = pChanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2338 | |
| 2339 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2340 | { |
| 2341 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2342 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2343 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2344 | pChanInfo++; |
| 2345 | count++; |
| 2346 | } |
| 2347 | if(count) |
| 2348 | { |
| 2349 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2350 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2351 | vos_mem_free(pChanInfoStart); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2352 | } |
| 2353 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2354 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2355 | } |
| 2356 | |
| 2357 | //pCommand may be NULL |
| 2358 | //Pass in sessionId in case pCommand is NULL. sessionId is not used in case pCommand is not NULL. |
| 2359 | void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason) |
| 2360 | { |
| 2361 | tListElem *pEntry, *pNextEntry; |
| 2362 | tSmeCmd *pDupCommand; |
| 2363 | tDblLinkList localList; |
| 2364 | |
| 2365 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 2366 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 2367 | { |
| 2368 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 2369 | return; |
| 2370 | } |
| 2371 | csrLLLock( &pMac->sme.smeCmdPendingList ); |
| 2372 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK ); |
| 2373 | while( pEntry ) |
| 2374 | { |
| 2375 | pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ); |
| 2376 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2377 | // Remove the previous command if.. |
| 2378 | // - the new roam command is for the same RoamReason... |
| 2379 | // - the new roam command is a NewProfileList. |
| 2380 | // - the new roam command is a Forced Dissoc |
| 2381 | // - the new roam command is from an 802.11 OID (OID_SSID or OID_BSSID). |
| 2382 | if ( |
| 2383 | (pCommand && ( pCommand->sessionId == pDupCommand->sessionId ) && |
| 2384 | ((pCommand->command == pDupCommand->command) && |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 2385 | /* This peermac check is requried for Softap/GO scenarios |
| 2386 | * For STA scenario below OR check will suffice as pCommand will |
| 2387 | * always be NULL for STA scenarios |
| 2388 | */ |
| 2389 | (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] | 2390 | (pCommand->u.roamCmd.roamReason == pDupCommand->u.roamCmd.roamReason || |
| 2391 | eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason || |
| 2392 | eCsrHddIssued == pCommand->u.roamCmd.roamReason))) |
| 2393 | || |
| 2394 | //below the pCommand is NULL |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2395 | ( (sessionId == pDupCommand->sessionId) && |
| 2396 | (eSmeCommandRoam == pDupCommand->command) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2397 | ((eCsrForcedDisassoc == eRoamReason) || |
| 2398 | (eCsrHddIssued == eRoamReason)) |
| 2399 | ) |
| 2400 | ) |
| 2401 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2402 | smsLog(pMac, LOGW, FL(" roamReason = %d"), pDupCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2403 | // Remove the 'stale' roam command from the pending list... |
| 2404 | if(csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK )) |
| 2405 | { |
| 2406 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 2407 | } |
| 2408 | } |
| 2409 | pEntry = pNextEntry; |
| 2410 | } |
| 2411 | csrLLUnlock( &pMac->sme.smeCmdPendingList ); |
| 2412 | |
| 2413 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 2414 | { |
| 2415 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 2416 | //Tell caller that the command is cancelled |
| 2417 | csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL, pDupCommand->u.roamCmd.roamId, |
| 2418 | eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE); |
| 2419 | csrReleaseCommandRoam(pMac, pDupCommand); |
| 2420 | } |
| 2421 | csrLLClose(&localList); |
| 2422 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2423 | eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, |
| 2424 | tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2) |
| 2425 | { |
| 2426 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2427 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2428 | WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type); |
| 2429 | #endif |
| 2430 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2431 | if( CSR_IS_SESSION_VALID( pMac, sessionId) ) |
| 2432 | { |
| 2433 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2434 | } |
| 2435 | else |
| 2436 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2437 | smsLog(pMac, LOGE, "Session ID:%d is not valid", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2438 | VOS_ASSERT(0); |
| 2439 | return eHAL_STATUS_FAILURE; |
| 2440 | } |
krunal soni | 587bf01 | 2014-02-04 12:35:11 -0800 | [diff] [blame] | 2441 | |
| 2442 | if (eANI_BOOLEAN_FALSE == pSession->sessionActive) |
| 2443 | { |
| 2444 | smsLog(pMac, LOG1, "%s Session is not Active", __func__); |
| 2445 | return eHAL_STATUS_FAILURE; |
| 2446 | } |
krunal soni | 7f7d2c9 | 2014-02-06 15:08:43 -0800 | [diff] [blame] | 2447 | |
krunal soni | 587bf01 | 2014-02-04 12:35:11 -0800 | [diff] [blame] | 2448 | smsLog(pMac, LOG4, "Recieved RoamCmdStatus %d with Roam Result %d", u1, u2); |
| 2449 | |
krunal soni | 7f7d2c9 | 2014-02-06 15:08:43 -0800 | [diff] [blame] | 2450 | if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2451 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2452 | smsLog(pMac, LOGW, " Assoc complete result = %d statusCode = %d reasonCode = %d", u2, pRoamInfo->statusCode, pRoamInfo->reasonCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2453 | } |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 2454 | if ((u1 == eCSR_ROAM_FT_REASSOC_FAILED) && (pSession->bRefAssocStartCnt)) { |
| 2455 | /* |
| 2456 | * Decrement bRefAssocStartCnt for FT reassoc failure. |
| 2457 | * Reason: For FT reassoc failures, we first call |
| 2458 | * csrRoamCallCallback before notifying a failed roam |
| 2459 | * completion through csrRoamComplete. The latter in |
| 2460 | * turn calls csrRoamProcessResults which tries to |
| 2461 | * once again call csrRoamCallCallback if bRefAssocStartCnt |
| 2462 | * is non-zero. Since this is redundant for FT reassoc |
| 2463 | * failure, decrement bRefAssocStartCnt. |
| 2464 | */ |
| 2465 | pSession->bRefAssocStartCnt--; |
| 2466 | } |
| 2467 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2468 | if(NULL != pSession->callback) |
| 2469 | { |
| 2470 | if( pRoamInfo ) |
| 2471 | { |
| 2472 | pRoamInfo->sessionId = (tANI_U8)sessionId; |
| 2473 | } |
| 2474 | |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 2475 | /* avoid holding the global lock when making the roaming callback, original change came |
| 2476 | from a raised CR (CR304874). Since this callback is in HDD a potential deadlock |
| 2477 | is possible on other OS ports where the callback may need to take locks to protect |
| 2478 | HDD state |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2479 | UPDATE : revert this change but keep the comments here. Need to revisit as there are callbacks |
| 2480 | that may actually depend on the lock being held */ |
| 2481 | // TODO: revisit: sme_ReleaseGlobalLock( &pMac->sme ); |
| 2482 | status = pSession->callback(pSession->pContext, pRoamInfo, roamId, u1, u2); |
| 2483 | // TODO: revisit: sme_AcquireGlobalLock( &pMac->sme ); |
| 2484 | } |
| 2485 | //EVENT_WLAN_STATUS: eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 2486 | // eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED, |
| 2487 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2488 | vos_mem_set(&connectionStatus, |
| 2489 | sizeof(vos_event_wlan_status_payload_type), 0); |
| 2490 | |
krunal soni | 7f7d2c9 | 2014-02-06 15:08:43 -0800 | [diff] [blame] | 2491 | if((eCSR_ROAM_ASSOCIATION_COMPLETION == u1) && (eCSR_ROAM_RESULT_ASSOCIATED == u2) && pRoamInfo) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2492 | { |
| 2493 | connectionStatus.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 2494 | connectionStatus.bssType = pRoamInfo->u.pConnectedProfile->BSSType; |
| 2495 | if(NULL != pRoamInfo->pBssDesc) |
| 2496 | { |
| 2497 | connectionStatus.rssi = pRoamInfo->pBssDesc->rssi * (-1); |
| 2498 | connectionStatus.channel = pRoamInfo->pBssDesc->channelId; |
| 2499 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2500 | connectionStatus.qosCapability = pRoamInfo->u.pConnectedProfile->qosConnection; |
| 2501 | connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType); |
| 2502 | connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2503 | vos_mem_copy(connectionStatus.ssid, |
| 2504 | pRoamInfo->u.pConnectedProfile->SSID.ssId, 6); |
| 2505 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2506 | connectionStatus.reason = eCSR_REASON_UNSPECIFIED; |
| 2507 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2508 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2509 | if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2)) |
| 2510 | { |
| 2511 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2512 | connectionStatus.reason = eCSR_REASON_MIC_ERROR; |
| 2513 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2514 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2515 | if(eCSR_ROAM_RESULT_FORCED == u2) |
| 2516 | { |
| 2517 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2518 | connectionStatus.reason = eCSR_REASON_USER_REQUESTED; |
| 2519 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2520 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2521 | if(eCSR_ROAM_RESULT_DISASSOC_IND == u2) |
| 2522 | { |
| 2523 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2524 | connectionStatus.reason = eCSR_REASON_DISASSOC; |
| 2525 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2526 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2527 | if(eCSR_ROAM_RESULT_DEAUTH_IND == u2) |
| 2528 | { |
| 2529 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2530 | connectionStatus.reason = eCSR_REASON_DEAUTH; |
| 2531 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2533 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2534 | |
| 2535 | return (status); |
| 2536 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2537 | // Returns whether handoff is currently in progress or not |
| 2538 | tANI_BOOLEAN csrRoamIsHandoffInProgress(tpAniSirGlobal pMac) |
| 2539 | { |
| 2540 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 2541 | return csrNeighborRoamIsHandoffInProgress(pMac); |
| 2542 | #else |
| 2543 | return eANI_BOOLEAN_FALSE; |
| 2544 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2545 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2546 | eHalStatus csrRoamIssueDisassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2547 | eCsrRoamSubState NewSubstate, tANI_BOOLEAN fMICFailure ) |
| 2548 | { |
| 2549 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2550 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2551 | tANI_U16 reasonCode; |
| 2552 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2553 | |
| 2554 | if(!pSession) |
| 2555 | { |
| 2556 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2557 | return eHAL_STATUS_FAILURE; |
| 2558 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2559 | |
| 2560 | //Restore AC weight in case we change it |
| 2561 | if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 2562 | { |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 2563 | 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] | 2564 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 2565 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 2566 | } |
| 2567 | |
| 2568 | if ( fMICFailure ) |
| 2569 | { |
| 2570 | reasonCode = eSIR_MAC_MIC_FAILURE_REASON; |
| 2571 | } |
| 2572 | else if (NewSubstate == eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF) |
| 2573 | { |
| 2574 | reasonCode = eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2575 | } |
| 2576 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2577 | { |
| 2578 | reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 2579 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2580 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2581 | if ( (csrRoamIsHandoffInProgress(pMac)) && |
| 2582 | (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF)) |
| 2583 | { |
| 2584 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2585 | vos_mem_copy(&bssId, |
| 2586 | pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, |
| 2587 | sizeof(tSirMacAddr)); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2588 | } |
| 2589 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2590 | #endif |
| 2591 | if(pSession->pConnectBssDesc) |
| 2592 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2593 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2594 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2595 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2596 | |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 2597 | smsLog(pMac, LOG2, FL("CSR Attempting to Disassociate Bssid="MAC_ADDRESS_STR |
| 2598 | " subState = %s reason=%d"), |
| 2599 | MAC_ADDR_ARRAY(bssId), macTraceGetcsrRoamSubState(NewSubstate), |
| 2600 | reasonCode); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 2601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2602 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2603 | |
| 2604 | status = csrSendMBDisassocReqMsg( pMac, sessionId, bssId, reasonCode ); |
| 2605 | |
| 2606 | if(HAL_STATUS_SUCCESS(status)) |
| 2607 | { |
| 2608 | csrRoamLinkDown(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2609 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2610 | //no need to tell QoS that we are disassociating, it will be taken care off in assoc req for HO |
| 2611 | if(eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate) |
| 2612 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2613 | //notify QoS module that disassoc happening |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2614 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 2615 | } |
| 2616 | #endif |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2617 | } |
| 2618 | else |
| 2619 | { |
| 2620 | smsLog(pMac, LOGW, FL("csrSendMBDisassocReqMsg failed with status %d"), status); |
| 2621 | } |
| 2622 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2623 | return (status); |
| 2624 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2625 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2626 | /* --------------------------------------------------------------------------- |
| 2627 | \fn csrRoamIssueDisassociateStaCmd |
| 2628 | \brief csr function that HDD calls to disassociate a associated station |
| 2629 | \param sessionId - session Id for Soft AP |
| 2630 | \param pPeerMacAddr - MAC of associated station to delete |
| 2631 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2632 | \return eHalStatus |
| 2633 | ---------------------------------------------------------------------------*/ |
| 2634 | eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, |
| 2635 | tANI_U32 sessionId, |
| 2636 | tANI_U8 *pPeerMacAddr, |
| 2637 | tANI_U32 reason) |
| 2638 | { |
| 2639 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2640 | tSmeCmd *pCommand; |
| 2641 | |
| 2642 | do |
| 2643 | { |
| 2644 | pCommand = csrGetCommandBuffer( pMac ); |
| 2645 | if ( !pCommand ) |
| 2646 | { |
| 2647 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2648 | status = eHAL_STATUS_RESOURCES; |
| 2649 | break; |
| 2650 | } |
| 2651 | pCommand->command = eSmeCommandRoam; |
| 2652 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2653 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocSta; |
| 2654 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2655 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2656 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2657 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2658 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2659 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2660 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2661 | } |
| 2662 | }while(0); |
| 2663 | |
| 2664 | return status; |
| 2665 | } |
| 2666 | |
| 2667 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2668 | /* --------------------------------------------------------------------------- |
| 2669 | \fn csrRoamIssueDeauthSta |
| 2670 | \brief csr function that HDD calls to delete a associated station |
| 2671 | \param sessionId - session Id for Soft AP |
| 2672 | \param pPeerMacAddr - MAC of associated station to delete |
| 2673 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2674 | \return eHalStatus |
| 2675 | ---------------------------------------------------------------------------*/ |
| 2676 | eHalStatus csrRoamIssueDeauthStaCmd( tpAniSirGlobal pMac, |
| 2677 | tANI_U32 sessionId, |
| 2678 | tANI_U8 *pPeerMacAddr, |
| 2679 | tANI_U32 reason) |
| 2680 | { |
| 2681 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2682 | tSmeCmd *pCommand; |
| 2683 | |
| 2684 | do |
| 2685 | { |
| 2686 | pCommand = csrGetCommandBuffer( pMac ); |
| 2687 | if ( !pCommand ) |
| 2688 | { |
| 2689 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2690 | status = eHAL_STATUS_RESOURCES; |
| 2691 | break; |
| 2692 | } |
| 2693 | pCommand->command = eSmeCommandRoam; |
| 2694 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2695 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 2696 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2697 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2698 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2699 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2700 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2701 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2702 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2703 | } |
| 2704 | }while(0); |
| 2705 | |
| 2706 | return status; |
| 2707 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2708 | eHalStatus |
| 2709 | csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2710 | tANI_BOOLEAN bEnable ) |
| 2711 | { |
| 2712 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2713 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2714 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2715 | if (!pSession) |
| 2716 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2717 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2718 | return (status); |
| 2719 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2720 | if (pSession->pConnectBssDesc) |
| 2721 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2722 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2723 | } |
| 2724 | else |
| 2725 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2726 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2727 | return (status); |
| 2728 | } |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2729 | smsLog( pMac, LOG2, "CSR issuing tkip counter measures for Bssid = "MAC_ADDRESS_STR", Enable = %d", |
| 2730 | MAC_ADDR_ARRAY(bssId), bEnable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2731 | status = csrSendMBTkipCounterMeasuresReqMsg( pMac, sessionId, bEnable, bssId ); |
| 2732 | return (status); |
| 2733 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2734 | eHalStatus |
| 2735 | csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2736 | VOS_MODULE_ID modId, void *pUsrContext, |
| 2737 | void *pfnSapEventCallback, v_U8_t *pAssocStasBuf ) |
| 2738 | { |
| 2739 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2740 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2741 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2742 | if (!pSession) |
| 2743 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2744 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2745 | return (status); |
| 2746 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2747 | if(pSession->pConnectBssDesc) |
| 2748 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2749 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2750 | } |
| 2751 | else |
| 2752 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2753 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2754 | return (status); |
| 2755 | } |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2756 | smsLog( pMac, LOG2, "CSR getting associated stations for Bssid = "MAC_ADDRESS_STR, |
| 2757 | MAC_ADDR_ARRAY(bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2758 | status = csrSendMBGetAssociatedStasReqMsg( pMac, sessionId, modId, bssId, pUsrContext, pfnSapEventCallback, pAssocStasBuf ); |
| 2759 | return (status); |
| 2760 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2761 | eHalStatus |
| 2762 | csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2763 | void *pUsrContext, void *pfnSapEventCallback, v_MACADDR_t pRemoveMac ) |
| 2764 | { |
| 2765 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2766 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2767 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2768 | |
| 2769 | if (!pSession) |
| 2770 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2771 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2772 | return (status); |
| 2773 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2774 | if(pSession->pConnectBssDesc) |
| 2775 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2776 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2777 | } |
| 2778 | else |
| 2779 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2780 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2781 | return (status); |
| 2782 | } |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2783 | smsLog( pMac, LOG2, "CSR getting WPS Session Overlap for Bssid = "MAC_ADDRESS_STR, |
| 2784 | MAC_ADDR_ARRAY(bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2785 | |
| 2786 | status = csrSendMBGetWPSPBCSessions( pMac, sessionId, bssId, pUsrContext, pfnSapEventCallback, pRemoveMac); |
| 2787 | |
| 2788 | return (status); |
| 2789 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2790 | eHalStatus csrRoamIssueDeauth( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 2791 | { |
| 2792 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2793 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2794 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2795 | |
| 2796 | if (!pSession) |
| 2797 | { |
| 2798 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2799 | return eHAL_STATUS_FAILURE; |
| 2800 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2801 | |
| 2802 | if(pSession->pConnectBssDesc) |
| 2803 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2804 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2805 | } |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2806 | smsLog( pMac, LOG2, "CSR Attempting to Deauth Bssid= "MAC_ADDRESS_STR, |
| 2807 | MAC_ADDR_ARRAY(bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2808 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2809 | |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2810 | status = csrSendMBDeauthReqMsg( pMac, sessionId, bssId, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2811 | if(!HAL_STATUS_SUCCESS(status)) |
| 2812 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 2813 | smsLog(pMac, LOGE, FL("csrSendMBDeauthReqMsg failed with status %d Session ID: %d" |
| 2814 | MAC_ADDRESS_STR ), status, sessionId, MAC_ADDR_ARRAY(bssId)); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2815 | } |
| 2816 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2817 | return (status); |
| 2818 | } |
| 2819 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2820 | eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc ) |
| 2821 | { |
| 2822 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2823 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2824 | tANI_U32 size; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2825 | |
| 2826 | if(!pSession) |
| 2827 | { |
| 2828 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2829 | return eHAL_STATUS_FAILURE; |
| 2830 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2831 | |
| 2832 | // If no BSS description was found in this connection (happens with start IBSS), then |
| 2833 | // nix the BSS description that we keep around for the connected BSS) and get out... |
| 2834 | if(NULL == pBssDesc) |
| 2835 | { |
| 2836 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2837 | } |
| 2838 | else |
| 2839 | { |
| 2840 | size = pBssDesc->length + sizeof( pBssDesc->length ); |
| 2841 | if(NULL != pSession->pConnectBssDesc) |
| 2842 | { |
| 2843 | if(((pSession->pConnectBssDesc->length) + sizeof(pSession->pConnectBssDesc->length)) < size) |
| 2844 | { |
| 2845 | //not enough room for the new BSS, pMac->roam.pConnectBssDesc is freed inside |
| 2846 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2847 | } |
| 2848 | } |
| 2849 | if(NULL == pSession->pConnectBssDesc) |
| 2850 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2851 | pSession->pConnectBssDesc = vos_mem_malloc(size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2852 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2853 | if (NULL == pSession->pConnectBssDesc) |
| 2854 | status = eHAL_STATUS_FAILURE; |
| 2855 | else |
| 2856 | vos_mem_copy(pSession->pConnectBssDesc, pBssDesc, size); |
| 2857 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2858 | return (status); |
| 2859 | } |
| 2860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2861 | eHalStatus csrRoamPrepareBssConfig(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2862 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 2863 | tDot11fBeaconIEs *pIes) |
| 2864 | { |
| 2865 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2866 | eCsrCfgDot11Mode cfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2867 | VOS_ASSERT( pIes != NULL ); |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 2868 | if (pIes == NULL) |
| 2869 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2870 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2871 | do |
| 2872 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2873 | vos_mem_copy(&pBssConfig->BssCap, &pBssDesc->capabilityInfo, |
| 2874 | sizeof(tSirMacCapabilityInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2875 | //get qos |
| 2876 | pBssConfig->qosType = csrGetQoSFromBssDesc(pMac, pBssDesc, pIes); |
| 2877 | //get SSID |
| 2878 | if(pIes->SSID.present) |
| 2879 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2880 | vos_mem_copy(&pBssConfig->SSID.ssId, pIes->SSID.ssid, pIes->SSID.num_ssid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2881 | pBssConfig->SSID.length = pIes->SSID.num_ssid; |
| 2882 | } |
| 2883 | else |
| 2884 | pBssConfig->SSID.length = 0; |
| 2885 | if(csrIsNULLSSID(pBssConfig->SSID.ssId, pBssConfig->SSID.length)) |
| 2886 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2887 | smsLog(pMac, LOGW, " BSS desc SSID is a wildcard"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2888 | //Return failed if profile doesn't have an SSID either. |
| 2889 | if(pProfile->SSIDs.numOfSSIDs == 0) |
| 2890 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2891 | smsLog(pMac, LOGW, " Both BSS desc and profile doesn't have SSID"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2892 | status = eHAL_STATUS_FAILURE; |
| 2893 | break; |
| 2894 | } |
| 2895 | } |
| 2896 | if(CSR_IS_CHANNEL_5GHZ(pBssDesc->channelId)) |
| 2897 | { |
| 2898 | pBssConfig->eBand = eCSR_BAND_5G; |
| 2899 | } |
| 2900 | else |
| 2901 | { |
| 2902 | pBssConfig->eBand = eCSR_BAND_24; |
| 2903 | } |
| 2904 | //phymode |
| 2905 | if(csrIsPhyModeMatch( pMac, pProfile->phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes )) |
| 2906 | { |
| 2907 | pBssConfig->uCfgDot11Mode = cfgDot11Mode; |
| 2908 | } |
| 2909 | else |
| 2910 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2911 | smsLog(pMac, LOGW, " Can not find match phy mode"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2912 | //force it |
| 2913 | if(eCSR_BAND_24 == pBssConfig->eBand) |
| 2914 | { |
| 2915 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2916 | } |
| 2917 | else |
| 2918 | { |
| 2919 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2920 | } |
| 2921 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2922 | //Qos |
| 2923 | if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) && |
| 2924 | (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos)) |
| 2925 | { |
| 2926 | //Joining BSS is not 11n capable and WMM is disabled on client. |
| 2927 | //Disable QoS and WMM |
| 2928 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2929 | } |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2930 | |
| 2931 | if (((pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11N) || |
Pratik Bhalgat | 8d46164 | 2012-11-22 16:55:42 +0530 | [diff] [blame] | 2932 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC)) && |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2933 | ((pBssConfig->qosType != eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP) || |
| 2934 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_HCF) || |
| 2935 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_eDCF) )) |
| 2936 | { |
| 2937 | //Joining BSS is 11n capable and WMM is disabled on AP. |
| 2938 | //Assume all HT AP's are QOS AP's and enable WMM |
| 2939 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2940 | } |
| 2941 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2942 | //auth type |
| 2943 | switch( pProfile->negotiatedAuthType ) |
| 2944 | { |
| 2945 | default: |
| 2946 | case eCSR_AUTH_TYPE_WPA: |
| 2947 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2948 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2949 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2950 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2951 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2952 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2953 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2954 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2955 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2956 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2957 | break; |
| 2958 | } |
| 2959 | //short slot time |
| 2960 | if( eCSR_CFG_DOT11_MODE_11B != cfgDot11Mode ) |
| 2961 | { |
| 2962 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2963 | } |
| 2964 | else |
| 2965 | { |
| 2966 | pBssConfig->uShortSlotTime = 0; |
| 2967 | } |
| 2968 | if(pBssConfig->BssCap.ibss) |
| 2969 | { |
| 2970 | //We don't support 11h on IBSS |
| 2971 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2972 | } |
| 2973 | else |
| 2974 | { |
| 2975 | pBssConfig->f11hSupport = pMac->roam.configParam.Is11hSupportEnabled; |
| 2976 | } |
| 2977 | //power constraint |
| 2978 | pBssConfig->uPowerLimit = csrGet11hPowerConstraint(pMac, &pIes->PowerConstraints); |
| 2979 | //heartbeat |
| 2980 | if ( CSR_IS_11A_BSS( pBssDesc ) ) |
| 2981 | { |
| 2982 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2983 | } |
| 2984 | else |
| 2985 | { |
| 2986 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 2987 | } |
| 2988 | //Join timeout |
| 2989 | // 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] | 2990 | // be 10 x the BeaconInterval. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2991 | if ( pBssDesc->beaconInterval ) |
| 2992 | { |
| 2993 | //Make sure it is bigger than the minimal |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2994 | 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] | 2995 | } |
| 2996 | else |
| 2997 | { |
| 2998 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
| 2999 | } |
| 3000 | //validate CB |
| 3001 | pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3002 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3003 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3004 | return (status); |
| 3005 | } |
| 3006 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3007 | static eHalStatus csrRoamPrepareBssConfigFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 3008 | tBssConfigParam *pBssConfig, tSirBssDescription *pBssDesc) |
| 3009 | { |
| 3010 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3011 | tANI_U8 operationChannel = 0; |
| 3012 | tANI_U8 qAPisEnabled = FALSE; |
| 3013 | //SSID |
| 3014 | pBssConfig->SSID.length = 0; |
| 3015 | if(pProfile->SSIDs.numOfSSIDs) |
| 3016 | { |
| 3017 | //only use the first one |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3018 | vos_mem_copy(&pBssConfig->SSID, &pProfile->SSIDs.SSIDList[0].SSID, |
| 3019 | sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3020 | } |
| 3021 | else |
| 3022 | { |
| 3023 | //SSID must present |
| 3024 | return eHAL_STATUS_FAILURE; |
| 3025 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3026 | //Settomg up the capabilities |
| 3027 | if( csrIsBssTypeIBSS(pProfile->BSSType) ) |
| 3028 | { |
| 3029 | pBssConfig->BssCap.ibss = 1; |
| 3030 | } |
| 3031 | else |
| 3032 | { |
| 3033 | pBssConfig->BssCap.ess = 1; |
| 3034 | } |
| 3035 | if( eCSR_ENCRYPT_TYPE_NONE != pProfile->EncryptionType.encryptionType[0] ) |
| 3036 | { |
| 3037 | pBssConfig->BssCap.privacy = 1; |
| 3038 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3039 | pBssConfig->eBand = pMac->roam.configParam.eBand; |
| 3040 | //phymode |
| 3041 | if(pProfile->ChannelInfo.ChannelList) |
| 3042 | { |
| 3043 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 3044 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3045 | pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, operationChannel, |
| 3046 | &pBssConfig->eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3047 | //QOS |
| 3048 | //Is this correct to always set to this //*** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3049 | if ( pBssConfig->BssCap.ess == 1 ) |
| 3050 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3051 | /*For Softap case enable WMM*/ |
| 3052 | if(CSR_IS_INFRA_AP(pProfile) && (eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode )){ |
| 3053 | qAPisEnabled = TRUE; |
| 3054 | } |
| 3055 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3056 | if (csrRoamGetQosInfoFromBss(pMac, pBssDesc) == eHAL_STATUS_SUCCESS) { |
| 3057 | qAPisEnabled = TRUE; |
| 3058 | } else { |
| 3059 | qAPisEnabled = FALSE; |
| 3060 | } |
| 3061 | } else { |
| 3062 | qAPisEnabled = TRUE; |
| 3063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3064 | if (( eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && qAPisEnabled) || |
| 3065 | (( eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && qAPisEnabled) || |
| 3066 | ( eCSR_CFG_DOT11_MODE_TAURUS == pBssConfig->uCfgDot11Mode ) ) //For 11n, need QoS |
| 3067 | ) |
| 3068 | { |
| 3069 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 3070 | } else { |
| 3071 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 3072 | } |
| 3073 | |
| 3074 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 3075 | switch( pProfile->AuthType.authType[0] ) //Take the preferred Auth type. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3076 | { |
| 3077 | default: |
| 3078 | case eCSR_AUTH_TYPE_WPA: |
| 3079 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 3080 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 3081 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3082 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 3083 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3084 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 3085 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 3086 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3087 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 3088 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 3089 | break; |
| 3090 | } |
| 3091 | //short slot time |
| 3092 | if( WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode ) |
| 3093 | { |
| 3094 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 3095 | } |
| 3096 | else |
| 3097 | { |
| 3098 | pBssConfig->uShortSlotTime = 0; |
| 3099 | } |
| 3100 | //power constraint. We don't support 11h on IBSS |
| 3101 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 3102 | pBssConfig->uPowerLimit = 0; |
| 3103 | //heartbeat |
| 3104 | if ( eCSR_BAND_5G == pBssConfig->eBand ) |
| 3105 | { |
| 3106 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 3107 | } |
| 3108 | else |
| 3109 | { |
| 3110 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 3111 | } |
| 3112 | //Join timeout |
| 3113 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3115 | return (status); |
| 3116 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3117 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc) |
| 3118 | { |
| 3119 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3120 | tDot11fBeaconIEs *pIes = NULL; |
| 3121 | |
| 3122 | do |
| 3123 | { |
| 3124 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 3125 | { |
| 3126 | //err msg |
| 3127 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3128 | "csrRoamGetQosInfoFromBss() failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3129 | break; |
| 3130 | } |
| 3131 | //check if the AP is QAP & it supports APSD |
| 3132 | if( CSR_IS_QOS_BSS(pIes) ) |
| 3133 | { |
Kiet Lam | b537cfb | 2013-11-07 12:56:49 +0530 | [diff] [blame] | 3134 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3135 | } |
| 3136 | } while (0); |
Kiet Lam | b537cfb | 2013-11-07 12:56:49 +0530 | [diff] [blame] | 3137 | |
| 3138 | if (NULL != pIes) |
| 3139 | { |
| 3140 | vos_mem_free(pIes); |
| 3141 | } |
| 3142 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3143 | return status; |
| 3144 | } |
| 3145 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3146 | void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy ) |
| 3147 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3148 | // !! Note: the only difference between this function and the csrSetCfgPrivacyFromProfile() is the |
| 3149 | // setting of the privacy CFG based on the advertised privacy setting from the AP for WPA associations. |
| 3150 | // See !!Note: below in this function... |
| 3151 | tANI_U32 PrivacyEnabled = 0; |
| 3152 | tANI_U32 RsnEnabled = 0; |
| 3153 | tANI_U32 WepDefaultKeyId = 0; |
| 3154 | tANI_U32 WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; /* default 40 bits */ |
| 3155 | tANI_U32 Key0Length = 0; |
| 3156 | tANI_U32 Key1Length = 0; |
| 3157 | tANI_U32 Key2Length = 0; |
| 3158 | tANI_U32 Key3Length = 0; |
| 3159 | |
| 3160 | // Reserve for the biggest key |
| 3161 | tANI_U8 Key0[ WNI_CFG_WEP_DEFAULT_KEY_1_LEN ]; |
| 3162 | tANI_U8 Key1[ WNI_CFG_WEP_DEFAULT_KEY_2_LEN ]; |
| 3163 | tANI_U8 Key2[ WNI_CFG_WEP_DEFAULT_KEY_3_LEN ]; |
| 3164 | tANI_U8 Key3[ WNI_CFG_WEP_DEFAULT_KEY_4_LEN ]; |
| 3165 | |
| 3166 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 3167 | { |
| 3168 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3169 | |
| 3170 | // for NO encryption, turn off Privacy and Rsn. |
| 3171 | PrivacyEnabled = 0; |
| 3172 | RsnEnabled = 0; |
| 3173 | |
| 3174 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 3175 | |
| 3176 | // clear out the WEP keys that may be hanging around. |
| 3177 | Key0Length = 0; |
| 3178 | Key1Length = 0; |
| 3179 | Key2Length = 0; |
| 3180 | Key3Length = 0; |
| 3181 | |
| 3182 | break; |
| 3183 | |
| 3184 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3185 | case eCSR_ENCRYPT_TYPE_WEP40: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3186 | |
| 3187 | // Privacy is ON. NO RSN for Wep40 static key. |
| 3188 | PrivacyEnabled = 1; |
| 3189 | RsnEnabled = 0; |
| 3190 | |
| 3191 | // Set the Wep default key ID. |
| 3192 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3193 | // Wep key size if 5 bytes (40 bits). |
| 3194 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3195 | |
| 3196 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 3197 | if ( pProfile->Keys.KeyLength[0] ) |
| 3198 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3199 | vos_mem_copy(Key0, pProfile->Keys.KeyMaterial[0], |
| 3200 | WNI_CFG_WEP_KEY_LENGTH_5); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3201 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3202 | } |
| 3203 | else |
| 3204 | { |
| 3205 | Key0Length = 0; |
| 3206 | } |
| 3207 | |
| 3208 | if ( pProfile->Keys.KeyLength[1] ) |
| 3209 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3210 | vos_mem_copy(Key1, pProfile->Keys.KeyMaterial[1], |
| 3211 | WNI_CFG_WEP_KEY_LENGTH_5); |
| 3212 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_5; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3213 | } |
| 3214 | else |
| 3215 | { |
| 3216 | Key1Length = 0; |
| 3217 | } |
| 3218 | |
| 3219 | if ( pProfile->Keys.KeyLength[2] ) |
| 3220 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3221 | vos_mem_copy(Key2, pProfile->Keys.KeyMaterial[2], |
| 3222 | WNI_CFG_WEP_KEY_LENGTH_5); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3223 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3224 | } |
| 3225 | else |
| 3226 | { |
| 3227 | Key2Length = 0; |
| 3228 | } |
| 3229 | |
| 3230 | if ( pProfile->Keys.KeyLength[3] ) |
| 3231 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3232 | vos_mem_copy(Key3, pProfile->Keys.KeyMaterial[3], |
| 3233 | WNI_CFG_WEP_KEY_LENGTH_5); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3234 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3235 | } |
| 3236 | else |
| 3237 | { |
| 3238 | Key3Length = 0; |
| 3239 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3240 | break; |
| 3241 | |
| 3242 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3243 | case eCSR_ENCRYPT_TYPE_WEP104: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3244 | |
| 3245 | // Privacy is ON. NO RSN for Wep40 static key. |
| 3246 | PrivacyEnabled = 1; |
| 3247 | RsnEnabled = 0; |
| 3248 | |
| 3249 | // Set the Wep default key ID. |
| 3250 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
| 3251 | |
| 3252 | // Wep key size if 13 bytes (104 bits). |
| 3253 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3254 | |
| 3255 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 3256 | if ( pProfile->Keys.KeyLength[0] ) |
| 3257 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3258 | vos_mem_copy(Key0, pProfile->Keys.KeyMaterial[ 0 ], |
| 3259 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3260 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3261 | } |
| 3262 | else |
| 3263 | { |
| 3264 | Key0Length = 0; |
| 3265 | } |
| 3266 | |
| 3267 | if ( pProfile->Keys.KeyLength[1] ) |
| 3268 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3269 | vos_mem_copy(Key1, pProfile->Keys.KeyMaterial[ 1 ], |
| 3270 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3271 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3272 | } |
| 3273 | else |
| 3274 | { |
| 3275 | Key1Length = 0; |
| 3276 | } |
| 3277 | |
| 3278 | if ( pProfile->Keys.KeyLength[2] ) |
| 3279 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3280 | vos_mem_copy(Key2, pProfile->Keys.KeyMaterial[ 2 ], |
| 3281 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3282 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3283 | } |
| 3284 | else |
| 3285 | { |
| 3286 | Key2Length = 0; |
| 3287 | } |
| 3288 | |
| 3289 | if ( pProfile->Keys.KeyLength[3] ) |
| 3290 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3291 | vos_mem_copy(Key3, pProfile->Keys.KeyMaterial[ 3 ], |
| 3292 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3293 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3294 | } |
| 3295 | else |
| 3296 | { |
| 3297 | Key3Length = 0; |
| 3298 | } |
| 3299 | |
| 3300 | break; |
| 3301 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3302 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3303 | case eCSR_ENCRYPT_TYPE_AES: |
| 3304 | #ifdef FEATURE_WLAN_WAPI |
| 3305 | case eCSR_ENCRYPT_TYPE_WPI: |
| 3306 | #endif /* FEATURE_WLAN_WAPI */ |
| 3307 | // !! Note: this is the only difference between this function and the csrSetCfgPrivacyFromProfile() |
| 3308 | // (setting of the privacy CFG based on the advertised privacy setting from the AP for WPA/WAPI associations ). |
| 3309 | PrivacyEnabled = (0 != fPrivacy); |
| 3310 | |
| 3311 | // turn on RSN enabled for WPA associations |
| 3312 | RsnEnabled = 1; |
| 3313 | |
| 3314 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 3315 | |
| 3316 | // clear out the static WEP keys that may be hanging around. |
| 3317 | Key0Length = 0; |
| 3318 | Key1Length = 0; |
| 3319 | Key2Length = 0; |
| 3320 | Key3Length = 0; |
| 3321 | |
| 3322 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3323 | default: |
| 3324 | PrivacyEnabled = 0; |
| 3325 | RsnEnabled = 0; |
| 3326 | break; |
| 3327 | } |
| 3328 | |
| 3329 | ccmCfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3330 | ccmCfgSetInt(pMac, WNI_CFG_RSN_ENABLED, RsnEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3331 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length, NULL, eANI_BOOLEAN_FALSE); |
| 3332 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length, NULL, eANI_BOOLEAN_FALSE); |
| 3333 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length, NULL, eANI_BOOLEAN_FALSE); |
| 3334 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length, NULL, eANI_BOOLEAN_FALSE); |
| 3335 | ccmCfgSetInt(pMac, WNI_CFG_WEP_KEY_LENGTH, WepKeyLength, NULL, eANI_BOOLEAN_FALSE); |
| 3336 | ccmCfgSetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId, NULL, eANI_BOOLEAN_FALSE); |
| 3337 | } |
| 3338 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3339 | static void csrSetCfgSsid( tpAniSirGlobal pMac, tSirMacSSid *pSSID ) |
| 3340 | { |
| 3341 | tANI_U32 len = 0; |
| 3342 | if(pSSID->length <= WNI_CFG_SSID_LEN) |
| 3343 | { |
| 3344 | len = pSSID->length; |
| 3345 | } |
| 3346 | ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pSSID->ssId, len, NULL, eANI_BOOLEAN_FALSE); |
| 3347 | } |
| 3348 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3349 | eHalStatus csrSetQosToCfg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrMediaAccessType qosType ) |
| 3350 | { |
| 3351 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3352 | tANI_U32 QoSEnabled; |
| 3353 | tANI_U32 WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3354 | // set the CFG enable/disable variables based on the qosType being configured... |
| 3355 | switch( qosType ) |
| 3356 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3357 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p: |
| 3358 | QoSEnabled = FALSE; |
| 3359 | WmeEnabled = TRUE; |
| 3360 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3361 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP: |
| 3362 | QoSEnabled = FALSE; |
| 3363 | WmeEnabled = TRUE; |
| 3364 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3365 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify: |
| 3366 | QoSEnabled = FALSE; |
| 3367 | WmeEnabled = TRUE; |
| 3368 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3369 | case eCSR_MEDIUM_ACCESS_11e_eDCF: |
| 3370 | QoSEnabled = TRUE; |
| 3371 | WmeEnabled = FALSE; |
| 3372 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3373 | case eCSR_MEDIUM_ACCESS_11e_HCF: |
| 3374 | QoSEnabled = TRUE; |
| 3375 | WmeEnabled = FALSE; |
| 3376 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3377 | default: |
| 3378 | case eCSR_MEDIUM_ACCESS_DCF: |
| 3379 | QoSEnabled = FALSE; |
| 3380 | WmeEnabled = FALSE; |
| 3381 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3382 | } |
| 3383 | //save the WMM setting for later use |
| 3384 | pMac->roam.roamSession[sessionId].fWMMConnection = (tANI_BOOLEAN)WmeEnabled; |
Sandeep Puligilla | aea98a2 | 2013-12-04 13:36:32 +0530 | [diff] [blame] | 3385 | pMac->roam.roamSession[sessionId].fQOSConnection = (tANI_BOOLEAN)QoSEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3386 | return (status); |
| 3387 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3388 | static eHalStatus csrGetRateSet( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc, |
| 3389 | tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet) |
| 3390 | { |
| 3391 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3392 | int i; |
| 3393 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3394 | tANI_U8 *pDstRate; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3395 | vos_mem_set(pOpRateSet, sizeof(tSirMacRateSet), 0); |
| 3396 | vos_mem_set(pExRateSet, sizeof(tSirMacRateSet), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3397 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3398 | |
| 3399 | if( NULL != pIes ) |
| 3400 | { |
| 3401 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3402 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3403 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3404 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3405 | // would blindly put the rates we support into our Operational Rate set |
| 3406 | // (including the basic rates, which we have already verified are |
| 3407 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3408 | // However, it turns out that this is not always the case. Some AP's |
| 3409 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3410 | // too. Now, we're a little more careful: |
| 3411 | pDstRate = pOpRateSet->rate; |
| 3412 | if(pIes->SuppRates.present) |
| 3413 | { |
| 3414 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3415 | { |
| 3416 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) ) |
| 3417 | { |
| 3418 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 3419 | pOpRateSet->numRates++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3420 | } |
| 3421 | } |
| 3422 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3423 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3424 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3425 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3426 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3427 | { |
| 3428 | // If there are Extended Rates in the beacon, we will reflect those |
| 3429 | // extended rates that we support in out Extended Operational Rate |
| 3430 | // set: |
| 3431 | pDstRate = pExRateSet->rate; |
| 3432 | if(pIes->ExtSuppRates.present) |
| 3433 | { |
| 3434 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3435 | { |
| 3436 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) ) |
| 3437 | { |
| 3438 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3439 | pExRateSet->numRates++; |
| 3440 | } |
| 3441 | } |
| 3442 | } |
| 3443 | } |
| 3444 | }//Parsing BSSDesc |
| 3445 | else |
| 3446 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3447 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3448 | } |
| 3449 | if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0) status = eHAL_STATUS_SUCCESS; |
| 3450 | return status; |
| 3451 | } |
| 3452 | |
| 3453 | static void csrSetCfgRateSet( tpAniSirGlobal pMac, eCsrPhyMode phyMode, tCsrRoamProfile *pProfile, |
| 3454 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3455 | { |
| 3456 | int i; |
| 3457 | tANI_U8 *pDstRate; |
| 3458 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3459 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3460 | tANI_U32 OperationalRatesLength = 0; |
| 3461 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3462 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3463 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3464 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3465 | tANI_U32 PropRatesEnable = 0; |
| 3466 | tANI_U8 MCSRateIdxSet[ SIZE_OF_SUPPORTED_MCS_SET ]; |
| 3467 | tANI_U32 MCSRateLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3468 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3469 | if( NULL != pIes ) |
| 3470 | { |
| 3471 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3472 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3473 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3474 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3475 | // would blindly put the rates we support into our Operational Rate set |
| 3476 | // (including the basic rates, which we have already verified are |
| 3477 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3478 | // However, it turns out that this is not always the case. Some AP's |
| 3479 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3480 | // too. Now, we're a little more careful: |
| 3481 | pDstRate = OperationalRates; |
| 3482 | if(pIes->SuppRates.present) |
| 3483 | { |
| 3484 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3485 | { |
| 3486 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) && |
| 3487 | ( OperationalRatesLength < CSR_DOT11_SUPPORTED_RATES_MAX )) |
| 3488 | { |
| 3489 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
| 3490 | OperationalRatesLength++; |
| 3491 | } |
| 3492 | } |
| 3493 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3494 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3495 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3496 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3497 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3498 | { |
| 3499 | // If there are Extended Rates in the beacon, we will reflect those |
| 3500 | // extended rates that we support in out Extended Operational Rate |
| 3501 | // set: |
| 3502 | pDstRate = ExtendedOperationalRates; |
| 3503 | if(pIes->ExtSuppRates.present) |
| 3504 | { |
| 3505 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3506 | { |
| 3507 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) && |
| 3508 | ( ExtendedOperationalRatesLength < CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX )) |
| 3509 | { |
| 3510 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3511 | ExtendedOperationalRatesLength++; |
| 3512 | } |
| 3513 | } |
| 3514 | } |
| 3515 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3516 | // Enable proprietary MAC features if peer node is Airgo node and STA |
| 3517 | // user wants to use them |
| 3518 | if( pIes->Airgo.present && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3519 | { |
| 3520 | PropRatesEnable = 1; |
| 3521 | } |
| 3522 | else |
| 3523 | { |
| 3524 | PropRatesEnable = 0; |
| 3525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3526 | // For ANI network companions, we need to populate the proprietary rate |
| 3527 | // set with any proprietary rates we found in the beacon, only if user |
| 3528 | // allows them... |
| 3529 | if ( PropRatesEnable && pIes->Airgo.PropSuppRates.present && |
| 3530 | ( pIes->Airgo.PropSuppRates.num_rates > 0 )) |
| 3531 | { |
| 3532 | ProprietaryOperationalRatesLength = pIes->Airgo.PropSuppRates.num_rates; |
| 3533 | if ( ProprietaryOperationalRatesLength > sizeof(ProprietaryOperationalRates) ) |
| 3534 | { |
| 3535 | ProprietaryOperationalRatesLength = sizeof (ProprietaryOperationalRates); |
| 3536 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3537 | vos_mem_copy(ProprietaryOperationalRates, |
| 3538 | pIes->Airgo.PropSuppRates.rates, |
| 3539 | ProprietaryOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3540 | } |
| 3541 | else { |
| 3542 | // No proprietary modes... |
| 3543 | ProprietaryOperationalRatesLength = 0; |
| 3544 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3545 | /* Get MCS Rate */ |
| 3546 | pDstRate = MCSRateIdxSet; |
| 3547 | if ( pIes->HTCaps.present ) |
| 3548 | { |
| 3549 | for ( i = 0; i < VALID_MAX_MCS_INDEX; i++ ) |
| 3550 | { |
| 3551 | if ( (unsigned int)pIes->HTCaps.supportedMCSSet[0] & (1 << i) ) |
| 3552 | { |
| 3553 | MCSRateLength++; |
| 3554 | *pDstRate++ = i; |
| 3555 | } |
| 3556 | } |
| 3557 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3558 | // Set the operational rate set CFG variables... |
| 3559 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3560 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3561 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3562 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3563 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3564 | ProprietaryOperationalRates, |
| 3565 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3566 | ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE); |
| 3567 | ccmCfgSetStr(pMac, WNI_CFG_CURRENT_MCS_SET, MCSRateIdxSet, |
| 3568 | MCSRateLength, NULL, eANI_BOOLEAN_FALSE); |
| 3569 | }//Parsing BSSDesc |
| 3570 | else |
| 3571 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3572 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3573 | } |
| 3574 | } |
| 3575 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3576 | static void csrSetCfgRateSetFromProfile( tpAniSirGlobal pMac, |
| 3577 | tCsrRoamProfile *pProfile ) |
| 3578 | { |
| 3579 | tSirMacRateSetIE DefaultSupportedRates11a = { SIR_MAC_RATESET_EID, |
| 3580 | { 8, |
| 3581 | { SIR_MAC_RATE_6, |
| 3582 | SIR_MAC_RATE_9, |
| 3583 | SIR_MAC_RATE_12, |
| 3584 | SIR_MAC_RATE_18, |
| 3585 | SIR_MAC_RATE_24, |
| 3586 | SIR_MAC_RATE_36, |
| 3587 | SIR_MAC_RATE_48, |
| 3588 | SIR_MAC_RATE_54 } } }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3589 | tSirMacRateSetIE DefaultSupportedRates11b = { SIR_MAC_RATESET_EID, |
| 3590 | { 4, |
| 3591 | { SIR_MAC_RATE_1, |
| 3592 | SIR_MAC_RATE_2, |
| 3593 | SIR_MAC_RATE_5_5, |
| 3594 | SIR_MAC_RATE_11 } } }; |
| 3595 | |
| 3596 | |
| 3597 | tSirMacPropRateSet DefaultSupportedPropRates = { 3, |
| 3598 | { SIR_MAC_RATE_72, |
| 3599 | SIR_MAC_RATE_96, |
| 3600 | SIR_MAC_RATE_108 } }; |
| 3601 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3602 | eCsrBand eBand; |
| 3603 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3604 | tANI_U32 OperationalRatesLength = 0; |
| 3605 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3606 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3607 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3608 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3609 | tANI_U32 PropRatesEnable = 0; |
| 3610 | tANI_U8 operationChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3611 | if(pProfile->ChannelInfo.ChannelList) |
| 3612 | { |
| 3613 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 3614 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3615 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3616 | // For 11a networks, the 11a rates go into the Operational Rate set. For 11b and 11g |
| 3617 | // networks, the 11b rates appear in the Operational Rate set. In either case, |
| 3618 | // we can blindly put the rates we support into our Operational Rate set |
| 3619 | // (including the basic rates, which we have already verified are supported |
| 3620 | // earlier in the roaming decision). |
| 3621 | if ( eCSR_BAND_5G == eBand ) |
| 3622 | { |
| 3623 | // 11a rates into the Operational Rate Set. |
| 3624 | OperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3625 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3626 | vos_mem_copy(OperationalRates, |
| 3627 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3628 | OperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3629 | |
| 3630 | // Nothing in the Extended rate set. |
| 3631 | ExtendedOperationalRatesLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3632 | // populate proprietary rates if user allows them |
| 3633 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3634 | { |
| 3635 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3636 | sizeof(*DefaultSupportedPropRates.propRate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3637 | vos_mem_copy(ProprietaryOperationalRates, |
| 3638 | DefaultSupportedPropRates.propRate, |
| 3639 | ProprietaryOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3640 | } |
| 3641 | else |
| 3642 | { |
| 3643 | // No proprietary modes |
| 3644 | ProprietaryOperationalRatesLength = 0; |
| 3645 | } |
| 3646 | } |
| 3647 | else if ( eCSR_CFG_DOT11_MODE_11B == cfgDot11Mode ) |
| 3648 | { |
| 3649 | // 11b rates into the Operational Rate Set. |
| 3650 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3651 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3652 | vos_mem_copy(OperationalRates, |
| 3653 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3654 | OperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3655 | // Nothing in the Extended rate set. |
| 3656 | ExtendedOperationalRatesLength = 0; |
| 3657 | // No proprietary modes |
| 3658 | ProprietaryOperationalRatesLength = 0; |
| 3659 | } |
| 3660 | else |
| 3661 | { |
| 3662 | // 11G |
| 3663 | |
| 3664 | // 11b rates into the Operational Rate Set. |
| 3665 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3666 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3667 | vos_mem_copy(OperationalRates, |
| 3668 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3669 | OperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3670 | |
| 3671 | // 11a rates go in the Extended rate set. |
| 3672 | ExtendedOperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3673 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3674 | vos_mem_copy(ExtendedOperationalRates, |
| 3675 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3676 | ExtendedOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3677 | |
| 3678 | // populate proprietary rates if user allows them |
| 3679 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3680 | { |
| 3681 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3682 | sizeof(*DefaultSupportedPropRates.propRate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3683 | vos_mem_copy(ProprietaryOperationalRates, |
| 3684 | DefaultSupportedPropRates.propRate, |
| 3685 | ProprietaryOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3686 | } |
| 3687 | else |
| 3688 | { |
| 3689 | // No proprietary modes |
| 3690 | ProprietaryOperationalRatesLength = 0; |
| 3691 | } |
| 3692 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3693 | // set this to 1 if prop. rates need to be advertised in to the IBSS beacon and user wants to use them |
| 3694 | if ( ProprietaryOperationalRatesLength && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3695 | { |
| 3696 | PropRatesEnable = 1; |
| 3697 | } |
| 3698 | else |
| 3699 | { |
| 3700 | PropRatesEnable = 0; |
| 3701 | } |
| 3702 | |
| 3703 | // Set the operational rate set CFG variables... |
| 3704 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3705 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3706 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3707 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3708 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3709 | ProprietaryOperationalRates, |
| 3710 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3711 | 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] | 3712 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3713 | void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result) |
| 3714 | { |
| 3715 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3716 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3717 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 3718 | tANI_U32 sessionId; |
| 3719 | tSmeCmd *pCommand = NULL; |
| 3720 | |
| 3721 | if(NULL == pEntry) |
| 3722 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3723 | smsLog(pMac, LOGW, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3724 | return; |
| 3725 | } |
| 3726 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 3727 | sessionId = pCommand->sessionId; |
| 3728 | |
| 3729 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 3730 | { |
| 3731 | csrRoamingStateConfigCnfProcessor(pMac, (tANI_U32)result); |
| 3732 | } |
| 3733 | } |
| 3734 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3735 | //This function is very dump. It is here because PE still need WNI_CFG_PHY_MODE |
| 3736 | tANI_U32 csrRoamGetPhyModeFromDot11Mode(eCsrCfgDot11Mode dot11Mode, eCsrBand band) |
| 3737 | { |
| 3738 | if(eCSR_CFG_DOT11_MODE_11B == dot11Mode) |
| 3739 | { |
| 3740 | return (WNI_CFG_PHY_MODE_11B); |
| 3741 | } |
| 3742 | else |
| 3743 | { |
| 3744 | if(eCSR_BAND_24 == band) |
| 3745 | return (WNI_CFG_PHY_MODE_11G); |
| 3746 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3747 | return (WNI_CFG_PHY_MODE_11A); |
| 3748 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3749 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3750 | |
| 3751 | #ifdef WLAN_FEATURE_11AC |
| 3752 | ePhyChanBondState csrGetHTCBStateFromVHTCBState(ePhyChanBondState aniCBMode) |
| 3753 | { |
| 3754 | switch ( aniCBMode ) |
| 3755 | { |
| 3756 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 3757 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 3758 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 3759 | return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 3760 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 3761 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 3762 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 3763 | return PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 3764 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3765 | default : |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3766 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 3767 | } |
| 3768 | } |
| 3769 | #endif |
| 3770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3771 | //pIes may be NULL |
| 3772 | eHalStatus csrRoamSetBssConfigCfg(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3773 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3774 | tDot11fBeaconIEs *pIes, tANI_BOOLEAN resetCountry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3775 | { |
| 3776 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3777 | tANI_U32 cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3778 | tANI_U8 channel = 0; |
| 3779 | //Make sure we have the domain info for the BSS we try to connect to. |
| 3780 | //Do we need to worry about sequence for OSs that are not Windows?? |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3781 | if (pBssDesc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3782 | { |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3783 | if (csrLearnCountryInformation(pMac, pBssDesc, pIes, eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3784 | { |
| 3785 | //Make sure the 11d info from this BSSDesc can be applied |
| 3786 | pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3787 | if (VOS_TRUE == resetCountry) |
| 3788 | { |
| 3789 | csrApplyCountryInformation(pMac, FALSE); |
| 3790 | } |
| 3791 | else |
| 3792 | { |
| 3793 | csrApplyCountryInformation(pMac, TRUE); |
| 3794 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3795 | } |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3796 | if ((csrIs11dSupported (pMac)) && pIes) |
| 3797 | { |
| 3798 | if (!pIes->Country.present) |
Tushnim Bhattacharyya | c3c1e8e | 2013-10-29 17:27:43 -0700 | [diff] [blame] | 3799 | { |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3800 | csrResetCountryInformation(pMac, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE ); |
Tushnim Bhattacharyya | c3c1e8e | 2013-10-29 17:27:43 -0700 | [diff] [blame] | 3801 | } |
| 3802 | else |
| 3803 | { |
| 3804 | //Let's also update the below to make sure we don't update CC while |
| 3805 | //connected to an AP which is advertising some CC |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 3806 | vos_mem_copy(pMac->scan.currentCountryBssid, |
Tushnim Bhattacharyya | c3c1e8e | 2013-10-29 17:27:43 -0700 | [diff] [blame] | 3807 | pBssDesc->bssId, sizeof(tSirMacAddr)); |
| 3808 | } |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3809 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3810 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3811 | //Qos |
| 3812 | csrSetQosToCfg( pMac, sessionId, pBssConfig->qosType ); |
| 3813 | //SSID |
| 3814 | csrSetCfgSsid(pMac, &pBssConfig->SSID ); |
| 3815 | //fragment threshold |
| 3816 | //ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3817 | //RTS threshold |
| 3818 | //ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3819 | |
| 3820 | //ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, csrTranslateToWNICfgDot11Mode(pMac, pBssConfig->uCfgDot11Mode), NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3821 | //Auth type |
| 3822 | ccmCfgSetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType, NULL, eANI_BOOLEAN_FALSE); |
| 3823 | //encryption type |
| 3824 | csrSetCfgPrivacy(pMac, pProfile, (tANI_BOOLEAN)pBssConfig->BssCap.privacy ); |
| 3825 | //short slot time |
| 3826 | 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] | 3827 | //11d |
| 3828 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 3829 | ((pBssConfig->f11hSupport) ? pBssConfig->f11hSupport : pProfile->ieee80211d), |
| 3830 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3831 | /*//11h |
| 3832 | ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3833 | */ |
| 3834 | ccmCfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, pBssConfig->uPowerLimit, NULL, eANI_BOOLEAN_FALSE); |
| 3835 | //CB |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3836 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 3837 | if(CSR_IS_INFRA_AP(pProfile) || CSR_IS_WDS_AP(pProfile) || CSR_IS_IBSS(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3838 | { |
| 3839 | channel = pProfile->operationChannel; |
| 3840 | } |
| 3841 | else |
| 3842 | { |
| 3843 | if(pBssDesc) |
| 3844 | { |
| 3845 | channel = pBssDesc->channelId; |
| 3846 | } |
| 3847 | } |
| 3848 | if(0 != channel) |
| 3849 | { |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3850 | if(CSR_IS_CHANNEL_24GHZ(channel) && |
| 3851 | !pMac->roam.configParam.channelBondingMode24GHz && |
| 3852 | !WDA_getFwWlanFeatCaps(HT40_OBSS_SCAN)) |
| 3853 | {//On 2.4 Ghz, CB will be disabled if it is not configured through .ini |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3854 | cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3855 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: " |
| 3856 | " cbMode disabled cfgCb = %d channelBondingMode24GHz %d", |
| 3857 | __func__, cfgCb, pMac->roam.configParam.channelBondingMode24GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3858 | } |
| 3859 | else |
| 3860 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3861 | cfgCb = pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3862 | } |
| 3863 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3864 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | a0d8893 | 2012-11-13 10:51:26 -0800 | [diff] [blame] | 3865 | // cbMode = 1 in cfg.ini is mapped to PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 3866 | // in function csrConvertCBIniValueToPhyCBState() |
| 3867 | // So, max value for cbMode in 40MHz mode is 3 (MAC\src\include\sirParams.h) |
| 3868 | if(cfgCb > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3869 | { |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3870 | if(!WDA_getFwWlanFeatCaps(DOT11AC)) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3871 | cfgCb = csrGetHTCBStateFromVHTCBState(cfgCb); |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3872 | } |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3873 | else |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3874 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3875 | 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] | 3876 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3877 | } |
| 3878 | else |
| 3879 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3880 | ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, cfgCb, NULL, eANI_BOOLEAN_FALSE); |
| 3881 | //Rate |
| 3882 | //Fixed Rate |
| 3883 | if(pBssDesc) |
| 3884 | { |
| 3885 | csrSetCfgRateSet(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile, pBssDesc, pIes); |
| 3886 | } |
| 3887 | else |
| 3888 | { |
| 3889 | csrSetCfgRateSetFromProfile(pMac, pProfile); |
| 3890 | } |
| 3891 | //Make this the last CFG to set. The callback will trigger a join_req |
| 3892 | //Join time out |
| 3893 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId ); |
| 3894 | |
| 3895 | 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] | 3896 | return (status); |
| 3897 | } |
| 3898 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3899 | eHalStatus csrRoamStopNetwork( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3900 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3901 | { |
| 3902 | eHalStatus status; |
| 3903 | tBssConfigParam *pBssConfig; |
| 3904 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3905 | |
| 3906 | if(!pSession) |
| 3907 | { |
| 3908 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3909 | return eHAL_STATUS_FAILURE; |
| 3910 | } |
| 3911 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3912 | pBssConfig = vos_mem_malloc(sizeof(tBssConfigParam)); |
| 3913 | if ( NULL == pBssConfig ) |
| 3914 | status = eHAL_STATUS_FAILURE; |
| 3915 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3916 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3917 | vos_mem_set(pBssConfig, sizeof(tBssConfigParam), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3918 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, pBssConfig, pIes); |
| 3919 | if(HAL_STATUS_SUCCESS(status)) |
| 3920 | { |
| 3921 | pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3922 | /* This will allow to pass cbMode during join req */ |
| 3923 | pSession->bssParams.cbMode= pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3924 | //For IBSS, we need to prepare some more information |
| 3925 | if( csrIsBssTypeIBSS(pProfile->BSSType) || CSR_IS_WDS( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3926 | || CSR_IS_INFRA_AP(pProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3927 | ) |
| 3928 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3929 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3930 | } |
| 3931 | // If we are in an IBSS, then stop the IBSS... |
| 3932 | ////Not worry about WDS connection for now |
| 3933 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 3934 | { |
| 3935 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 3936 | } |
| 3937 | else |
| 3938 | { |
| 3939 | // if we are in an Infrastructure association.... |
| 3940 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 3941 | { |
| 3942 | // and the new Bss is an Ibss OR we are roaming from Infra to Infra |
| 3943 | // across SSIDs (roaming to a new SSID)... // |
| 3944 | //Not worry about WDS connection for now |
| 3945 | if ( pBssDesc && ( ( csrIsIbssBssDesc( pBssDesc ) ) || |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3946 | !csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIes ) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3947 | { |
| 3948 | // then we need to disassociate from the Infrastructure network... |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3949 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 3950 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3951 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3952 | else |
| 3953 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3954 | // In an Infrastucture and going to an Infrastructure network with the same SSID. This |
| 3955 | // calls for a Reassociation sequence. So issue the CFG sets for this new AP. |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3956 | if ( pBssDesc ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3957 | { |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3958 | // Set parameters for this Bss. |
| 3959 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 3960 | pBssDesc, pBssConfig, |
| 3961 | pIes, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3962 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3963 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3964 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3965 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3966 | { |
| 3967 | // Neiher in IBSS nor in Infra. We can go ahead and set the CFG for tne new network... |
| 3968 | // Nothing to stop. |
| 3969 | if ( pBssDesc || CSR_IS_WDS_AP( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3970 | || CSR_IS_INFRA_AP(pProfile) |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3971 | ) |
| 3972 | { |
| 3973 | tANI_BOOLEAN is11rRoamingFlag = eANI_BOOLEAN_FALSE; |
| 3974 | is11rRoamingFlag = csrRoamIs11rAssoc(pMac); |
| 3975 | // Set parameters for this Bss. |
| 3976 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 3977 | pBssDesc, pBssConfig, |
| 3978 | pIes, is11rRoamingFlag); |
| 3979 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3980 | } |
| 3981 | } |
| 3982 | }//Success getting BSS config info |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3983 | vos_mem_free(pBssConfig); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3984 | }//Allocate memory |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3985 | return (status); |
| 3986 | } |
| 3987 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3988 | eCsrJoinState csrRoamJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3989 | tCsrScanResultInfo *pScanResult, tCsrRoamProfile *pProfile ) |
| 3990 | { |
| 3991 | eCsrJoinState eRoamState = eCsrContinueRoaming; |
| 3992 | eHalStatus status; |
| 3993 | tSirBssDescription *pBssDesc = &pScanResult->BssDescriptor; |
| 3994 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)( pScanResult->pvIes ); //This may be NULL |
| 3995 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3996 | |
| 3997 | if(!pSession) |
| 3998 | { |
| 3999 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4000 | return (eCsrStopRoaming); |
| 4001 | } |
| 4002 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4003 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 4004 | { |
| 4005 | status = csrRoamStartWds( pMac, sessionId, pProfile, pBssDesc ); |
| 4006 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 4007 | { |
| 4008 | eRoamState = eCsrStopRoaming; |
| 4009 | } |
| 4010 | } |
| 4011 | else |
| 4012 | { |
| 4013 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 4014 | { |
| 4015 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
| 4016 | return (eCsrStopRoaming); |
| 4017 | } |
| 4018 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 4019 | { |
| 4020 | // If we are connected in infrastructure mode and the Join Bss description is for the same BssID, then we are |
| 4021 | // attempting to join the AP we are already connected with. In that case, see if the Bss or Sta capabilities |
| 4022 | // have changed and handle the changes (without disturbing the current association). |
| 4023 | |
| 4024 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && |
| 4025 | csrIsBssIdEqual( pMac, pBssDesc, pSession->pConnectBssDesc ) && |
| 4026 | csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIesLocal ) |
| 4027 | ) |
| 4028 | { |
| 4029 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 4030 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 4031 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 4032 | // a new Association. |
| 4033 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 4034 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 4035 | smsLog(pMac, LOGW, FL(" detect same profile")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4036 | if(csrRoamIsSameProfileKeys(pMac, &pSession->connectedProfile, pProfile)) |
| 4037 | { |
| 4038 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 4039 | } |
| 4040 | else |
| 4041 | { |
| 4042 | tBssConfigParam bssConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4043 | //The key changes |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4044 | vos_mem_set(&bssConfig, sizeof(bssConfig), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4045 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 4046 | if(HAL_STATUS_SUCCESS(status)) |
| 4047 | { |
| 4048 | pSession->bssParams.uCfgDot11Mode = bssConfig.uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4049 | pSession->bssParams.cbMode = bssConfig.cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4050 | //Reapply the config including Keys so reassoc is happening. |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4051 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 4052 | pBssDesc, &bssConfig, |
| 4053 | pIesLocal, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4054 | if(!HAL_STATUS_SUCCESS(status)) |
| 4055 | { |
| 4056 | eRoamState = eCsrStopRoaming; |
| 4057 | } |
| 4058 | } |
| 4059 | else |
| 4060 | { |
| 4061 | eRoamState = eCsrStopRoaming; |
| 4062 | } |
| 4063 | }//same profile |
| 4064 | } |
| 4065 | else |
| 4066 | { |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4067 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, sessionId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4068 | eCSR_ROAM_SUBSTATE_DISASSOC_REQ, FALSE ))) |
| 4069 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 4070 | smsLog(pMac, LOGE, FL(" fail to issue disassociate with Session ID %d"), |
| 4071 | sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4072 | eRoamState = eCsrStopRoaming; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4073 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4074 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4075 | } |
| 4076 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4077 | { |
| 4078 | // note: we used to pre-auth here with open authentication networks but that was not working so well. |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4079 | // we had a lot of join timeouts when testing at Samsung. removing this step helped associations |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4080 | // work much better. |
| 4081 | // |
| 4082 | // |
| 4083 | // stop the existing network before attempting to join the new network... |
| 4084 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 4085 | { |
| 4086 | eRoamState = eCsrStopRoaming; |
| 4087 | } |
| 4088 | } |
| 4089 | }//Infra |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4090 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4091 | { |
| 4092 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 4093 | { |
| 4094 | eRoamState = eCsrStopRoaming; |
| 4095 | } |
| 4096 | } |
| 4097 | if( pIesLocal && !pScanResult->pvIes ) |
| 4098 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4099 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4100 | } |
| 4101 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4102 | return( eRoamState ); |
| 4103 | } |
| 4104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4105 | eHalStatus csrRoamShouldRoam(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 4106 | tSirBssDescription *pBssDesc, tANI_U32 roamId) |
| 4107 | { |
| 4108 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4109 | tCsrRoamInfo roamInfo; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4110 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4111 | roamInfo.pBssDesc = pBssDesc; |
| 4112 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, roamId, eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE); |
| 4113 | return (status); |
| 4114 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4115 | //In case no matching BSS is found, use whatever default we can find |
| 4116 | static void csrRoamAssignDefaultParam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4117 | { |
| 4118 | //Need to get all negotiated types in place first |
| 4119 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 4120 | 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] | 4121 | { |
| 4122 | default: |
| 4123 | case eCSR_AUTH_TYPE_WPA: |
| 4124 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 4125 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 4126 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 4127 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4128 | break; |
| 4129 | |
| 4130 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 4131 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 4132 | break; |
| 4133 | |
| 4134 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 4135 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 4136 | break; |
| 4137 | } |
| 4138 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 4139 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 4140 | //In this case, the multicast encryption needs to follow the uncast ones. |
| 4141 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 4142 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 4143 | } |
| 4144 | |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4145 | |
| 4146 | static void csrSetAbortRoamingCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4147 | { |
| 4148 | switch(pCommand->u.roamCmd.roamReason) |
| 4149 | { |
| 4150 | case eCsrLostLink1: |
| 4151 | pCommand->u.roamCmd.roamReason = eCsrLostLink1Abort; |
| 4152 | break; |
| 4153 | case eCsrLostLink2: |
| 4154 | pCommand->u.roamCmd.roamReason = eCsrLostLink2Abort; |
| 4155 | break; |
| 4156 | case eCsrLostLink3: |
| 4157 | pCommand->u.roamCmd.roamReason = eCsrLostLink3Abort; |
| 4158 | break; |
| 4159 | default: |
| 4160 | smsLog(pMac, LOGE, FL(" aborting roaming reason %d not recognized"), |
| 4161 | pCommand->u.roamCmd.roamReason); |
| 4162 | break; |
| 4163 | } |
| 4164 | } |
| 4165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4166 | static eCsrJoinState csrRoamJoinNextBss( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fUseSameBss ) |
| 4167 | { |
| 4168 | eHalStatus status; |
| 4169 | tCsrScanResult *pScanResult = NULL; |
| 4170 | eCsrJoinState eRoamState = eCsrStopRoaming; |
| 4171 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 4172 | tANI_BOOLEAN fDone = eANI_BOOLEAN_FALSE; |
| 4173 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 4174 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4175 | v_U8_t acm_mask = 0; |
| 4176 | #endif |
| 4177 | tANI_U32 sessionId = pCommand->sessionId; |
| 4178 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4179 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4180 | tANI_U8 concurrentChannel = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4181 | |
| 4182 | if(!pSession) |
| 4183 | { |
| 4184 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4185 | return (eCsrStopRoaming); |
| 4186 | } |
| 4187 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4188 | do |
| 4189 | { |
| 4190 | // Check for Cardbus eject condition, before trying to Roam to any BSS |
| 4191 | //***if( !balIsCardPresent(pAdapter) ) break; |
| 4192 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4193 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 4194 | memcpy (&roamInfo.bssid, &pSession->joinFailStatusCode.bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4195 | if(NULL != pBSSList) |
| 4196 | { |
| 4197 | // When handling AP's capability change, continue to associate to |
| 4198 | // same BSS and make sure pRoamBssEntry is not Null. |
| 4199 | if((eANI_BOOLEAN_FALSE == fUseSameBss) || (pCommand->u.roamCmd.pRoamBssEntry == NULL)) |
| 4200 | { |
| 4201 | if(pCommand->u.roamCmd.pRoamBssEntry == NULL) |
| 4202 | { |
| 4203 | //Try the first BSS |
| 4204 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4205 | pCommand->u.roamCmd.pRoamBssEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 4206 | } |
| 4207 | else |
| 4208 | { |
| 4209 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 4210 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 4211 | { |
| 4212 | //Done with all the BSSs |
| 4213 | //In this case, will tell HDD the completion |
| 4214 | break; |
| 4215 | } |
| 4216 | else |
| 4217 | { |
| 4218 | //We need to indicate to HDD that we are done with this one. |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4219 | //vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4220 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; //this shall not be NULL |
| 4221 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4222 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4223 | pRoamInfo = &roamInfo; |
| 4224 | } |
| 4225 | } |
| 4226 | while(pCommand->u.roamCmd.pRoamBssEntry) |
| 4227 | { |
| 4228 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4229 | /*If concurrency enabled take the concurrent connected channel first. */ |
| 4230 | /* Valid multichannel concurrent sessions exempted */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4231 | if (vos_concurrent_sessions_running() && |
| 4232 | !csrIsValidMcConcurrentSession(pMac, sessionId, &pScanResult->Result.BssDescriptor)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4233 | { |
| 4234 | concurrentChannel = |
| 4235 | csrGetConcurrentOperationChannel(pMac); |
| 4236 | 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] | 4237 | " csr Concurrent Channel = %d", __func__, concurrentChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4238 | if ((concurrentChannel) && |
| 4239 | (concurrentChannel == |
| 4240 | pScanResult->Result.BssDescriptor.channelId)) |
| 4241 | { |
| 4242 | //make this 0 because we do not want the |
| 4243 | //below check to pass as we don't want to |
| 4244 | //connect on other channel |
| 4245 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 4246 | FL("Concurrent channel match =%d"), |
| 4247 | concurrentChannel); |
| 4248 | concurrentChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4249 | } |
| 4250 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4251 | |
| 4252 | if (!concurrentChannel) |
| 4253 | { |
| 4254 | |
| 4255 | if(HAL_STATUS_SUCCESS(csrRoamShouldRoam(pMac, |
| 4256 | sessionId, &pScanResult->Result.BssDescriptor, |
| 4257 | pCommand->u.roamCmd.roamId))) |
| 4258 | { |
| 4259 | //Ok to roam this |
| 4260 | break; |
| 4261 | } |
| 4262 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4263 | else |
| 4264 | { |
| 4265 | eRoamState = eCsrStopRoamingDueToConcurrency; |
| 4266 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4267 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 4268 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 4269 | { |
| 4270 | //Done with all the BSSs |
| 4271 | fDone = eANI_BOOLEAN_TRUE; |
| 4272 | break; |
| 4273 | } |
| 4274 | } |
| 4275 | if(fDone) |
| 4276 | { |
| 4277 | break; |
| 4278 | } |
| 4279 | } |
| 4280 | } |
| 4281 | //We have something to roam, tell HDD when it is infra. |
| 4282 | //For IBSS, the indication goes back to HDD via eCSR_ROAM_IBSS_IND |
| 4283 | //For WDS, the indication is eCSR_ROAM_WDS_IND |
| 4284 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 4285 | { |
| 4286 | if(pRoamInfo) |
| 4287 | { |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4288 | if(pSession->bRefAssocStartCnt) |
| 4289 | { |
| 4290 | pSession->bRefAssocStartCnt--; |
| 4291 | //Complete the last association attemp because a new one is about to be tried |
| 4292 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4293 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4294 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4295 | } |
| 4296 | } |
| 4297 | /* If the roaming has stopped, not to continue the roaming command*/ |
| 4298 | if ( !CSR_IS_ROAMING(pSession) && CSR_IS_ROAMING_COMMAND(pCommand) ) |
| 4299 | { |
| 4300 | //No need to complete roaming here as it already completes |
| 4301 | smsLog(pMac, LOGW, FL(" Roam command (reason %d) aborted due to roaming completed"), |
| 4302 | pCommand->u.roamCmd.roamReason); |
| 4303 | eRoamState = eCsrStopRoaming; |
| 4304 | csrSetAbortRoamingCommand(pMac, pCommand); |
| 4305 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4306 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4307 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4308 | if(pScanResult) |
| 4309 | { |
| 4310 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4311 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->Result.BssDescriptor, &pIesLocal))) ) |
| 4312 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4313 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4314 | fDone = eANI_BOOLEAN_TRUE; |
| 4315 | eRoamState = eCsrStopRoaming; |
| 4316 | break; |
| 4317 | } |
| 4318 | roamInfo.pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4319 | pCommand->u.roamCmd.pLastRoamBss = roamInfo.pBssDesc; |
| 4320 | //No need to put uapsd_mask in if the BSS doesn't support uAPSD |
| 4321 | if( pCommand->u.roamCmd.roamProfile.uapsd_mask && |
| 4322 | CSR_IS_QOS_BSS(pIesLocal) && |
| 4323 | CSR_IS_UAPSD_BSS(pIesLocal) ) |
| 4324 | { |
| 4325 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4326 | acm_mask = sme_QosGetACMMask(pMac, &pScanResult->Result.BssDescriptor, |
| 4327 | pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4328 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4329 | } |
| 4330 | else |
| 4331 | { |
| 4332 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 4333 | } |
| 4334 | if( pIesLocal && !pScanResult->Result.pvIes) |
| 4335 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4336 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4337 | } |
| 4338 | } |
| 4339 | else |
| 4340 | { |
| 4341 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 4342 | } |
| 4343 | roamInfo.pProfile = pProfile; |
| 4344 | pSession->bRefAssocStartCnt++; |
| 4345 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4346 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4347 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4348 | if ( NULL == pCommand->u.roamCmd.pRoamBssEntry ) |
| 4349 | { |
| 4350 | // If this is a start IBSS profile, then we need to start the IBSS. |
| 4351 | if ( CSR_IS_START_IBSS(pProfile) ) |
| 4352 | { |
| 4353 | tANI_BOOLEAN fSameIbss = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4354 | // Attempt to start this IBSS... |
| 4355 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 4356 | status = csrRoamStartIbss( pMac, sessionId, pProfile, &fSameIbss ); |
| 4357 | if(HAL_STATUS_SUCCESS(status)) |
| 4358 | { |
| 4359 | if ( fSameIbss ) |
| 4360 | { |
| 4361 | eRoamState = eCsrStartIbssSameIbss; |
| 4362 | } |
| 4363 | else |
| 4364 | { |
| 4365 | eRoamState = eCsrContinueRoaming; |
| 4366 | } |
| 4367 | } |
| 4368 | else |
| 4369 | { |
| 4370 | //it somehow fail need to stop |
| 4371 | eRoamState = eCsrStopRoaming; |
| 4372 | } |
| 4373 | break; |
| 4374 | } |
| 4375 | else if ( (CSR_IS_WDS_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4376 | || (CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4377 | ) |
| 4378 | { |
| 4379 | // Attempt to start this WDS... |
| 4380 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 4381 | /* For AP WDS, we dont have any BSSDescription */ |
| 4382 | status = csrRoamStartWds( pMac, sessionId, pProfile, NULL ); |
| 4383 | if(HAL_STATUS_SUCCESS(status)) |
| 4384 | { |
| 4385 | eRoamState = eCsrContinueRoaming; |
| 4386 | } |
| 4387 | else |
| 4388 | { |
| 4389 | //it somehow fail need to stop |
| 4390 | eRoamState = eCsrStopRoaming; |
| 4391 | } |
| 4392 | } |
| 4393 | else |
| 4394 | { |
| 4395 | //Nothing we can do |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4396 | smsLog(pMac, LOGW, FL("cannot continue without BSS list")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4397 | eRoamState = eCsrStopRoaming; |
| 4398 | break; |
| 4399 | } |
| 4400 | } |
| 4401 | else //We have BSS |
| 4402 | { |
| 4403 | //Need to assign these value because they are used in csrIsSameProfile |
| 4404 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4405 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = pScanResult->ucEncryptionType; //Negotiated while building scan result. |
| 4406 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = pScanResult->mcEncryptionType; |
| 4407 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = pScanResult->authType; |
| 4408 | if ( CSR_IS_START_IBSS(&pCommand->u.roamCmd.roamProfile) ) |
| 4409 | { |
| 4410 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 4411 | { |
| 4412 | eRoamState = eCsrStartIbssSameIbss; |
| 4413 | break; |
| 4414 | } |
| 4415 | } |
| 4416 | if( pCommand->u.roamCmd.fReassocToSelfNoCapChange ) |
| 4417 | { |
| 4418 | //trying to connect to the one already connected |
| 4419 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_FALSE; |
| 4420 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 4421 | break; |
| 4422 | } |
| 4423 | // Attempt to Join this Bss... |
| 4424 | eRoamState = csrRoamJoin( pMac, sessionId, &pScanResult->Result, pProfile ); |
| 4425 | break; |
| 4426 | } |
| 4427 | |
| 4428 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4429 | if( (eCsrStopRoaming == eRoamState) && (CSR_IS_INFRASTRUCTURE( pProfile )) ) |
| 4430 | { |
| 4431 | //Need to indicate association_completion if association_start has been done |
| 4432 | if(pSession->bRefAssocStartCnt > 0) |
| 4433 | { |
| 4434 | pSession->bRefAssocStartCnt--; |
| 4435 | //Complete the last association attemp because a new one is about to be tried |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 4436 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4437 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4438 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 4439 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 4440 | } |
| 4441 | } |
| 4442 | |
| 4443 | return( eRoamState ); |
| 4444 | } |
| 4445 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4446 | static eHalStatus csrRoam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4447 | { |
| 4448 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4449 | eCsrJoinState RoamState; |
| 4450 | tANI_U32 sessionId = pCommand->sessionId; |
| 4451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4452 | //***if( hddIsRadioStateOn( pAdapter ) ) |
| 4453 | { |
| 4454 | // Attept to join a Bss... |
| 4455 | RoamState = csrRoamJoinNextBss( pMac, pCommand, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4456 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4457 | // if nothing to join.. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4458 | if (( eCsrStopRoaming == RoamState ) || ( eCsrStopRoamingDueToConcurrency == RoamState)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4459 | { |
| 4460 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4461 | // and if connected in Infrastructure mode... |
| 4462 | if ( csrIsConnStateInfra(pMac, sessionId) ) |
| 4463 | { |
| 4464 | //... then we need to issue a disassociation |
| 4465 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, FALSE ); |
| 4466 | if(!HAL_STATUS_SUCCESS(status)) |
| 4467 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4468 | smsLog(pMac, LOGW, FL(" failed to issue disassociate, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4469 | //roam command is completed by caller in the failed case |
| 4470 | fComplete = eANI_BOOLEAN_TRUE; |
| 4471 | } |
| 4472 | } |
| 4473 | else if( csrIsConnStateIbss(pMac, sessionId) ) |
| 4474 | { |
| 4475 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4476 | if(!HAL_STATUS_SUCCESS(status)) |
| 4477 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4478 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4479 | //roam command is completed by caller in the failed case |
| 4480 | fComplete = eANI_BOOLEAN_TRUE; |
| 4481 | } |
| 4482 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4483 | else if (csrIsConnStateConnectedInfraAp(pMac, sessionId)) |
| 4484 | { |
| 4485 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4486 | if(!HAL_STATUS_SUCCESS(status)) |
| 4487 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4488 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4489 | //roam command is completed by caller in the failed case |
| 4490 | fComplete = eANI_BOOLEAN_TRUE; |
| 4491 | } |
| 4492 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4493 | else |
| 4494 | { |
| 4495 | fComplete = eANI_BOOLEAN_TRUE; |
| 4496 | } |
| 4497 | if(fComplete) |
| 4498 | { |
| 4499 | // ... otherwise, we can complete the Roam command here. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4500 | if(eCsrStopRoamingDueToConcurrency == RoamState) |
| 4501 | { |
| 4502 | csrRoamComplete( pMac, eCsrJoinFailureDueToConcurrency, NULL ); |
| 4503 | } |
| 4504 | else |
| 4505 | { |
| 4506 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 4507 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4508 | } |
| 4509 | } |
| 4510 | else if ( eCsrReassocToSelfNoCapChange == RoamState ) |
| 4511 | { |
| 4512 | csrRoamComplete( pMac, eCsrSilentlyStopRoamingSaveState, NULL ); |
| 4513 | } |
| 4514 | else if ( eCsrStartIbssSameIbss == RoamState ) |
| 4515 | { |
| 4516 | csrRoamComplete( pMac, eCsrSilentlyStopRoaming, NULL ); |
| 4517 | } |
| 4518 | }//hddIsRadioStateOn |
| 4519 | |
| 4520 | return status; |
| 4521 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4522 | eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4523 | { |
| 4524 | tANI_U32 sessionId; |
| 4525 | tCsrRoamSession *pSession; |
| 4526 | tCsrScanResult *pScanResult = NULL; |
| 4527 | tSirBssDescription *pBssDesc = NULL; |
| 4528 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4529 | sessionId = pCommand->sessionId; |
| 4530 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4531 | |
| 4532 | if(!pSession) |
| 4533 | { |
| 4534 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4535 | return eHAL_STATUS_FAILURE; |
| 4536 | } |
| 4537 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4538 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 4539 | { |
| 4540 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4541 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4542 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4543 | return eHAL_STATUS_FAILURE; |
| 4544 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4545 | if (pCommand->u.roamCmd.pRoamBssEntry) |
| 4546 | { |
| 4547 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4548 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4549 | } |
| 4550 | else |
| 4551 | { |
| 4552 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4553 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4554 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4555 | return eHAL_STATUS_FAILURE; |
| 4556 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4557 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 4558 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 4559 | return status; |
| 4560 | } |
| 4561 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4562 | eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4563 | { |
| 4564 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4565 | tCsrRoamInfo roamInfo; |
| 4566 | tANI_U32 sessionId = pCommand->sessionId; |
| 4567 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4568 | |
| 4569 | if(!pSession) |
| 4570 | { |
| 4571 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4572 | return eHAL_STATUS_FAILURE; |
| 4573 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4574 | |
| 4575 | switch ( pCommand->u.roamCmd.roamReason ) |
| 4576 | { |
| 4577 | case eCsrForcedDisassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4578 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4579 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4580 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4581 | case eCsrSmeIssuedDisassocForHandoff: |
| 4582 | //Not to free pMac->roam.pCurRoamProfile (via csrFreeRoamProfile) because it is needed after disconnect |
| 4583 | #if 0 // TODO : Confirm this change |
| 4584 | status = csrRoamProcessDisassociate( pMac, pCommand, FALSE ); |
| 4585 | #else |
| 4586 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 4587 | #endif |
| 4588 | |
| 4589 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4590 | case eCsrForcedDisassocMICFailure: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4591 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, TRUE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4592 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4593 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4594 | case eCsrForcedDeauth: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4595 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, FALSE, FALSE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4596 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4597 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4598 | case eCsrHddIssuedReassocToSameAP: |
| 4599 | case eCsrSmeIssuedReassocToSameAP: |
| 4600 | { |
| 4601 | tDot11fBeaconIEs *pIes = NULL; |
| 4602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4603 | if( pSession->pConnectBssDesc ) |
| 4604 | { |
| 4605 | status = csrGetParsedBssDescriptionIEs(pMac, pSession->pConnectBssDesc, &pIes); |
| 4606 | if(!HAL_STATUS_SUCCESS(status) ) |
| 4607 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4608 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4609 | } |
| 4610 | else |
| 4611 | { |
| 4612 | roamInfo.reasonCode = eCsrRoamReasonStaCapabilityChanged; |
| 4613 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
| 4614 | pSession->roamingReason = eCsrReassocRoaming; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4615 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 4616 | roamInfo.pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4617 | pSession->bRefAssocStartCnt++; |
| 4618 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4619 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4620 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4621 | smsLog(pMac, LOG1, FL(" calling csrRoamIssueReassociate")); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4622 | status = csrRoamIssueReassociate( pMac, sessionId, pSession->pConnectBssDesc, pIes, |
| 4623 | &pCommand->u.roamCmd.roamProfile ); |
| 4624 | if(!HAL_STATUS_SUCCESS(status)) |
| 4625 | { |
| 4626 | smsLog(pMac, LOGE, FL("csrRoamIssueReassociate failed with status %d"), status); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 4627 | csrReleaseCommandRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4628 | } |
| 4629 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4630 | vos_mem_free(pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4631 | pIes = NULL; |
| 4632 | } |
| 4633 | } |
| 4634 | break; |
| 4635 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4636 | case eCsrCapsChange: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4637 | smsLog(pMac, LOGE, FL("received eCsrCapsChange ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4638 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4639 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE); |
| 4640 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4641 | case eCsrSmeIssuedFTReassoc: |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4642 | smsLog(pMac, LOG1, FL("received FT Reassoc Req ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4643 | status = csrProcessFTReassocRoamCommand(pMac, pCommand); |
| 4644 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4645 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4646 | case eCsrStopBss: |
| 4647 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4648 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4649 | break; |
| 4650 | |
| 4651 | case eCsrForcedDisassocSta: |
| 4652 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4653 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId); |
| 4654 | status = csrSendMBDisassocReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4655 | pCommand->u.roamCmd.reason); |
| 4656 | break; |
| 4657 | |
| 4658 | case eCsrForcedDeauthSta: |
| 4659 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4660 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId); |
| 4661 | status = csrSendMBDeauthReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4662 | pCommand->u.roamCmd.reason); |
| 4663 | break; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4664 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4665 | case eCsrPerformPreauth: |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 4666 | smsLog(pMac, LOG1, FL("Attempting FT PreAuth Req")); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4667 | status = csrRoamIssueFTPreauthReq(pMac, sessionId, |
| 4668 | pCommand->u.roamCmd.pLastRoamBss); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4669 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4670 | |
| 4671 | default: |
| 4672 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4673 | |
| 4674 | if( pCommand->u.roamCmd.fUpdateCurRoamProfile ) |
| 4675 | { |
| 4676 | //Remember the roaming profile |
| 4677 | csrFreeRoamProfile(pMac, sessionId); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4678 | pSession->pCurRoamProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 4679 | if ( NULL != pSession->pCurRoamProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4680 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4681 | vos_mem_set(pSession->pCurRoamProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4682 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, &pCommand->u.roamCmd.roamProfile); |
| 4683 | } |
| 4684 | } |
| 4685 | |
| 4686 | //At this point, original uapsd_mask is saved in pCurRoamProfile |
| 4687 | //uapsd_mask in the pCommand may change from this point on. |
| 4688 | |
| 4689 | // Attempt to roam with the new scan results (if we need to..) |
| 4690 | status = csrRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4691 | if(!HAL_STATUS_SUCCESS(status)) |
| 4692 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4693 | smsLog(pMac, LOGW, FL("csrRoam() failed with status = 0x%08X"), status); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4694 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4695 | break; |
| 4696 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4697 | return (status); |
| 4698 | } |
| 4699 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4700 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4701 | { |
| 4702 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4703 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4704 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4705 | vos_mem_set(&pCommand->u.roamCmd, sizeof(tRoamCmd), 0); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4706 | } |
| 4707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4708 | void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4709 | { |
| 4710 | if(pCommand->u.roamCmd.fReleaseBssList) |
| 4711 | { |
| 4712 | csrScanResultPurge(pMac, pCommand->u.roamCmd.hBSSList); |
| 4713 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 4714 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 4715 | } |
| 4716 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 4717 | { |
| 4718 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 4719 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 4720 | } |
| 4721 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4722 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4723 | vos_mem_set(&pCommand->u.roamCmd, sizeof(tRoamCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4724 | } |
| 4725 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4726 | void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4727 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4728 | vos_mem_set(&pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4729 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4730 | void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context ) |
| 4731 | { |
| 4732 | tListElem *pEntry; |
| 4733 | tSmeCmd *pCommand; |
| 4734 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4735 | smsLog( pMac, LOG2, "Roam Completion ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4736 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 4737 | if ( pEntry ) |
| 4738 | { |
| 4739 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4740 | // If the head of the queue is Active and it is a ROAM command, remove |
| 4741 | // and put this on the Free queue. |
| 4742 | if ( eSmeCommandRoam == pCommand->command ) |
| 4743 | { |
| 4744 | //we need to process the result first before removing it from active list because state changes |
| 4745 | //still happening insides roamQProcessRoamResults so no other roam command should be issued |
| 4746 | fReleaseCommand = csrRoamProcessResults( pMac, pCommand, Result, Context ); |
| 4747 | if( fReleaseCommand ) |
| 4748 | { |
| 4749 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 4750 | { |
| 4751 | csrReleaseCommandRoam( pMac, pCommand ); |
| 4752 | } |
| 4753 | else |
| 4754 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4755 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4756 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4757 | } |
| 4758 | } |
| 4759 | else |
| 4760 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4761 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4762 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4763 | } |
| 4764 | } |
| 4765 | else |
| 4766 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4767 | smsLog( pMac, LOGW, "CSR: Roam Completion called but ROAM command is not ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4768 | } |
| 4769 | } |
| 4770 | else |
| 4771 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4772 | smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4773 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4774 | if( fReleaseCommand ) |
| 4775 | { |
| 4776 | smeProcessPendingQueue( pMac ); |
| 4777 | } |
| 4778 | } |
| 4779 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4780 | void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4781 | { |
| 4782 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4783 | if(!pSession) |
| 4784 | { |
| 4785 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4786 | return; |
| 4787 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4788 | vos_mem_set(&(pSession->PmkidCandidateInfo[0]), |
| 4789 | sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4790 | pSession->NumPmkidCandidate = 0; |
| 4791 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4792 | #ifdef FEATURE_WLAN_WAPI |
| 4793 | void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4794 | { |
| 4795 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4796 | if(!pSession) |
| 4797 | { |
| 4798 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4799 | return; |
| 4800 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4801 | vos_mem_set(&(pSession->BkidCandidateInfo[0]), |
| 4802 | sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4803 | pSession->NumBkidCandidate = 0; |
| 4804 | } |
| 4805 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4806 | extern tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ]; |
| 4807 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4808 | static eHalStatus csrRoamSaveSecurityRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrAuthType authType, |
| 4809 | tSirBssDescription *pSirBssDesc, |
| 4810 | tDot11fBeaconIEs *pIes) |
| 4811 | { |
| 4812 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4813 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4814 | tDot11fBeaconIEs *pIesLocal = pIes; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4815 | |
| 4816 | if(!pSession) |
| 4817 | { |
| 4818 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4819 | return eHAL_STATUS_FAILURE; |
| 4820 | } |
| 4821 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4822 | if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4823 | (eCSR_AUTH_TYPE_WPA_PSK == authType) || |
| 4824 | (eCSR_AUTH_TYPE_RSN == authType) || |
| 4825 | (eCSR_AUTH_TYPE_RSN_PSK == authType) |
| 4826 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4827 | || |
| 4828 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4829 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) |
| 4830 | #endif /* FEATURE_WLAN_WAPI */ |
| 4831 | #ifdef FEATURE_WLAN_WAPI |
| 4832 | || |
| 4833 | (eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4834 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType) |
| 4835 | #endif /* FEATURE_WLAN_WAPI */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4836 | #ifdef WLAN_FEATURE_11W |
| 4837 | || |
| 4838 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) |
| 4839 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4840 | ) |
| 4841 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4842 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 4843 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4844 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4845 | } |
| 4846 | if( pIesLocal ) |
| 4847 | { |
| 4848 | tANI_U32 nIeLen; |
| 4849 | tANI_U8 *pIeBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4850 | if((eCSR_AUTH_TYPE_RSN == authType) || |
| 4851 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4852 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4853 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) || |
| 4854 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4855 | #if defined WLAN_FEATURE_11W |
| 4856 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) || |
| 4857 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4858 | (eCSR_AUTH_TYPE_RSN_PSK == authType)) |
| 4859 | { |
| 4860 | if(pIesLocal->RSN.present) |
| 4861 | { |
| 4862 | //Calculate the actual length |
| 4863 | nIeLen = 8 //version + gp_cipher_suite + pwise_cipher_suite_count |
| 4864 | + pIesLocal->RSN.pwise_cipher_suite_count * 4 //pwise_cipher_suites |
| 4865 | + 2 //akm_suite_count |
| 4866 | + pIesLocal->RSN.akm_suite_count * 4 //akm_suites |
| 4867 | + 2; //reserved |
| 4868 | if( pIesLocal->RSN.pmkid_count ) |
| 4869 | { |
| 4870 | nIeLen += 2 + pIesLocal->RSN.pmkid_count * 4; //pmkid |
| 4871 | } |
| 4872 | //nIeLen doesn't count EID and length fields |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4873 | pSession->pWpaRsnRspIE = vos_mem_malloc(nIeLen + 2); |
| 4874 | if (NULL == pSession->pWpaRsnRspIE) |
| 4875 | status = eHAL_STATUS_FAILURE; |
| 4876 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4877 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4878 | vos_mem_set(pSession->pWpaRsnRspIE, nIeLen + 2, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4879 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_RSN; |
| 4880 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4881 | //copy upto akm_suites |
| 4882 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4883 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.version, |
| 4884 | sizeof(pIesLocal->RSN.version)); |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 4885 | pIeBuf += sizeof(pIesLocal->RSN.version); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4886 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.gp_cipher_suite, |
| 4887 | sizeof(pIesLocal->RSN.gp_cipher_suite)); |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 4888 | pIeBuf += sizeof(pIesLocal->RSN.gp_cipher_suite); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4889 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.pwise_cipher_suite_count, |
| 4890 | sizeof(pIesLocal->RSN.pwise_cipher_suite_count)); |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 4891 | pIeBuf += sizeof(pIesLocal->RSN.pwise_cipher_suite_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4892 | if( pIesLocal->RSN.pwise_cipher_suite_count ) |
| 4893 | { |
| 4894 | //copy pwise_cipher_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4895 | vos_mem_copy(pIeBuf, |
| 4896 | pIesLocal->RSN.pwise_cipher_suites, |
| 4897 | pIesLocal->RSN.pwise_cipher_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4898 | pIeBuf += pIesLocal->RSN.pwise_cipher_suite_count * 4; |
| 4899 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4900 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.akm_suite_count, 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4901 | pIeBuf += 2; |
| 4902 | if( pIesLocal->RSN.akm_suite_count ) |
| 4903 | { |
| 4904 | //copy akm_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4905 | vos_mem_copy(pIeBuf, |
| 4906 | pIesLocal->RSN.akm_suites, |
| 4907 | pIesLocal->RSN.akm_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4908 | pIeBuf += pIesLocal->RSN.akm_suite_count * 4; |
| 4909 | } |
| 4910 | //copy the rest |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4911 | vos_mem_copy(pIeBuf, |
| 4912 | pIesLocal->RSN.akm_suites + pIesLocal->RSN.akm_suite_count * 4, |
| 4913 | 2 + pIesLocal->RSN.pmkid_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4914 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4915 | } |
| 4916 | } |
| 4917 | } |
| 4918 | else if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4919 | (eCSR_AUTH_TYPE_WPA_PSK == authType)) |
| 4920 | { |
| 4921 | if(pIesLocal->WPA.present) |
| 4922 | { |
| 4923 | //Calculate the actual length |
| 4924 | nIeLen = 12 //OUI + version + multicast_cipher + unicast_cipher_count |
| 4925 | + pIesLocal->WPA.unicast_cipher_count * 4 //unicast_ciphers |
| 4926 | + 2 //auth_suite_count |
| 4927 | + pIesLocal->WPA.auth_suite_count * 4; //auth_suites |
| 4928 | // The WPA capabilities follows the Auth Suite (two octects)-- |
| 4929 | // this field is optional, and we always "send" zero, so just |
| 4930 | // remove it. This is consistent with our assumptions in the |
| 4931 | // frames compiler; c.f. bug 15234: |
| 4932 | //nIeLen doesn't count EID and length fields |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4933 | |
| 4934 | pSession->pWpaRsnRspIE = vos_mem_malloc(nIeLen + 2); |
| 4935 | if ( NULL == pSession->pWpaRsnRspIE ) |
| 4936 | status = eHAL_STATUS_FAILURE; |
| 4937 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4938 | { |
| 4939 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_WPA; |
| 4940 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4941 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 4942 | //Copy WPA OUI |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4943 | vos_mem_copy(pIeBuf, &csrWpaOui[1], 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4944 | pIeBuf += 4; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4945 | vos_mem_copy(pIeBuf, &pIesLocal->WPA.version, |
| 4946 | 8 + pIesLocal->WPA.unicast_cipher_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4947 | pIeBuf += 8 + pIesLocal->WPA.unicast_cipher_count * 4; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4948 | vos_mem_copy(pIeBuf, &pIesLocal->WPA.auth_suite_count, |
| 4949 | 2 + pIesLocal->WPA.auth_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4950 | pIeBuf += pIesLocal->WPA.auth_suite_count * 4; |
| 4951 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4952 | } |
| 4953 | } |
| 4954 | } |
| 4955 | #ifdef FEATURE_WLAN_WAPI |
| 4956 | else if((eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4957 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType)) |
| 4958 | { |
| 4959 | if(pIesLocal->WAPI.present) |
| 4960 | { |
| 4961 | //Calculate the actual length |
| 4962 | nIeLen = 4 //version + akm_suite_count |
| 4963 | + pIesLocal->WAPI.akm_suite_count * 4 // akm_suites |
| 4964 | + 2 //pwise_cipher_suite_count |
| 4965 | + pIesLocal->WAPI.unicast_cipher_suite_count * 4 //pwise_cipher_suites |
| 4966 | + 6; //gp_cipher_suite + preauth + reserved |
| 4967 | if( pIesLocal->WAPI.bkid_count ) |
| 4968 | { |
| 4969 | nIeLen += 2 + pIesLocal->WAPI.bkid_count * 4; //bkid |
| 4970 | } |
| 4971 | |
| 4972 | //nIeLen doesn't count EID and length fields |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4973 | pSession->pWapiRspIE = vos_mem_malloc(nIeLen + 2); |
| 4974 | if ( NULL == pSession->pWapiRspIE ) |
| 4975 | status = eHAL_STATUS_FAILURE; |
| 4976 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4977 | { |
| 4978 | pSession->pWapiRspIE[0] = DOT11F_EID_WAPI; |
| 4979 | pSession->pWapiRspIE[1] = (tANI_U8)nIeLen; |
| 4980 | pIeBuf = pSession->pWapiRspIE + 2; |
| 4981 | //copy upto akm_suite_count |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4982 | vos_mem_copy(pIeBuf, &pIesLocal->WAPI.version, 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4983 | pIeBuf += 4; |
| 4984 | if( pIesLocal->WAPI.akm_suite_count ) |
| 4985 | { |
| 4986 | //copy akm_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4987 | vos_mem_copy(pIeBuf, pIesLocal->WAPI.akm_suites, |
| 4988 | pIesLocal->WAPI.akm_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4989 | pIeBuf += pIesLocal->WAPI.akm_suite_count * 4; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4990 | } |
| 4991 | vos_mem_copy(pIeBuf, |
| 4992 | &pIesLocal->WAPI.unicast_cipher_suite_count, |
| 4993 | 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4994 | pIeBuf += 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4995 | if( pIesLocal->WAPI.unicast_cipher_suite_count ) |
| 4996 | { |
| 4997 | //copy pwise_cipher_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4998 | vos_mem_copy( pIeBuf, |
| 4999 | pIesLocal->WAPI.unicast_cipher_suites, |
| 5000 | pIesLocal->WAPI.unicast_cipher_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5001 | pIeBuf += pIesLocal->WAPI.unicast_cipher_suite_count * 4; |
| 5002 | } |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 5003 | //gp_cipher_suite |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5004 | vos_mem_copy(pIeBuf, |
| 5005 | pIesLocal->WAPI.multicast_cipher_suite, |
| 5006 | 4); |
Praveen Kumar Sirisilla | 16c6377 | 2013-10-23 19:31:58 -0700 | [diff] [blame] | 5007 | pIeBuf += 4; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 5008 | //preauth + reserved |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5009 | vos_mem_copy(pIeBuf, |
| 5010 | pIesLocal->WAPI.multicast_cipher_suite + 4, |
| 5011 | 2); |
Praveen Kumar Sirisilla | 16c6377 | 2013-10-23 19:31:58 -0700 | [diff] [blame] | 5012 | pIeBuf += 2; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 5013 | //bkid_count |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5014 | vos_mem_copy(pIeBuf, &pIesLocal->WAPI.bkid_count, 2); |
| 5015 | |
Praveen Kumar Sirisilla | 16c6377 | 2013-10-23 19:31:58 -0700 | [diff] [blame] | 5016 | pIeBuf += 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5017 | if( pIesLocal->WAPI.bkid_count ) |
| 5018 | { |
| 5019 | //copy akm_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5020 | vos_mem_copy(pIeBuf, pIesLocal->WAPI.bkid, |
| 5021 | pIesLocal->WAPI.bkid_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5022 | pIeBuf += pIesLocal->WAPI.bkid_count * 4; |
| 5023 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 5024 | pSession->nWapiRspIeLength = nIeLen + 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5025 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5026 | } |
| 5027 | } |
| 5028 | #endif /* FEATURE_WLAN_WAPI */ |
| 5029 | if( !pIes ) |
| 5030 | { |
| 5031 | //locally allocated |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5032 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5033 | } |
| 5034 | } |
| 5035 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5036 | return (status); |
| 5037 | } |
| 5038 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5039 | static void csrCheckAndUpdateACWeight( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIEs ) |
| 5040 | { |
| 5041 | v_U8_t bACWeights[WLANTL_MAX_AC]; |
| 5042 | v_U8_t paramBk, paramBe, paramVi, paramVo; |
| 5043 | v_BOOL_t fWeightChange = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5044 | //Compare two ACs' EDCA parameters, from low to high (BK, BE, VI, VO) |
| 5045 | //The "formula" is, if lower AC's AIFSN+CWMin is bigger than a fixed amount |
| 5046 | //of the higher AC one, make the higher AC has the same weight as the lower AC. |
| 5047 | //This doesn't address the case where the lower AC needs a real higher weight |
| 5048 | if( pIEs->WMMParams.present ) |
| 5049 | { |
| 5050 | //no change to the lowest ones |
| 5051 | bACWeights[WLANTL_AC_BK] = pMac->roam.ucACWeights[WLANTL_AC_BK]; |
| 5052 | bACWeights[WLANTL_AC_BE] = pMac->roam.ucACWeights[WLANTL_AC_BE]; |
| 5053 | bACWeights[WLANTL_AC_VI] = pMac->roam.ucACWeights[WLANTL_AC_VI]; |
| 5054 | bACWeights[WLANTL_AC_VO] = pMac->roam.ucACWeights[WLANTL_AC_VO]; |
| 5055 | paramBk = pIEs->WMMParams.acbk_aifsn + pIEs->WMMParams.acbk_acwmin; |
| 5056 | paramBe = pIEs->WMMParams.acbe_aifsn + pIEs->WMMParams.acbe_acwmin; |
| 5057 | paramVi = pIEs->WMMParams.acvi_aifsn + pIEs->WMMParams.acvi_acwmin; |
| 5058 | paramVo = pIEs->WMMParams.acvo_aifsn + pIEs->WMMParams.acvo_acwmin; |
| 5059 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramBe) ) |
| 5060 | { |
| 5061 | bACWeights[WLANTL_AC_BE] = bACWeights[WLANTL_AC_BK]; |
| 5062 | fWeightChange = VOS_TRUE; |
| 5063 | } |
| 5064 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVi) ) |
| 5065 | { |
| 5066 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BK]; |
| 5067 | fWeightChange = VOS_TRUE; |
| 5068 | } |
| 5069 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVi) ) |
| 5070 | { |
| 5071 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BE]; |
| 5072 | fWeightChange = VOS_TRUE; |
| 5073 | } |
| 5074 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVo) ) |
| 5075 | { |
| 5076 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BK]; |
| 5077 | fWeightChange = VOS_TRUE; |
| 5078 | } |
| 5079 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVo) ) |
| 5080 | { |
| 5081 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BE]; |
| 5082 | fWeightChange = VOS_TRUE; |
| 5083 | } |
| 5084 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramVi, paramVo) ) |
| 5085 | { |
| 5086 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_VI]; |
| 5087 | fWeightChange = VOS_TRUE; |
| 5088 | } |
| 5089 | if(fWeightChange) |
| 5090 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5091 | smsLog(pMac, LOGE, FL(" change AC weights (%d-%d-%d-%d)"), bACWeights[0], bACWeights[1], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5092 | bACWeights[2], bACWeights[3]); |
| 5093 | WLANTL_SetACWeights(pMac->roam.gVosContext, bACWeights); |
| 5094 | } |
| 5095 | } |
| 5096 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5097 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5098 | //Returns whether the current association is a 11r assoc or not |
| 5099 | tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac) |
| 5100 | { |
| 5101 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5102 | return csrNeighborRoamIs11rAssoc(pMac); |
| 5103 | #else |
| 5104 | return eANI_BOOLEAN_FALSE; |
| 5105 | #endif |
| 5106 | } |
| 5107 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5108 | #ifdef FEATURE_WLAN_ESE |
| 5109 | //Returns whether the current association is a ESE assoc or not |
| 5110 | tANI_BOOLEAN csrRoamIsESEAssoc(tpAniSirGlobal pMac) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5111 | { |
| 5112 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5113 | return csrNeighborRoamIsESEAssoc(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5114 | #else |
| 5115 | return eANI_BOOLEAN_FALSE; |
| 5116 | #endif |
| 5117 | } |
| 5118 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5119 | #ifdef FEATURE_WLAN_LFR |
| 5120 | //Returns whether "Legacy Fast Roaming" is currently enabled...or not |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 5121 | tANI_BOOLEAN csrRoamIsFastRoamEnabled(tpAniSirGlobal pMac, tANI_U32 sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5122 | { |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 5123 | tCsrRoamSession *pSession = NULL; |
| 5124 | |
| 5125 | if (CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 5126 | { |
| 5127 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 5128 | if (NULL != pSession->pCurRoamProfile) |
| 5129 | { |
| 5130 | if (pSession->pCurRoamProfile->csrPersona != VOS_STA_MODE) |
| 5131 | { |
| 5132 | return eANI_BOOLEAN_FALSE; |
| 5133 | } |
| 5134 | } |
| 5135 | } |
| 5136 | |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5137 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 5138 | if (eANI_BOOLEAN_TRUE == CSR_IS_FASTROAM_IN_CONCURRENCY_INI_FEATURE_ENABLED(pMac)) |
| 5139 | { |
| 5140 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled); |
| 5141 | } |
| 5142 | else |
| 5143 | #endif |
| 5144 | { |
| 5145 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled && |
Madan Mohan Koyyalamudi | 393a434 | 2012-10-15 16:07:09 -0700 | [diff] [blame] | 5146 | (!csrIsConcurrentSessionRunning(pMac))); |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5147 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5148 | } |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5149 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5150 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5151 | /* --------------------------------------------------------------------------- |
| 5152 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5153 | \fn csrNeighborRoamIsESEAssoc |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5154 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5155 | \brief This function returns whether the current association is a ESE assoc or not |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5156 | |
| 5157 | \param pMac - The handle returned by macOpen. |
| 5158 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5159 | \return eANI_BOOLEAN_TRUE if current assoc is ESE, eANI_BOOLEAN_FALSE otherwise |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5160 | |
| 5161 | ---------------------------------------------------------------------------*/ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5162 | tANI_BOOLEAN csrNeighborRoamIsESEAssoc(tpAniSirGlobal pMac) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5163 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5164 | return pMac->roam.neighborRoamInfo.isESEAssoc; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5165 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5166 | #endif /* FEATURE_WLAN_ESE */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5167 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 5168 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 5169 | //Returns whether "FW based BG scan" is currently enabled...or not |
| 5170 | tANI_BOOLEAN csrRoamIsRoamOffloadScanEnabled(tpAniSirGlobal pMac) |
| 5171 | { |
| 5172 | return (pMac->roam.configParam.isRoamOffloadScanEnabled); |
| 5173 | } |
| 5174 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5175 | #endif |
| 5176 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5177 | #if defined(FEATURE_WLAN_ESE) |
| 5178 | tANI_BOOLEAN csrRoamIsEseIniFeatureEnabled(tpAniSirGlobal pMac) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5179 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5180 | return pMac->roam.configParam.isEseIniFeatureEnabled; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5181 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5182 | #endif /*FEATURE_WLAN_ESE*/ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5183 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5184 | //Return true means the command can be release, else not |
| 5185 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 5186 | eCsrRoamCompleteResult Result, void *Context ) |
| 5187 | { |
| 5188 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
| 5189 | tSirBssDescription *pSirBssDesc = NULL; |
| 5190 | tSirMacAddr BroadcastMac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 5191 | tCsrScanResult *pScanResult = NULL; |
| 5192 | tCsrRoamInfo roamInfo; |
| 5193 | sme_QosAssocInfo assocInfo; |
| 5194 | sme_QosCsrEventIndType ind_qos;//indication for QoS module in SME |
| 5195 | tANI_U8 acm_mask = 0; //HDD needs the ACM mask in the assoc rsp callback |
| 5196 | tDot11fBeaconIEs *pIes = NULL; |
| 5197 | tANI_U32 sessionId = pCommand->sessionId; |
| 5198 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 5199 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 5200 | eRoamCmdStatus roamStatus; |
| 5201 | eCsrRoamResult roamResult; |
| 5202 | eHalStatus status; |
| 5203 | tANI_U32 key_timeout_interval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5204 | tSirSmeStartBssRsp *pSmeStartBssRsp = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5205 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5206 | if(!pSession) |
| 5207 | { |
| 5208 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 5209 | return eANI_BOOLEAN_FALSE; |
| 5210 | } |
| 5211 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5212 | smsLog( pMac, LOG1, FL("Processing ROAM results...")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5213 | switch( Result ) |
| 5214 | { |
| 5215 | case eCsrJoinSuccess: |
| 5216 | // reset the IDLE timer |
| 5217 | // !! |
| 5218 | // !! fall through to the next CASE statement here is intentional !! |
| 5219 | // !! |
| 5220 | case eCsrReassocSuccess: |
| 5221 | if(eCsrReassocSuccess == Result) |
| 5222 | { |
| 5223 | ind_qos = SME_QOS_CSR_REASSOC_COMPLETE; |
| 5224 | } |
| 5225 | else |
| 5226 | { |
| 5227 | ind_qos = SME_QOS_CSR_ASSOC_COMPLETE; |
| 5228 | } |
| 5229 | // Success Join Response from LIM. Tell NDIS we are connected and save the |
| 5230 | // Connected state... |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5231 | smsLog(pMac, LOGW, FL("receives association indication")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5232 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5233 | //always free the memory here |
| 5234 | if(pSession->pWpaRsnRspIE) |
| 5235 | { |
| 5236 | pSession->nWpaRsnRspIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5237 | vos_mem_free(pSession->pWpaRsnRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5238 | pSession->pWpaRsnRspIE = NULL; |
| 5239 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5240 | #ifdef FEATURE_WLAN_WAPI |
| 5241 | if(pSession->pWapiRspIE) |
| 5242 | { |
| 5243 | pSession->nWapiRspIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5244 | vos_mem_free(pSession->pWapiRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5245 | pSession->pWapiRspIE = NULL; |
| 5246 | } |
| 5247 | #endif /* FEATURE_WLAN_WAPI */ |
| 5248 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5249 | //Reset counter so no join retry is needed. |
| 5250 | pSession->maxRetryCount = 0; |
| 5251 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 5252 | #endif |
| 5253 | /* This creates problem since we have not saved the connected profile. |
| 5254 | So moving this after saving the profile |
| 5255 | */ |
| 5256 | //csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED ); |
Abhishek Singh | 36abbcb | 2014-03-20 13:04:09 +0530 | [diff] [blame] | 5257 | |
| 5258 | /* Reset remainInPowerActiveTillDHCP as it might have been set |
| 5259 | * by last failed secured connection. |
| 5260 | * It should be set only for secured connection. |
| 5261 | */ |
| 5262 | pMac->pmc.remainInPowerActiveTillDHCP = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5263 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 5264 | { |
| 5265 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
| 5266 | } |
| 5267 | else |
| 5268 | { |
| 5269 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED; |
| 5270 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5271 | //Use the last connected bssdesc for reassoc-ing to the same AP. |
| 5272 | //NOTE: What to do when reassoc to a different AP??? |
| 5273 | if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) || |
| 5274 | (eCsrSmeIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ) |
| 5275 | { |
| 5276 | pSirBssDesc = pSession->pConnectBssDesc; |
| 5277 | if(pSirBssDesc) |
| 5278 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5279 | vos_mem_copy(&roamInfo.bssid, &pSirBssDesc->bssId, |
| 5280 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5281 | } |
| 5282 | } |
| 5283 | else |
| 5284 | { |
| 5285 | |
| 5286 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5287 | { |
| 5288 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 5289 | if(pScanResult != NULL) |
| 5290 | { |
| 5291 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5292 | //this can be NULL |
| 5293 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5294 | vos_mem_copy(&roamInfo.bssid, &pSirBssDesc->bssId, |
| 5295 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5296 | } |
| 5297 | } |
| 5298 | } |
| 5299 | if( pSirBssDesc ) |
| 5300 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5301 | roamInfo.staId = HAL_STA_INVALID_IDX; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5302 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 5303 | //Save WPA/RSN IE |
| 5304 | csrRoamSaveSecurityRspIE(pMac, sessionId, pProfile->negotiatedAuthType, pSirBssDesc, pIes); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5305 | #ifdef FEATURE_WLAN_ESE |
| 5306 | roamInfo.isESEAssoc = pSession->connectedProfile.isESEAssoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5307 | #endif |
| 5308 | |
| 5309 | // csrRoamStateChange also affects sub-state. Hence, csrRoamStateChange happens first and then |
| 5310 | // substate change. |
| 5311 | // Moving even save profile above so that below mentioned conditon is also met. |
| 5312 | // JEZ100225: Moved to after saving the profile. Fix needed in main/latest |
| 5313 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5314 | // Make sure the Set Context is issued before link indication to NDIS. After link indication is |
| 5315 | // made to NDIS, frames could start flowing. If we have not set context with LIM, the frames |
| 5316 | // will be dropped for the security context may not be set properly. |
| 5317 | // |
| 5318 | // this was causing issues in the 2c_wlan_wep WHQL test when the SetContext was issued after the link |
| 5319 | // indication. (Link Indication happens in the profFSMSetConnectedInfra call). |
| 5320 | // |
| 5321 | // this reordering was done on titan_prod_usb branch and is being replicated here. |
| 5322 | // |
| 5323 | |
| 5324 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && |
| 5325 | !pProfile->bWPSAssociation) |
| 5326 | { |
| 5327 | // Issue the set Context request to LIM to establish the Unicast STA context |
| 5328 | if( !HAL_STATUS_SUCCESS( csrRoamIssueSetContextReq( pMac, sessionId, |
| 5329 | pProfile->negotiatedUCEncryptionType, |
| 5330 | pSirBssDesc, &(pSirBssDesc->bssId), |
| 5331 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ) ) ) // NO keys... these key parameters don't matter. |
| 5332 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5333 | smsLog( pMac, LOGE, FL(" Set context for unicast fail") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5334 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 5335 | } |
| 5336 | // Issue the set Context request to LIM to establish the Broadcast STA context |
| 5337 | csrRoamIssueSetContextReq( pMac, sessionId, pProfile->negotiatedMCEncryptionType, |
| 5338 | pSirBssDesc, &BroadcastMac, |
| 5339 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5340 | } |
| 5341 | else |
| 5342 | { |
| 5343 | //Need to wait for supplicant authtication |
| 5344 | roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5345 | //Set the subestate to WaitForKey in case authentiation is needed |
| 5346 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId ); |
| 5347 | |
Abhishek Singh | 36abbcb | 2014-03-20 13:04:09 +0530 | [diff] [blame] | 5348 | /* Set remainInPowerActiveTillDHCP to make sure we wait for |
| 5349 | * until keys are set before going into BMPS. |
| 5350 | */ |
| 5351 | pMac->pmc.remainInPowerActiveTillDHCP = TRUE; |
| 5352 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5353 | if(pProfile->bWPSAssociation) |
| 5354 | { |
| 5355 | key_timeout_interval = CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD; |
| 5356 | } |
| 5357 | else |
| 5358 | { |
| 5359 | key_timeout_interval = CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD; |
| 5360 | } |
| 5361 | |
| 5362 | //Save sessionId in case of timeout |
| 5363 | pMac->roam.WaitForKeyTimerInfo.sessionId = (tANI_U8)sessionId; |
| 5364 | //This time should be long enough for the rest of the process plus setting key |
| 5365 | if(!HAL_STATUS_SUCCESS( csrRoamStartWaitForKeyTimer( pMac, key_timeout_interval ) ) ) |
| 5366 | { |
| 5367 | //Reset our state so nothting is blocked. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5368 | smsLog( pMac, LOGE, FL(" Failed to start pre-auth timer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5369 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 5370 | } |
| 5371 | } |
| 5372 | |
| 5373 | assocInfo.pBssDesc = pSirBssDesc; //could be NULL |
| 5374 | assocInfo.pProfile = pProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5375 | if(Context) |
| 5376 | { |
| 5377 | tSirSmeJoinRsp *pJoinRsp = (tSirSmeJoinRsp *)Context; |
| 5378 | tANI_U32 len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5379 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5380 | len = pJoinRsp->assocReqLength + pJoinRsp->assocRspLength + pJoinRsp->beaconLength; |
| 5381 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5382 | len += pJoinRsp->parsedRicRspLen; |
| 5383 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5384 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5385 | len += pJoinRsp->tspecIeLen; |
| 5386 | #endif |
| 5387 | if(len) |
| 5388 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5389 | pSession->connectedInfo.pbFrames = vos_mem_malloc(len); |
| 5390 | if ( pSession->connectedInfo.pbFrames != NULL ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5391 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5392 | vos_mem_copy(pSession->connectedInfo.pbFrames, |
| 5393 | pJoinRsp->frames, len); |
| 5394 | pSession->connectedInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 5395 | pSession->connectedInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 5396 | pSession->connectedInfo.nBeaconLength = pJoinRsp->beaconLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5397 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5398 | pSession->connectedInfo.nRICRspLength = pJoinRsp->parsedRicRspLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5399 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5400 | #ifdef FEATURE_WLAN_ESE |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5401 | pSession->connectedInfo.nTspecIeLength = pJoinRsp->tspecIeLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5402 | #endif |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5403 | roamInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 5404 | roamInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 5405 | roamInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 5406 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5407 | } |
| 5408 | } |
| 5409 | if(pCommand->u.roamCmd.fReassoc) |
| 5410 | { |
| 5411 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 5412 | } |
| 5413 | pSession->connectedInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 5414 | roamInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 5415 | roamInfo.ucastSig = ( tANI_U8 )pJoinRsp->ucastSig; |
| 5416 | roamInfo.bcastSig = ( tANI_U8 )pJoinRsp->bcastSig; |
| 5417 | } |
| 5418 | else |
| 5419 | { |
| 5420 | if(pCommand->u.roamCmd.fReassoc) |
| 5421 | { |
| 5422 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 5423 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5424 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5425 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5426 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5427 | } |
| 5428 | } |
| 5429 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5430 | // Indicate SME-QOS with reassoc success event, only after |
| 5431 | // copying the frames |
| 5432 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, ind_qos, &assocInfo); |
| 5433 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5434 | roamInfo.pBssDesc = pSirBssDesc; |
| 5435 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5436 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5437 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5438 | acm_mask = sme_QosGetACMMask(pMac, pSirBssDesc, NULL); |
| 5439 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 5440 | pSession->connectedProfile.acm_mask = acm_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5441 | //start UAPSD if uapsd_mask is not 0 because HDD will configure for trigger frame |
| 5442 | //It may be better to let QoS do this???? |
| 5443 | if( pSession->connectedProfile.modifyProfileFields.uapsd_mask ) |
| 5444 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5445 | smsLog(pMac, LOGE, " uapsd_mask (0x%X) set, request UAPSD now", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5446 | pSession->connectedProfile.modifyProfileFields.uapsd_mask); |
| 5447 | pmcStartUapsd( pMac, NULL, NULL ); |
| 5448 | } |
Gopichand Nakkala | dacbcb5 | 2013-04-18 16:41:54 +0530 | [diff] [blame] | 5449 | pSession->connectedProfile.dot11Mode = pSession->bssParams.uCfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5450 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5451 | if( pSession->bRefAssocStartCnt > 0 ) |
| 5452 | { |
| 5453 | pSession->bRefAssocStartCnt--; |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5454 | //Remove this code once SLM_Sessionization is supported |
| 5455 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5456 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5457 | { |
| 5458 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5459 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5460 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5461 | } |
| 5462 | |
| 5463 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_NONE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5464 | // reset the PMKID candidate list |
| 5465 | csrResetPMKIDCandidateList( pMac, sessionId ); |
| 5466 | //Update TL's AC weight base on the current EDCA parameters |
| 5467 | //These parameters may change in the course of the connection, that sictuation |
| 5468 | //is not taken care here. This change is mainly to address a WIFI WMM test where |
| 5469 | //BE has a equal or higher TX priority than VI. |
| 5470 | //We only do this for infra link |
| 5471 | if( csrIsConnStateConnectedInfra(pMac, sessionId ) && pIes ) |
| 5472 | { |
| 5473 | csrCheckAndUpdateACWeight(pMac, pIes); |
| 5474 | } |
| 5475 | #ifdef FEATURE_WLAN_WAPI |
| 5476 | // reset the BKID candidate list |
| 5477 | csrResetBKIDCandidateList( pMac, sessionId ); |
| 5478 | #endif /* FEATURE_WLAN_WAPI */ |
| 5479 | } |
| 5480 | else |
| 5481 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5482 | smsLog(pMac, LOGW, " Roam command doesn't have a BSS desc"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5483 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5484 | csrScanCancelIdleScan(pMac); |
| 5485 | //Not to signal link up because keys are yet to be set. |
| 5486 | //The linkup function will overwrite the sub-state that we need to keep at this point. |
| 5487 | if( !CSR_IS_WAIT_FOR_KEY(pMac, sessionId) ) |
| 5488 | { |
| 5489 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 5490 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5491 | //Check if BMPS is required and start the BMPS retry timer. Timer period is large |
| 5492 | //enough to let security and DHCP handshake succeed before entry into BMPS |
| 5493 | if (pmcShouldBmpsTimerRun(pMac)) |
| 5494 | { |
| 5495 | if (pmcStartTrafficTimer(pMac, BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP) |
| 5496 | != eHAL_STATUS_SUCCESS) |
| 5497 | { |
| 5498 | smsLog(pMac, LOGP, FL("Cannot start BMPS Retry timer")); |
| 5499 | } |
| 5500 | smsLog(pMac, LOG2, FL("BMPS Retry Timer already running or started")); |
| 5501 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5502 | break; |
| 5503 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5504 | case eCsrStartBssSuccess: |
| 5505 | // on the StartBss Response, LIM is returning the Bss Description that we |
| 5506 | // are beaconing. Add this Bss Description to our scan results and |
| 5507 | // chain the Profile to this Bss Description. On a Start BSS, there was no |
| 5508 | // detected Bss description (no partner) so we issued the Start Bss to |
| 5509 | // start the Ibss without any Bss description. Lim was kind enough to return |
| 5510 | // the Bss Description that we start beaconing for the newly started Ibss. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5511 | smsLog(pMac, LOG2, FL("receives start BSS ok indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5512 | status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5513 | pSmeStartBssRsp = (tSirSmeStartBssRsp *)Context; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5514 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5515 | if( CSR_IS_IBSS( pProfile ) ) |
| 5516 | { |
| 5517 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 5518 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5519 | else if (CSR_IS_INFRA_AP(pProfile)) |
| 5520 | { |
| 5521 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 5522 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5523 | else |
| 5524 | { |
| 5525 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 5526 | } |
| 5527 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 5528 | { |
| 5529 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5530 | pSirBssDesc = &pSmeStartBssRsp->bssDescription; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5531 | if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs( pMac, pSirBssDesc, &pIes )) ) |
| 5532 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 5533 | smsLog(pMac, LOGW, FL("cannot parse IBSS IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5534 | roamInfo.pBssDesc = pSirBssDesc; |
| 5535 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5536 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5537 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_START_FAILED ); |
| 5538 | break; |
| 5539 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5540 | if (!CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5541 | { |
Tushnim Bhattacharyya | 5128d75 | 2013-06-26 23:23:18 -0700 | [diff] [blame] | 5542 | pScanResult = csrScanAppendBssDescription( pMac, pSirBssDesc, pIes, FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5543 | } |
| 5544 | csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
| 5545 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5546 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5547 | if(pSirBssDesc) |
| 5548 | { |
| 5549 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5550 | vos_mem_copy(&roamInfo.bssid, &pSirBssDesc->bssId, |
| 5551 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5552 | } |
| 5553 | //We are doen with the IEs so free it |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5554 | vos_mem_free(pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5555 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5556 | { |
| 5557 | vos_log_ibss_pkt_type *pIbssLog; |
| 5558 | tANI_U32 bi; |
| 5559 | |
| 5560 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5561 | if(pIbssLog) |
| 5562 | { |
| 5563 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 5564 | { |
| 5565 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5566 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_RSP; |
| 5567 | } |
| 5568 | else |
| 5569 | { |
| 5570 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_RSP; |
| 5571 | } |
| 5572 | if(pSirBssDesc) |
| 5573 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5574 | vos_mem_copy(pIbssLog->bssid, pSirBssDesc->bssId, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5575 | pIbssLog->operatingChannel = pSirBssDesc->channelId; |
| 5576 | } |
| 5577 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 5578 | { |
| 5579 | //***U8 is not enough for beacon interval |
| 5580 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 5581 | } |
| 5582 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5583 | } |
| 5584 | } |
| 5585 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5586 | //Only set context for non-WDS_STA. We don't even need it for WDS_AP. But since the encryption |
| 5587 | //is WPA2-PSK so it won't matter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5588 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && !CSR_IS_INFRA_AP( pSession->pCurRoamProfile )) |
| 5589 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5590 | // Issue the set Context request to LIM to establish the Broadcast STA context for the Ibss. |
| 5591 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 5592 | pProfile->negotiatedMCEncryptionType, |
| 5593 | pSirBssDesc, &BroadcastMac, |
| 5594 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5595 | } |
| 5596 | } |
| 5597 | else |
| 5598 | { |
| 5599 | //Keep the state to eCSR_ROAMING_STATE_JOINING |
| 5600 | //Need to send join_req. |
| 5601 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5602 | { |
| 5603 | if((pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link))) |
| 5604 | { |
| 5605 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5606 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 5607 | // Set the roaming substate to 'join attempt'... |
| 5608 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 5609 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5610 | } |
| 5611 | } |
| 5612 | else |
| 5613 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5614 | smsLog( pMac, LOGE, " StartBSS for WDS station with no BssDesc" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5615 | VOS_ASSERT( 0 ); |
| 5616 | } |
| 5617 | } |
| 5618 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5619 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5620 | //trigger the connection start indication in Vista |
| 5621 | if( !CSR_IS_JOIN_TO_IBSS( pProfile ) ) |
| 5622 | { |
| 5623 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5624 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5625 | if( CSR_IS_WDS( pProfile ) ) |
| 5626 | { |
| 5627 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5628 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5629 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5630 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5631 | { |
| 5632 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5633 | roamResult = eCSR_ROAM_RESULT_INFRA_STARTED; |
| 5634 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5635 | |
| 5636 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5637 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5638 | //trigger the connection start indication in Vista |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5639 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5640 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5641 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 5642 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5643 | roamInfo.pBssDesc = pSirBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5644 | roamInfo.staId = (tANI_U8)pSmeStartBssRsp->staId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5645 | vos_mem_copy(roamInfo.bssid, pSirBssDesc->bssId, |
| 5646 | sizeof(tCsrBssid)); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5647 | //Remove this code once SLM_Sessionization is supported |
| 5648 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5649 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5650 | ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5651 | { |
| 5652 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5653 | } |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5655 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5656 | } |
| 5657 | |
| 5658 | csrScanCancelIdleScan(pMac); |
Ravi Joshi | 414b14c | 2013-10-04 16:33:26 -0700 | [diff] [blame] | 5659 | |
| 5660 | if( CSR_IS_WDS_STA( pProfile ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5661 | { |
| 5662 | //need to send stop BSS because we fail to send join_req |
| 5663 | csrRoamIssueDisassociateCmd( pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 5664 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5665 | eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_STOPPED ); |
| 5666 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5667 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5668 | case eCsrStartBssFailure: |
| 5669 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5670 | { |
| 5671 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5672 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5673 | if(pIbssLog) |
| 5674 | { |
| 5675 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 5676 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5677 | } |
| 5678 | } |
| 5679 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5680 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5681 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5682 | if( CSR_IS_WDS( pProfile ) ) |
| 5683 | { |
| 5684 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5685 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5686 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5687 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5688 | { |
| 5689 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5690 | roamResult = eCSR_ROAM_RESULT_INFRA_START_FAILED; |
| 5691 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5692 | if(Context) |
| 5693 | { |
| 5694 | pSirBssDesc = (tSirBssDescription *)Context; |
| 5695 | } |
| 5696 | else |
| 5697 | { |
| 5698 | pSirBssDesc = NULL; |
| 5699 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5700 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5701 | roamInfo.pBssDesc = pSirBssDesc; |
| 5702 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5703 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5704 | csrSetDefaultDot11Mode( pMac ); |
| 5705 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5706 | case eCsrSilentlyStopRoaming: |
| 5707 | // We are here because we try to start the same IBSS |
| 5708 | //No message to PE |
| 5709 | // return the roaming state to Joined. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5710 | smsLog(pMac, LOGW, FL("receives silently roaming indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5711 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
| 5712 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5713 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5714 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5715 | if( roamInfo.pBssDesc ) |
| 5716 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5717 | vos_mem_copy(&roamInfo.bssid, &roamInfo.pBssDesc->bssId, |
| 5718 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5719 | } |
| 5720 | //Since there is no change in the current state, simply pass back no result otherwise |
| 5721 | //HDD may be mistakenly mark to disconnected state. |
| 5722 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5723 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5724 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5725 | case eCsrSilentlyStopRoamingSaveState: |
| 5726 | //We are here because we try to connect to the same AP |
| 5727 | //No message to PE |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5728 | smsLog(pMac, LOGW, FL("receives silently stop roaming indication")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5729 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5730 | |
| 5731 | //to aviod resetting the substate to NONE |
| 5732 | pMac->roam.curState[sessionId] = eCSR_ROAMING_STATE_JOINED; |
| 5733 | //No need to change substate to wai_for_key because there is no state change |
| 5734 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5735 | if( roamInfo.pBssDesc ) |
| 5736 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5737 | vos_mem_copy(&roamInfo.bssid, &roamInfo.pBssDesc->bssId, |
| 5738 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5739 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5740 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5741 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5742 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5743 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5744 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5745 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5746 | roamInfo.staId = pSession->connectedInfo.staId; |
| 5747 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5748 | VOS_ASSERT( roamInfo.staId != 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5749 | pSession->bRefAssocStartCnt--; |
| 5750 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5751 | eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5752 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_ASSOCIATED, eANI_BOOLEAN_TRUE); |
| 5753 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5754 | case eCsrReassocFailure: |
| 5755 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5756 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_REASSOC_FAILURE, NULL); |
| 5757 | #endif |
| 5758 | case eCsrJoinWdsFailure: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5759 | smsLog(pMac, LOGW, FL("failed to join WDS")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5760 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5761 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5762 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5763 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5764 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5765 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5766 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5767 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5768 | eCSR_ROAM_WDS_IND, |
| 5769 | eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED); |
| 5770 | //Need to issue stop_bss |
| 5771 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5772 | case eCsrJoinFailure: |
| 5773 | case eCsrNothingToJoin: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5774 | case eCsrJoinFailureDueToConcurrency: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5775 | default: |
| 5776 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5777 | smsLog(pMac, LOGW, FL("receives no association indication")); |
| 5778 | smsLog(pMac, LOG1, FL("Assoc ref count %d"), |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 5779 | pSession->bRefAssocStartCnt); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5780 | if( CSR_IS_INFRASTRUCTURE( &pSession->connectedProfile ) || |
| 5781 | CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, sessionId ) ) |
| 5782 | { |
| 5783 | //do not free for the other profiles as we need to send down stop BSS later |
| 5784 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5785 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5786 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5787 | csrSetDefaultDot11Mode( pMac ); |
| 5788 | } |
| 5789 | |
| 5790 | switch( pCommand->u.roamCmd.roamReason ) |
| 5791 | { |
| 5792 | // If this transition is because of an 802.11 OID, then we transition |
| 5793 | // back to INIT state so we sit waiting for more OIDs to be issued and |
| 5794 | // we don't start the IDLE timer. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5795 | case eCsrSmeIssuedFTReassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5796 | case eCsrSmeIssuedAssocToSimilarAP: |
| 5797 | case eCsrHddIssued: |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 5798 | case eCsrSmeIssuedDisassocForHandoff: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5799 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5800 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5801 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5802 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5803 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5804 | vos_mem_copy(&roamInfo.bssid, |
| 5805 | &pSession->joinFailStatusCode.bssId, |
| 5806 | sizeof(tCsrBssid)); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 5807 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5808 | /* Defeaturize this later if needed */ |
| 5809 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5810 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 5811 | if (csrRoamIsHandoffInProgress(pMac)) |
| 5812 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5813 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 5814 | csrNeighborRoamIndicateConnect(pMac, (tANI_U8)sessionId, VOS_STATUS_E_FAILURE); |
| 5815 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5816 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5817 | if(pSession->bRefAssocStartCnt > 0) |
| 5818 | { |
| 5819 | pSession->bRefAssocStartCnt--; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5820 | if(eCsrJoinFailureDueToConcurrency == Result) |
| 5821 | { |
| 5822 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5823 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5824 | eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL); |
| 5825 | } |
| 5826 | else |
| 5827 | { |
| 5828 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5829 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5830 | eCSR_ROAM_RESULT_FAILURE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5831 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5832 | } |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5833 | else |
| 5834 | { |
| 5835 | /* bRefAssocStartCnt is not incremented when |
| 5836 | * eRoamState == eCsrStopRoamingDueToConcurrency |
| 5837 | * in csrRoamJoinNextBss API. so handle this in |
| 5838 | * else case by sending assoc failure |
| 5839 | */ |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 5840 | csrRoamCallCallback(pMac, sessionId, &roamInfo, |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5841 | pCommand->u.scanCmd.roamId, |
| 5842 | eCSR_ROAM_ASSOCIATION_FAILURE, |
| 5843 | eCSR_ROAM_RESULT_FAILURE); |
| 5844 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5845 | smsLog(pMac, LOG1, FL(" roam(reason %d) failed"), pCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5846 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Mukul Sharma | 5960ac8 | 2014-01-09 20:31:35 +0530 | [diff] [blame] | 5847 | sme_QosUpdateHandOff((tANI_U8)sessionId, VOS_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5848 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5849 | #endif |
| 5850 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5851 | csrScanStartIdleScan(pMac); |
| 5852 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5853 | //For WDS STA. To fix the issue where the WDS AP side may be too busy by |
| 5854 | //BT activity and not able to recevie WLAN traffic. Retry the join |
| 5855 | if( CSR_IS_WDS_STA(pProfile) ) |
| 5856 | { |
| 5857 | csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD); |
| 5858 | } |
| 5859 | #endif |
| 5860 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5861 | case eCsrHddIssuedReassocToSameAP: |
| 5862 | case eCsrSmeIssuedReassocToSameAP: |
| 5863 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5864 | |
| 5865 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5866 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5867 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5868 | #endif |
| 5869 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5870 | csrScanStartIdleScan(pMac); |
| 5871 | break; |
| 5872 | case eCsrForcedDisassoc: |
| 5873 | case eCsrForcedDeauth: |
| 5874 | case eCsrSmeIssuedIbssJoinFailure: |
| 5875 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5876 | |
| 5877 | if(eCsrSmeIssuedIbssJoinFailure == pCommand->u.roamCmd.roamReason) |
| 5878 | { |
| 5879 | // Notify HDD that IBSS join failed |
| 5880 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 5881 | } |
| 5882 | else |
| 5883 | { |
| 5884 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5885 | pCommand->u.roamCmd.roamId, |
| 5886 | eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5887 | } |
| 5888 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5889 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5890 | #endif |
| 5891 | csrRoamLinkDown(pMac, sessionId); |
Leela Venkata Kiran Kumar Reddy Chirala | 56df73f | 2014-01-30 14:18:00 -0800 | [diff] [blame] | 5892 | /* |
| 5893 | *DelSta not done FW still in conneced state so dont |
| 5894 | *issue IMPS req |
| 5895 | */ |
| 5896 | if (pMac->roam.deauthRspStatus == eSIR_SME_DEAUTH_STATUS) |
| 5897 | { |
| 5898 | smsLog(pMac, LOGW, FL("FW still in connected state ")); |
| 5899 | break; |
| 5900 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5901 | csrScanStartIdleScan(pMac); |
| 5902 | break; |
| 5903 | case eCsrForcedIbssLeave: |
| 5904 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5905 | pCommand->u.roamCmd.roamId, |
| 5906 | eCSR_ROAM_IBSS_LEAVE, |
| 5907 | eCSR_ROAM_RESULT_IBSS_STOP); |
| 5908 | break; |
| 5909 | case eCsrForcedDisassocMICFailure: |
| 5910 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5911 | |
| 5912 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_MIC_FAILURE); |
| 5913 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5914 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 5915 | #endif |
| 5916 | csrScanStartIdleScan(pMac); |
| 5917 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5918 | case eCsrStopBss: |
| 5919 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5920 | pCommand->u.roamCmd.roamId, |
| 5921 | eCSR_ROAM_INFRA_IND, |
| 5922 | eCSR_ROAM_RESULT_INFRA_STOPPED); |
| 5923 | break; |
| 5924 | case eCsrForcedDisassocSta: |
| 5925 | case eCsrForcedDeauthSta: |
| 5926 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId); |
| 5927 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 5928 | { |
| 5929 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | |
| 5931 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 5932 | { |
| 5933 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5934 | vos_mem_copy(roamInfo.peerMac, |
| 5935 | pCommand->u.roamCmd.peerMac, |
| 5936 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5937 | roamInfo.reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 5938 | roamInfo.statusCode = eSIR_SME_SUCCESS; |
| 5939 | status = csrRoamCallCallback(pMac, sessionId, |
| 5940 | &roamInfo, pCommand->u.roamCmd.roamId, |
| 5941 | eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 5942 | } |
| 5943 | } |
| 5944 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5945 | case eCsrLostLink1: |
| 5946 | // if lost link roam1 failed, then issue lost link Scan2 ... |
| 5947 | csrScanRequestLostLink2(pMac, sessionId); |
| 5948 | break; |
| 5949 | case eCsrLostLink2: |
| 5950 | // if lost link roam2 failed, then issue lost link scan3 ... |
| 5951 | csrScanRequestLostLink3(pMac, sessionId); |
| 5952 | break; |
| 5953 | case eCsrLostLink3: |
| 5954 | default: |
| 5955 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5956 | |
| 5957 | //We are done with one round of lostlink roaming here |
| 5958 | csrScanHandleFailedLostlink3(pMac, sessionId); |
| 5959 | break; |
| 5960 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5961 | break; |
| 5962 | } |
| 5963 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5964 | return ( fReleaseCommand ); |
| 5965 | } |
| 5966 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5967 | eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext) |
| 5968 | { |
| 5969 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5970 | return (status); |
| 5971 | } |
| 5972 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5973 | eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile) |
| 5974 | { |
| 5975 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5976 | tANI_U32 size = 0; |
| 5977 | |
| 5978 | do |
| 5979 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5980 | vos_mem_set(pDstProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5981 | if(pSrcProfile->BSSIDs.numOfBSSIDs) |
| 5982 | { |
| 5983 | size = sizeof(tCsrBssid) * pSrcProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5984 | pDstProfile->BSSIDs.bssid = vos_mem_malloc(size); |
| 5985 | if ( NULL == pDstProfile->BSSIDs.bssid ) |
| 5986 | status = eHAL_STATUS_FAILURE; |
| 5987 | else |
| 5988 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5989 | if(!HAL_STATUS_SUCCESS(status)) |
| 5990 | { |
| 5991 | break; |
| 5992 | } |
| 5993 | pDstProfile->BSSIDs.numOfBSSIDs = pSrcProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5994 | vos_mem_copy(pDstProfile->BSSIDs.bssid, |
| 5995 | pSrcProfile->BSSIDs.bssid, size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5996 | } |
| 5997 | if(pSrcProfile->SSIDs.numOfSSIDs) |
| 5998 | { |
| 5999 | size = sizeof(tCsrSSIDInfo) * pSrcProfile->SSIDs.numOfSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6000 | pDstProfile->SSIDs.SSIDList = vos_mem_malloc(size); |
| 6001 | if ( NULL == pDstProfile->SSIDs.SSIDList ) |
| 6002 | status = eHAL_STATUS_FAILURE; |
| 6003 | else |
| 6004 | status = eHAL_STATUS_SUCCESS; |
| 6005 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6006 | { |
| 6007 | break; |
| 6008 | } |
| 6009 | pDstProfile->SSIDs.numOfSSIDs = pSrcProfile->SSIDs.numOfSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6010 | vos_mem_copy(pDstProfile->SSIDs.SSIDList, |
| 6011 | pSrcProfile->SSIDs.SSIDList, size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6012 | } |
| 6013 | if(pSrcProfile->nWPAReqIELength) |
| 6014 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6015 | pDstProfile->pWPAReqIE = vos_mem_malloc(pSrcProfile->nWPAReqIELength); |
| 6016 | if ( NULL == pDstProfile->pWPAReqIE ) |
| 6017 | status = eHAL_STATUS_FAILURE; |
| 6018 | else |
| 6019 | status = eHAL_STATUS_SUCCESS; |
| 6020 | |
| 6021 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6022 | { |
| 6023 | break; |
| 6024 | } |
| 6025 | pDstProfile->nWPAReqIELength = pSrcProfile->nWPAReqIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6026 | vos_mem_copy(pDstProfile->pWPAReqIE, pSrcProfile->pWPAReqIE, |
| 6027 | pSrcProfile->nWPAReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6028 | } |
| 6029 | if(pSrcProfile->nRSNReqIELength) |
| 6030 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6031 | pDstProfile->pRSNReqIE = vos_mem_malloc(pSrcProfile->nRSNReqIELength); |
| 6032 | if ( NULL == pDstProfile->pRSNReqIE ) |
| 6033 | status = eHAL_STATUS_FAILURE; |
| 6034 | else |
| 6035 | status = eHAL_STATUS_SUCCESS; |
| 6036 | |
| 6037 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6038 | { |
| 6039 | break; |
| 6040 | } |
| 6041 | pDstProfile->nRSNReqIELength = pSrcProfile->nRSNReqIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6042 | vos_mem_copy(pDstProfile->pRSNReqIE, pSrcProfile->pRSNReqIE, |
| 6043 | pSrcProfile->nRSNReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6044 | } |
| 6045 | #ifdef FEATURE_WLAN_WAPI |
| 6046 | if(pSrcProfile->nWAPIReqIELength) |
| 6047 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6048 | pDstProfile->pWAPIReqIE = vos_mem_malloc(pSrcProfile->nWAPIReqIELength); |
| 6049 | if ( NULL == pDstProfile->pWAPIReqIE ) |
| 6050 | status = eHAL_STATUS_FAILURE; |
| 6051 | else |
| 6052 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6053 | if(!HAL_STATUS_SUCCESS(status)) |
| 6054 | { |
| 6055 | break; |
| 6056 | } |
| 6057 | pDstProfile->nWAPIReqIELength = pSrcProfile->nWAPIReqIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6058 | vos_mem_copy(pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, |
| 6059 | pSrcProfile->nWAPIReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6060 | } |
| 6061 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6062 | if(pSrcProfile->nAddIEScanLength) |
| 6063 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 6064 | memset(pDstProfile->addIEScan, 0 , SIR_MAC_MAX_IE_LENGTH); |
| 6065 | if ( SIR_MAC_MAX_IE_LENGTH >= pSrcProfile->nAddIEScanLength) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6066 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 6067 | vos_mem_copy(pDstProfile->addIEScan, pSrcProfile->addIEScan, |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6068 | pSrcProfile->nAddIEScanLength); |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 6069 | pDstProfile->nAddIEScanLength = pSrcProfile->nAddIEScanLength; |
| 6070 | } |
| 6071 | else |
| 6072 | { |
| 6073 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 6074 | FL(" AddIEScanLength is not valid %u"), |
| 6075 | pSrcProfile->nAddIEScanLength); |
| 6076 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6077 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6078 | if(pSrcProfile->nAddIEAssocLength) |
| 6079 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6080 | pDstProfile->pAddIEAssoc = vos_mem_malloc(pSrcProfile->nAddIEAssocLength); |
| 6081 | if ( NULL == pDstProfile->pAddIEAssoc ) |
| 6082 | status = eHAL_STATUS_FAILURE; |
| 6083 | else |
| 6084 | status = eHAL_STATUS_SUCCESS; |
| 6085 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6086 | if(!HAL_STATUS_SUCCESS(status)) |
| 6087 | { |
| 6088 | break; |
| 6089 | } |
| 6090 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6091 | vos_mem_copy(pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 6092 | pSrcProfile->nAddIEAssocLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6093 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6094 | if(pSrcProfile->ChannelInfo.ChannelList) |
| 6095 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6096 | pDstProfile->ChannelInfo.ChannelList = vos_mem_malloc( |
| 6097 | pSrcProfile->ChannelInfo.numOfChannels); |
| 6098 | if ( NULL == pDstProfile->ChannelInfo.ChannelList ) |
| 6099 | status = eHAL_STATUS_FAILURE; |
| 6100 | else |
| 6101 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6102 | if(!HAL_STATUS_SUCCESS(status)) |
| 6103 | { |
| 6104 | break; |
| 6105 | } |
| 6106 | pDstProfile->ChannelInfo.numOfChannels = pSrcProfile->ChannelInfo.numOfChannels; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6107 | vos_mem_copy(pDstProfile->ChannelInfo.ChannelList, |
| 6108 | pSrcProfile->ChannelInfo.ChannelList, |
| 6109 | pSrcProfile->ChannelInfo.numOfChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6110 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6111 | pDstProfile->AuthType = pSrcProfile->AuthType; |
| 6112 | pDstProfile->EncryptionType = pSrcProfile->EncryptionType; |
| 6113 | pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType; |
| 6114 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->negotiatedUCEncryptionType; |
| 6115 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->negotiatedMCEncryptionType; |
| 6116 | pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6117 | #ifdef WLAN_FEATURE_11W |
| 6118 | pDstProfile->MFPEnabled = pSrcProfile->MFPEnabled; |
| 6119 | pDstProfile->MFPRequired = pSrcProfile->MFPRequired; |
| 6120 | pDstProfile->MFPCapable = pSrcProfile->MFPCapable; |
| 6121 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6122 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 6123 | pDstProfile->phyMode = pSrcProfile->phyMode; |
| 6124 | pDstProfile->csrPersona = pSrcProfile->csrPersona; |
| 6125 | |
| 6126 | #ifdef FEATURE_WLAN_WAPI |
| 6127 | if(csrIsProfileWapi(pSrcProfile)) |
| 6128 | { |
| 6129 | if(pDstProfile->phyMode & eCSR_DOT11_MODE_11n) |
| 6130 | { |
| 6131 | pDstProfile->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 6132 | } |
| 6133 | } |
| 6134 | #endif /* FEATURE_WLAN_WAPI */ |
| 6135 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 6136 | /*Save the WPS info*/ |
| 6137 | pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 6138 | pDstProfile->bOSENAssociation = pSrcProfile->bOSENAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6139 | pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6140 | pDstProfile->beaconInterval = pSrcProfile->beaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6141 | pDstProfile->privacy = pSrcProfile->privacy; |
| 6142 | pDstProfile->fwdWPSPBCProbeReq = pSrcProfile->fwdWPSPBCProbeReq; |
| 6143 | pDstProfile->csr80211AuthType = pSrcProfile->csr80211AuthType; |
| 6144 | pDstProfile->dtimPeriod = pSrcProfile->dtimPeriod; |
| 6145 | pDstProfile->ApUapsdEnable = pSrcProfile->ApUapsdEnable; |
| 6146 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->SSIDs.SSIDList[0].ssidHidden; |
| 6147 | pDstProfile->protEnabled = pSrcProfile->protEnabled; |
| 6148 | pDstProfile->obssProtEnabled = pSrcProfile->obssProtEnabled; |
| 6149 | pDstProfile->cfg_protection = pSrcProfile->cfg_protection; |
| 6150 | pDstProfile->wps_state = pSrcProfile->wps_state; |
| 6151 | pDstProfile->ieee80211d = pSrcProfile->ieee80211d; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6152 | vos_mem_copy(&pDstProfile->Keys, &pSrcProfile->Keys, |
| 6153 | sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6154 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6155 | if (pSrcProfile->MDID.mdiePresent) |
| 6156 | { |
| 6157 | pDstProfile->MDID.mdiePresent = 1; |
| 6158 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 6159 | } |
| 6160 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6161 | }while(0); |
| 6162 | |
| 6163 | if(!HAL_STATUS_SUCCESS(status)) |
| 6164 | { |
| 6165 | csrReleaseProfile(pMac, pDstProfile); |
| 6166 | pDstProfile = NULL; |
| 6167 | } |
| 6168 | |
| 6169 | return (status); |
| 6170 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6171 | eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile ) |
| 6172 | { |
| 6173 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6174 | tCsrRoamConnectedProfile *pSrcProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 6175 | do |
| 6176 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6177 | vos_mem_set(pDstProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6178 | if(pSrcProfile->bssid) |
| 6179 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6180 | pDstProfile->BSSIDs.bssid = vos_mem_malloc(sizeof(tCsrBssid)); |
| 6181 | if ( NULL == pDstProfile->BSSIDs.bssid ) |
| 6182 | status = eHAL_STATUS_FAILURE; |
| 6183 | else |
| 6184 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6185 | if(!HAL_STATUS_SUCCESS(status)) |
| 6186 | { |
Kiet Lam | 1cc9539 | 2013-11-22 15:59:36 +0530 | [diff] [blame] | 6187 | smsLog( pMac, LOGE, |
| 6188 | FL("failed to allocate memory for BSSID" |
| 6189 | "%02x:%02x:%02x:%02x:%02x:%02x"), |
| 6190 | pSrcProfile->bssid[0], pSrcProfile->bssid[1], pSrcProfile->bssid[2], |
| 6191 | pSrcProfile->bssid[3], pSrcProfile->bssid[4], pSrcProfile->bssid[5]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6192 | break; |
| 6193 | } |
| 6194 | pDstProfile->BSSIDs.numOfBSSIDs = 1; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6195 | vos_mem_copy(pDstProfile->BSSIDs.bssid, pSrcProfile->bssid, |
| 6196 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6197 | } |
| 6198 | if(pSrcProfile->SSID.ssId) |
| 6199 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6200 | pDstProfile->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo)); |
| 6201 | if ( NULL == pDstProfile->SSIDs.SSIDList ) |
| 6202 | status = eHAL_STATUS_FAILURE; |
| 6203 | else |
| 6204 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6205 | if(!HAL_STATUS_SUCCESS(status)) |
| 6206 | { |
Kiet Lam | 1cc9539 | 2013-11-22 15:59:36 +0530 | [diff] [blame] | 6207 | smsLog( pMac, LOGE, |
| 6208 | FL("failed to allocate memory for SSIDList" |
| 6209 | "%02x:%02x:%02x:%02x:%02x:%02x"), |
| 6210 | pSrcProfile->bssid[0], pSrcProfile->bssid[1], pSrcProfile->bssid[2], |
| 6211 | pSrcProfile->bssid[3], pSrcProfile->bssid[4], pSrcProfile->bssid[5]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6212 | break; |
| 6213 | } |
| 6214 | pDstProfile->SSIDs.numOfSSIDs = 1; |
| 6215 | pDstProfile->SSIDs.SSIDList[0].handoffPermitted = pSrcProfile->handoffPermitted; |
| 6216 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->ssidHidden; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6217 | vos_mem_copy(&pDstProfile->SSIDs.SSIDList[0].SSID, |
| 6218 | &pSrcProfile->SSID, sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6219 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6220 | if(pSrcProfile->nAddIEAssocLength) |
| 6221 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6222 | pDstProfile->pAddIEAssoc = vos_mem_malloc(pSrcProfile->nAddIEAssocLength); |
| 6223 | if ( NULL == pDstProfile->pAddIEAssoc) |
| 6224 | status = eHAL_STATUS_FAILURE; |
| 6225 | else |
| 6226 | status = eHAL_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6227 | if(!HAL_STATUS_SUCCESS(status)) |
| 6228 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6229 | smsLog( pMac, LOGE, FL(" failed to allocate memory for additional IEs ") ); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6230 | break; |
| 6231 | } |
| 6232 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6233 | vos_mem_copy(pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 6234 | pSrcProfile->nAddIEAssocLength); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6235 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6236 | pDstProfile->ChannelInfo.ChannelList = vos_mem_malloc(1); |
| 6237 | if ( NULL == pDstProfile->ChannelInfo.ChannelList ) |
| 6238 | status = eHAL_STATUS_FAILURE; |
| 6239 | else |
| 6240 | status = eHAL_STATUS_SUCCESS; |
| 6241 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6242 | if(!HAL_STATUS_SUCCESS(status)) |
| 6243 | { |
| 6244 | break; |
| 6245 | } |
| 6246 | pDstProfile->ChannelInfo.numOfChannels = 1; |
| 6247 | pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6248 | pDstProfile->AuthType.numEntries = 1; |
| 6249 | pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType; |
| 6250 | pDstProfile->negotiatedAuthType = pSrcProfile->AuthType; |
| 6251 | pDstProfile->EncryptionType.numEntries = 1; |
| 6252 | pDstProfile->EncryptionType.encryptionType[0] = pSrcProfile->EncryptionType; |
| 6253 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->EncryptionType; |
| 6254 | pDstProfile->mcEncryptionType.numEntries = 1; |
| 6255 | pDstProfile->mcEncryptionType.encryptionType[0] = pSrcProfile->mcEncryptionType; |
| 6256 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->mcEncryptionType; |
| 6257 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 6258 | pDstProfile->CBMode = pSrcProfile->CBMode; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6259 | vos_mem_copy(&pDstProfile->Keys, &pSrcProfile->Keys, |
| 6260 | sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6261 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6262 | if (pSrcProfile->MDID.mdiePresent) |
| 6263 | { |
| 6264 | pDstProfile->MDID.mdiePresent = 1; |
| 6265 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 6266 | } |
| 6267 | #endif |
| 6268 | |
| 6269 | }while(0); |
| 6270 | |
| 6271 | if(!HAL_STATUS_SUCCESS(status)) |
| 6272 | { |
| 6273 | csrReleaseProfile(pMac, pDstProfile); |
| 6274 | pDstProfile = NULL; |
| 6275 | } |
| 6276 | |
| 6277 | return (status); |
| 6278 | } |
| 6279 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6280 | eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6281 | tScanResultHandle hBSSList, |
| 6282 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate, |
| 6283 | tANI_BOOLEAN fClearScan) |
| 6284 | { |
| 6285 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6286 | tSmeCmd *pCommand; |
| 6287 | |
| 6288 | pCommand = csrGetCommandBuffer(pMac); |
| 6289 | if(NULL == pCommand) |
| 6290 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6291 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6292 | status = eHAL_STATUS_RESOURCES; |
| 6293 | } |
| 6294 | else |
| 6295 | { |
| 6296 | if( fClearScan ) |
| 6297 | { |
| 6298 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6299 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6300 | } |
| 6301 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 6302 | if(NULL == pProfile) |
| 6303 | { |
| 6304 | //We can roam now |
| 6305 | //Since pProfile is NULL, we need to build our own profile, set everything to default |
| 6306 | //We can only support open and no encryption |
| 6307 | pCommand->u.roamCmd.roamProfile.AuthType.numEntries = 1; |
| 6308 | pCommand->u.roamCmd.roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6309 | pCommand->u.roamCmd.roamProfile.EncryptionType.numEntries = 1; |
| 6310 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 6311 | pCommand->u.roamCmd.roamProfile.csrPersona = VOS_STA_MODE; |
| 6312 | } |
| 6313 | else |
| 6314 | { |
| 6315 | //make a copy of the profile |
| 6316 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 6317 | if(HAL_STATUS_SUCCESS(status)) |
| 6318 | { |
| 6319 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 6320 | } |
| 6321 | } |
| 6322 | pCommand->command = eSmeCommandRoam; |
| 6323 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6324 | pCommand->u.roamCmd.hBSSList = hBSSList; |
| 6325 | pCommand->u.roamCmd.roamId = roamId; |
| 6326 | pCommand->u.roamCmd.roamReason = reason; |
| 6327 | //We need to free the BssList when the command is done |
| 6328 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_TRUE; |
| 6329 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6330 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 6331 | FL("CSR PERSONA=%d"), |
| 6332 | pCommand->u.roamCmd.roamProfile.csrPersona); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6333 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 6334 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6335 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6336 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6337 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6338 | } |
| 6339 | } |
| 6340 | |
| 6341 | return (status); |
| 6342 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6343 | eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6344 | tCsrRoamModifyProfileFields *pMmodProfileFields, |
| 6345 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 6346 | { |
| 6347 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6348 | tSmeCmd *pCommand; |
| 6349 | |
| 6350 | pCommand = csrGetCommandBuffer(pMac); |
| 6351 | if(NULL == pCommand) |
| 6352 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6353 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6354 | status = eHAL_STATUS_RESOURCES; |
| 6355 | } |
| 6356 | else |
| 6357 | { |
| 6358 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6359 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6360 | if(pProfile) |
| 6361 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6362 | //This is likely trying to reassoc to different profile |
| 6363 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 6364 | //make a copy of the profile |
| 6365 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 6366 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6367 | } |
| 6368 | else |
| 6369 | { |
| 6370 | status = csrRoamCopyConnectedProfile(pMac, sessionId, &pCommand->u.roamCmd.roamProfile); |
| 6371 | //how to update WPA/WPA2 info in roamProfile?? |
| 6372 | pCommand->u.roamCmd.roamProfile.uapsd_mask = pMmodProfileFields->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6373 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6374 | if(HAL_STATUS_SUCCESS(status)) |
| 6375 | { |
| 6376 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 6377 | } |
| 6378 | pCommand->command = eSmeCommandRoam; |
| 6379 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6380 | pCommand->u.roamCmd.roamId = roamId; |
| 6381 | pCommand->u.roamCmd.roamReason = reason; |
| 6382 | //We need to free the BssList when the command is done |
| 6383 | //For reassoc there is no BSS list, so the boolean set to false |
| 6384 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 6385 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 6386 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6387 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 6388 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6389 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6390 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6391 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 6392 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6393 | } |
| 6394 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6395 | return (status); |
| 6396 | } |
| 6397 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6398 | eHalStatus csrRoamEnqueuePreauth(tpAniSirGlobal pMac, tANI_U32 sessionId, tpSirBssDescription pBssDescription, |
| 6399 | eCsrRoamReason reason, tANI_BOOLEAN fImmediate) |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 6400 | // , eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6401 | { |
| 6402 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6403 | tSmeCmd *pCommand; |
| 6404 | |
| 6405 | pCommand = csrGetCommandBuffer(pMac); |
| 6406 | if(NULL == pCommand) |
| 6407 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6408 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6409 | status = eHAL_STATUS_RESOURCES; |
| 6410 | } |
| 6411 | else |
| 6412 | { |
| 6413 | if(pBssDescription) |
| 6414 | { |
| 6415 | //copy over the parameters we need later |
| 6416 | pCommand->command = eSmeCommandRoam; |
| 6417 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6418 | pCommand->u.roamCmd.roamReason = reason; |
| 6419 | //this is the important parameter |
| 6420 | //in this case we are using this field for the "next" BSS |
| 6421 | pCommand->u.roamCmd.pLastRoamBss = pBssDescription; |
| 6422 | status = csrQueueSmeCommand(pMac, pCommand, fImmediate); |
| 6423 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6424 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6425 | smsLog( pMac, LOGE, FL(" fail to enqueue preauth command, status = %d"), status ); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6426 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 6427 | } |
| 6428 | } |
| 6429 | else |
| 6430 | { |
| 6431 | //Return failure |
| 6432 | status = eHAL_STATUS_RESOURCES; |
| 6433 | } |
| 6434 | } |
| 6435 | return (status); |
| 6436 | } |
| 6437 | |
| 6438 | eHalStatus csrRoamDequeuePreauth(tpAniSirGlobal pMac) |
| 6439 | { |
| 6440 | tListElem *pEntry; |
| 6441 | tSmeCmd *pCommand; |
| 6442 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 6443 | if ( pEntry ) |
| 6444 | { |
| 6445 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 6446 | if ( (eSmeCommandRoam == pCommand->command) && |
| 6447 | (eCsrPerformPreauth == pCommand->u.roamCmd.roamReason)) |
| 6448 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6449 | smsLog( pMac, LOG1, FL("DQ-Command = %d, Reason = %d"), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6450 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 6451 | if (csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK )) { |
| 6452 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 6453 | } |
| 6454 | } else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6455 | smsLog( pMac, LOGE, FL("Command = %d, Reason = %d "), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6456 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 6457 | } |
| 6458 | } |
| 6459 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6460 | smsLog( pMac, LOGE, FL("pEntry NULL for eWNI_SME_FT_PRE_AUTH_RSP")); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6461 | } |
| 6462 | smeProcessPendingQueue( pMac ); |
| 6463 | return eHAL_STATUS_SUCCESS; |
| 6464 | } |
| 6465 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6466 | eHalStatus csrRoamConnectWithBSSList(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6467 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 6468 | { |
| 6469 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6470 | tScanResultHandle hBSSList; |
| 6471 | tANI_U32 roamId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6472 | status = csrScanCopyResultList(pMac, hBssListIn, &hBSSList); |
| 6473 | if(HAL_STATUS_SUCCESS(status)) |
| 6474 | { |
| 6475 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6476 | if(pRoamId) |
| 6477 | { |
| 6478 | *pRoamId = roamId; |
| 6479 | } |
| 6480 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6481 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6482 | if(!HAL_STATUS_SUCCESS(status)) |
| 6483 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6484 | smsLog(pMac, LOGE, FL("failed to start a join process")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6485 | csrScanResultPurge(pMac, hBSSList); |
| 6486 | } |
| 6487 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6488 | return (status); |
| 6489 | } |
| 6490 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6491 | eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6492 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 6493 | { |
| 6494 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6495 | tScanResultHandle hBSSList; |
| 6496 | tCsrScanResultFilter *pScanFilter; |
| 6497 | tANI_U32 roamId = 0; |
| 6498 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_FALSE; |
| 6499 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6500 | if (NULL == pProfile) |
| 6501 | { |
| 6502 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6503 | return eHAL_STATUS_FAILURE; |
| 6504 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6505 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6506 | pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6507 | if( CSR_IS_WDS( pProfile ) && |
| 6508 | !HAL_STATUS_SUCCESS( status = csrIsBTAMPAllowed( pMac, pProfile->operationChannel ) ) ) |
| 6509 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6510 | smsLog(pMac, LOGE, FL("Request for BT AMP connection failed, channel requested is different than infra = %d"), |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6511 | pProfile->operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6512 | return status; |
| 6513 | } |
| 6514 | csrRoamCancelRoaming(pMac, sessionId); |
| 6515 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6516 | csrScanCancelIdleScan(pMac); |
| 6517 | //Only abort the scan if it is not used for other roam/connect purpose |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 6518 | csrScanAbortMacScan(pMac, sessionId, eCSR_SCAN_ABORT_DEFAULT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6519 | if (!vos_concurrent_sessions_running() && (VOS_STA_SAP_MODE == pProfile->csrPersona))//In case of AP mode we do not want idle mode scan |
| 6520 | { |
| 6521 | csrScanDisable(pMac); |
| 6522 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6523 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6524 | //Check whether ssid changes |
| 6525 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6526 | { |
| 6527 | if(pProfile->SSIDs.numOfSSIDs && !csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6528 | { |
| 6529 | csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6530 | } |
| 6531 | } |
| 6532 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6533 | pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; |
| 6534 | #endif |
| 6535 | if(CSR_INVALID_SCANRESULT_HANDLE != hBssListIn) |
| 6536 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6537 | smsLog(pMac, LOG1, FL("is called with BSSList")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6538 | status = csrRoamConnectWithBSSList(pMac, sessionId, pProfile, hBssListIn, pRoamId); |
| 6539 | if(pRoamId) |
| 6540 | { |
| 6541 | roamId = *pRoamId; |
| 6542 | } |
| 6543 | if(!HAL_STATUS_SUCCESS(status)) |
| 6544 | { |
| 6545 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6546 | } |
| 6547 | } |
| 6548 | else |
| 6549 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6550 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 6551 | if ( NULL == pScanFilter ) |
| 6552 | status = eHAL_STATUS_FAILURE; |
| 6553 | else |
| 6554 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6555 | if(HAL_STATUS_SUCCESS(status)) |
| 6556 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6557 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6558 | //Try to connect to any BSS |
| 6559 | if(NULL == pProfile) |
| 6560 | { |
| 6561 | //No encryption |
| 6562 | pScanFilter->EncryptionType.numEntries = 1; |
| 6563 | pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 6564 | }//we don't have a profile |
| 6565 | else |
| 6566 | { |
| 6567 | //Here is the profile we need to connect to |
| 6568 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6569 | }//We have a profile |
| 6570 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6571 | if(pRoamId) |
| 6572 | { |
| 6573 | *pRoamId = roamId; |
| 6574 | } |
| 6575 | |
| 6576 | if(HAL_STATUS_SUCCESS(status)) |
| 6577 | { |
| 6578 | /*Save the WPS info*/ |
| 6579 | if(NULL != pProfile) |
| 6580 | { |
| 6581 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 6582 | pScanFilter->bOSENAssociation = pProfile->bOSENAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6583 | } |
| 6584 | else |
| 6585 | { |
| 6586 | pScanFilter->bWPSAssociation = 0; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 6587 | pScanFilter->bOSENAssociation = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6588 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6589 | do |
| 6590 | { |
| 6591 | if( (pProfile && CSR_IS_WDS_AP( pProfile ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6592 | || (pProfile && CSR_IS_INFRA_AP ( pProfile )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6593 | ) |
| 6594 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6595 | //This can be started right away |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6596 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6597 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6598 | if(!HAL_STATUS_SUCCESS(status)) |
| 6599 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6600 | smsLog(pMac, LOGE, FL(" CSR failed to issue start BSS command with status = 0x%08X"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6601 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6602 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6603 | else |
| 6604 | { |
| 6605 | smsLog(pMac, LOG1, FL("Connect request to proceed for AMP/SoftAP mode")); |
| 6606 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6607 | break; |
| 6608 | } |
| 6609 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6610 | smsLog(pMac, LOG1, "************ csrScanGetResult Status ********* %d", status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6611 | if(HAL_STATUS_SUCCESS(status)) |
| 6612 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6613 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6614 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6615 | if(!HAL_STATUS_SUCCESS(status)) |
| 6616 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6617 | smsLog(pMac, LOGE, FL(" CSR failed to issue connect command with status = 0x%08X"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6618 | csrScanResultPurge(pMac, hBSSList); |
| 6619 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6620 | } |
| 6621 | }//Have scan result |
| 6622 | else if(NULL != pProfile) |
| 6623 | { |
| 6624 | //Check whether it is for start ibss |
| 6625 | if(CSR_IS_START_IBSS(pProfile)) |
| 6626 | { |
| 6627 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6628 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6629 | if(!HAL_STATUS_SUCCESS(status)) |
| 6630 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6631 | smsLog(pMac, LOGE, " CSR failed to issue startIBSS command with status = 0x%08X", status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6632 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6633 | } |
| 6634 | } |
| 6635 | else |
| 6636 | { |
| 6637 | //scan for this SSID |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 6638 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6639 | if(!HAL_STATUS_SUCCESS(status)) |
| 6640 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6641 | smsLog(pMac, LOGE, FL(" CSR failed to issue SSID scan command with status = 0x%08X"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6642 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6643 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6644 | else |
| 6645 | { |
| 6646 | smsLog(pMac, LOG1, FL("SSID scan requested for Infra connect req")); |
| 6647 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6648 | } |
| 6649 | } |
| 6650 | else |
| 6651 | { |
| 6652 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6653 | } |
| 6654 | } while (0); |
| 6655 | if(NULL != pProfile) |
| 6656 | { |
| 6657 | //we need to free memory for filter if profile exists |
| 6658 | csrFreeScanFilter(pMac, pScanFilter); |
| 6659 | } |
| 6660 | }//Got the scan filter from profile |
| 6661 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6662 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6663 | }//allocated memory for pScanFilter |
| 6664 | }//No Bsslist coming in |
| 6665 | //tell the caller if we fail to trigger a join request |
| 6666 | if( fCallCallback ) |
| 6667 | { |
| 6668 | csrRoamCallCallback(pMac, sessionId, NULL, roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6669 | } |
| 6670 | |
| 6671 | return (status); |
| 6672 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6673 | eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6674 | tCsrRoamModifyProfileFields modProfileFields, |
| 6675 | tANI_U32 *pRoamId) |
| 6676 | { |
| 6677 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6678 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_TRUE; |
| 6679 | tANI_U32 roamId = 0; |
| 6680 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6681 | if (NULL == pProfile) |
| 6682 | { |
| 6683 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6684 | return eHAL_STATUS_FAILURE; |
| 6685 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6686 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d"), pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6687 | csrRoamCancelRoaming(pMac, sessionId); |
| 6688 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6689 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6690 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6691 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssuedReassocToSameAP); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6692 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6693 | { |
| 6694 | if(pProfile) |
| 6695 | { |
| 6696 | if(pProfile->SSIDs.numOfSSIDs && |
| 6697 | csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6698 | { |
| 6699 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6700 | } |
| 6701 | else |
| 6702 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6703 | smsLog(pMac, LOG1, FL("Not connected to the same SSID asked in the profile")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6704 | } |
| 6705 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6706 | else if (!vos_mem_compare(&modProfileFields, |
| 6707 | &pSession->connectedProfile.modifyProfileFields, |
| 6708 | sizeof(tCsrRoamModifyProfileFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6709 | { |
| 6710 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6711 | } |
| 6712 | else |
| 6713 | { |
| 6714 | smsLog(pMac, LOG1, FL("Either the profile is NULL or none of the fields " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6715 | "in tCsrRoamModifyProfileFields got modified")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6716 | } |
| 6717 | } |
| 6718 | else |
| 6719 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6720 | smsLog(pMac, LOG1, FL("Not connected! No need to reassoc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6721 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6722 | if(!fCallCallback) |
| 6723 | { |
| 6724 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6725 | if(pRoamId) |
| 6726 | { |
| 6727 | *pRoamId = roamId; |
| 6728 | } |
| 6729 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6730 | status = csrRoamIssueReassoc(pMac, sessionId, pProfile, &modProfileFields, |
| 6731 | eCsrHddIssuedReassocToSameAP, roamId, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6732 | } |
| 6733 | else |
| 6734 | { |
| 6735 | status = csrRoamCallCallback(pMac, sessionId, NULL, roamId, |
| 6736 | eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6737 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6738 | return status; |
| 6739 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6740 | eHalStatus csrRoamJoinLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6741 | { |
| 6742 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6743 | tScanResultHandle hBSSList = NULL; |
| 6744 | tCsrScanResultFilter *pScanFilter = NULL; |
| 6745 | tANI_U32 roamId; |
| 6746 | tCsrRoamProfile *pProfile = NULL; |
| 6747 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6748 | |
| 6749 | if(!pSession) |
| 6750 | { |
| 6751 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6752 | return eHAL_STATUS_FAILURE; |
| 6753 | } |
| 6754 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6755 | do |
| 6756 | { |
| 6757 | if(pSession->pCurRoamProfile) |
| 6758 | { |
| 6759 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6760 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6761 | //We have to make a copy of pCurRoamProfile because it will be free inside csrRoamIssueConnect |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6762 | pProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 6763 | if ( NULL == pProfile ) |
| 6764 | status = eHAL_STATUS_FAILURE; |
| 6765 | else |
| 6766 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6767 | if(!HAL_STATUS_SUCCESS(status)) |
| 6768 | break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6769 | vos_mem_set(pProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6770 | status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6771 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6772 | break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6773 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 6774 | if ( NULL == pScanFilter ) |
| 6775 | status = eHAL_STATUS_FAILURE; |
| 6776 | else |
| 6777 | status = eHAL_STATUS_SUCCESS; |
| 6778 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6779 | if(!HAL_STATUS_SUCCESS(status)) |
| 6780 | { |
| 6781 | break; |
| 6782 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6783 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6784 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6785 | if(!HAL_STATUS_SUCCESS(status)) |
| 6786 | { |
| 6787 | break; |
| 6788 | } |
| 6789 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6790 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 6791 | if(HAL_STATUS_SUCCESS(status)) |
| 6792 | { |
| 6793 | //we want to put the last connected BSS to the very beginning, if possible |
| 6794 | csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList); |
| 6795 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6796 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6797 | if(!HAL_STATUS_SUCCESS(status)) |
| 6798 | { |
| 6799 | csrScanResultPurge(pMac, hBSSList); |
| 6800 | break; |
| 6801 | } |
| 6802 | } |
| 6803 | else |
| 6804 | { |
| 6805 | //Do a scan on this profile |
| 6806 | //scan for this SSID only in case the AP suppresses SSID |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 6807 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6808 | if(!HAL_STATUS_SUCCESS(status)) |
| 6809 | { |
| 6810 | break; |
| 6811 | } |
| 6812 | } |
| 6813 | }//We have a profile |
| 6814 | else |
| 6815 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6816 | smsLog(pMac, LOGW, FL("cannot find a roaming profile")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6817 | break; |
| 6818 | } |
| 6819 | }while(0); |
| 6820 | if(pScanFilter) |
| 6821 | { |
| 6822 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6823 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6824 | } |
| 6825 | if(NULL != pProfile) |
| 6826 | { |
| 6827 | csrReleaseProfile(pMac, pProfile); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6828 | vos_mem_free(pProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6829 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6830 | return (status); |
| 6831 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6832 | eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6833 | { |
| 6834 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6835 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6836 | { |
| 6837 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6838 | if(HAL_STATUS_SUCCESS(status)) |
| 6839 | { |
| 6840 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6841 | } |
| 6842 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6843 | return (status); |
| 6844 | } |
| 6845 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6846 | eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6847 | { |
| 6848 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6849 | smsLog(pMac, LOGW, FL("is called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6850 | csrRoamCancelRoaming(pMac, sessionId); |
| 6851 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6852 | if(csrIsConnStateDisconnected(pMac, sessionId)) |
| 6853 | { |
| 6854 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6855 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6856 | return (status); |
| 6857 | } |
| 6858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6859 | eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure ) |
| 6860 | { |
| 6861 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6862 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
| 6863 | eCsrRoamSubState NewSubstate; |
| 6864 | tANI_U32 sessionId = pCommand->sessionId; |
| 6865 | |
| 6866 | // change state to 'Roaming'... |
| 6867 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 6868 | |
| 6869 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 6870 | { |
| 6871 | // If we are in an IBSS, then stop the IBSS... |
| 6872 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6873 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6874 | } |
| 6875 | else if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6876 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6877 | 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] | 6878 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 6879 | //Restore AC weight in case we change it |
| 6880 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 6881 | // in Infrasturcture, we need to disassociate from the Infrastructure network... |
| 6882 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED; |
| 6883 | if(eCsrSmeIssuedDisassocForHandoff == pCommand->u.roamCmd.roamReason) |
| 6884 | { |
| 6885 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF; |
| 6886 | } |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 6887 | else |
| 6888 | { |
| 6889 | // If we are in neighbor preauth done state then on receiving |
| 6890 | // disassoc or deauth we dont roam instead we just disassoc |
| 6891 | // from current ap and then go to disconnected state |
| 6892 | // This happens for ESE and 11r FT connections ONLY. |
| 6893 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6894 | if (csrRoamIs11rAssoc(pMac) && |
| 6895 | (csrNeighborRoamStatePreauthDone(pMac))) |
| 6896 | { |
| 6897 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 6898 | } |
| 6899 | #endif |
| 6900 | #ifdef FEATURE_WLAN_ESE |
| 6901 | if (csrRoamIsESEAssoc(pMac) && |
| 6902 | (csrNeighborRoamStatePreauthDone(pMac))) |
| 6903 | { |
| 6904 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 6905 | } |
| 6906 | #endif |
| 6907 | #ifdef FEATURE_WLAN_LFR |
| 6908 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && |
| 6909 | (csrNeighborRoamStatePreauthDone(pMac))) |
| 6910 | { |
| 6911 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 6912 | } |
| 6913 | #endif |
| 6914 | } |
| 6915 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6916 | if( fDisassoc ) |
| 6917 | { |
| 6918 | status = csrRoamIssueDisassociate( pMac, sessionId, NewSubstate, fMICFailure ); |
| 6919 | } |
| 6920 | else |
| 6921 | { |
| 6922 | status = csrRoamIssueDeauth( pMac, sessionId, eCSR_ROAM_SUBSTATE_DEAUTH_REQ ); |
| 6923 | } |
| 6924 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6925 | } |
| 6926 | else if ( csrIsConnStateWds( pMac, sessionId ) ) |
| 6927 | { |
| 6928 | if( CSR_IS_WDS_AP( &pMac->roam.roamSession[sessionId].connectedProfile ) ) |
| 6929 | { |
| 6930 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6931 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6932 | } |
| 6933 | //This has to be WDS station |
| 6934 | else if( csrIsConnStateConnectedWds( pMac, sessionId ) ) //This has to be WDS station |
| 6935 | { |
| 6936 | |
| 6937 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 6938 | if( fDisassoc ) |
| 6939 | { |
| 6940 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 6941 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, fMICFailure ); |
| 6942 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6943 | } |
| 6944 | } |
| 6945 | } else { |
| 6946 | // we got a dis-assoc request while not connected to any peer |
| 6947 | // just complete the command |
| 6948 | fComplete = eANI_BOOLEAN_TRUE; |
| 6949 | status = eHAL_STATUS_FAILURE; |
| 6950 | } |
| 6951 | if(fComplete) |
| 6952 | { |
| 6953 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6954 | } |
| 6955 | |
| 6956 | if(HAL_STATUS_SUCCESS(status)) |
| 6957 | { |
| 6958 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6959 | { |
| 6960 | //Set the state to disconnect here |
| 6961 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 6962 | } |
| 6963 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6964 | else |
| 6965 | { |
| 6966 | smsLog(pMac, LOGW, FL(" failed with status %d"), status); |
| 6967 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6968 | return (status); |
| 6969 | } |
| 6970 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6971 | /* This is been removed from latest code base */ |
| 6972 | /* |
| 6973 | static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 6974 | { |
| 6975 | eHalStatus status; |
| 6976 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6977 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING ); |
| 6978 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6979 | return ( status ); |
| 6980 | } |
| 6981 | */ |
| 6982 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6983 | eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason ) |
| 6984 | { |
| 6985 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6986 | tSmeCmd *pCommand; |
| 6987 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6988 | do |
| 6989 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6990 | smsLog( pMac, LOG1, FL(" reason = %d"), reason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6991 | pCommand = csrGetCommandBuffer( pMac ); |
| 6992 | if ( !pCommand ) |
| 6993 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6994 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6995 | status = eHAL_STATUS_RESOURCES; |
| 6996 | break; |
| 6997 | } |
| 6998 | //Change the substate in case it is wait-for-key |
| 6999 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7000 | { |
| 7001 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7002 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 7003 | } |
| 7004 | pCommand->command = eSmeCommandRoam; |
| 7005 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7006 | switch ( reason ) |
| 7007 | { |
| 7008 | case eCSR_DISCONNECT_REASON_MIC_ERROR: |
| 7009 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocMICFailure; |
| 7010 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7011 | case eCSR_DISCONNECT_REASON_DEAUTH: |
| 7012 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauth; |
| 7013 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7014 | case eCSR_DISCONNECT_REASON_HANDOFF: |
| 7015 | fHighPriority = eANI_BOOLEAN_TRUE; |
| 7016 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff; |
| 7017 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7018 | case eCSR_DISCONNECT_REASON_UNSPECIFIED: |
| 7019 | case eCSR_DISCONNECT_REASON_DISASSOC: |
| 7020 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 7021 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7022 | case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE: |
| 7023 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedIbssJoinFailure; |
| 7024 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7025 | case eCSR_DISCONNECT_REASON_IBSS_LEAVE: |
| 7026 | pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave; |
| 7027 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7028 | default: |
| 7029 | break; |
| 7030 | } |
| 7031 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 7032 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7033 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7034 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7035 | csrReleaseCommandRoam( pMac, pCommand ); |
| 7036 | } |
| 7037 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7038 | return( status ); |
| 7039 | } |
| 7040 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7041 | eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority ) |
| 7042 | { |
| 7043 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7044 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7045 | pCommand = csrGetCommandBuffer( pMac ); |
| 7046 | if ( NULL != pCommand ) |
| 7047 | { |
| 7048 | //Change the substate in case it is wait-for-key |
| 7049 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 7050 | { |
| 7051 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7052 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 7053 | } |
| 7054 | pCommand->command = eSmeCommandRoam; |
| 7055 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7056 | pCommand->u.roamCmd.roamReason = eCsrStopBss; |
| 7057 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 7058 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7059 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7060 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7061 | csrReleaseCommandRoam( pMac, pCommand ); |
| 7062 | } |
| 7063 | } |
| 7064 | else |
| 7065 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7066 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7067 | status = eHAL_STATUS_RESOURCES; |
| 7068 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7069 | return ( status ); |
| 7070 | } |
| 7071 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7072 | eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 7073 | { |
| 7074 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7075 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7076 | |
| 7077 | if(!pSession) |
| 7078 | { |
| 7079 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7080 | return eHAL_STATUS_FAILURE; |
| 7081 | } |
| 7082 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7083 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 7084 | //Stop te retry |
| 7085 | pSession->maxRetryCount = 0; |
| 7086 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 7087 | #endif |
| 7088 | //Not to call cancel roaming here |
| 7089 | //Only issue disconnect when necessary |
| 7090 | if(csrIsConnStateConnected(pMac, sessionId) || csrIsBssTypeIBSS(pSession->connectedProfile.BSSType) |
| 7091 | || csrIsBssTypeWDS(pSession->connectedProfile.BSSType) |
| 7092 | || csrIsRoamCommandWaitingForSession(pMac, sessionId) ) |
| 7093 | |
| 7094 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7095 | smsLog(pMac, LOG2, FL("called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7096 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, reason); |
| 7097 | } |
Agarwal Ashish | 8514a4f | 2014-02-10 15:57:06 +0530 | [diff] [blame] | 7098 | else |
| 7099 | { |
| 7100 | smsLog( pMac, LOGE, FL("Roam command is not present")); |
| 7101 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7102 | return (status); |
| 7103 | } |
| 7104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7105 | eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 7106 | { |
| 7107 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7108 | |
| 7109 | if(!pSession) |
| 7110 | { |
| 7111 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7112 | return eHAL_STATUS_FAILURE; |
| 7113 | } |
| 7114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7115 | csrRoamCancelRoaming(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7116 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrForcedDisassoc); |
| 7117 | |
| 7118 | return (csrRoamDisconnectInternal(pMac, sessionId, reason)); |
| 7119 | } |
| 7120 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7121 | eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 7122 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes) |
| 7123 | { |
| 7124 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7125 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 7126 | tANI_U8 index; |
| 7127 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7128 | tCsrRoamConnectedProfile *pConnectProfile = &pSession->connectedProfile; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7129 | |
| 7130 | if(!pSession) |
| 7131 | { |
| 7132 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7133 | return eHAL_STATUS_FAILURE; |
| 7134 | } |
Madan Mohan Koyyalamudi | d02b594 | 2013-07-19 18:35:59 +0800 | [diff] [blame] | 7135 | if(pConnectProfile->pAddIEAssoc) |
| 7136 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7137 | vos_mem_free(pConnectProfile->pAddIEAssoc); |
Madan Mohan Koyyalamudi | d02b594 | 2013-07-19 18:35:59 +0800 | [diff] [blame] | 7138 | pConnectProfile->pAddIEAssoc = NULL; |
| 7139 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7140 | vos_mem_set(&pSession->connectedProfile, sizeof(tCsrRoamConnectedProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7141 | pConnectProfile->AuthType = pProfile->negotiatedAuthType; |
| 7142 | pConnectProfile->AuthInfo = pProfile->AuthType; |
| 7143 | pConnectProfile->CBMode = pProfile->CBMode; //*** this may not be valid |
| 7144 | pConnectProfile->EncryptionType = pProfile->negotiatedUCEncryptionType; |
| 7145 | pConnectProfile->EncryptionInfo = pProfile->EncryptionType; |
| 7146 | pConnectProfile->mcEncryptionType = pProfile->negotiatedMCEncryptionType; |
| 7147 | pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType; |
| 7148 | pConnectProfile->BSSType = pProfile->BSSType; |
| 7149 | pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask; |
| 7150 | pConnectProfile->operationChannel = pSirBssDesc->channelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7151 | pConnectProfile->beaconInterval = pSirBssDesc->beaconInterval; |
AnjaneeDevi Kapparapu | 4b04391 | 2014-02-18 13:22:35 +0530 | [diff] [blame] | 7152 | if (!pConnectProfile->beaconInterval) |
| 7153 | { |
| 7154 | smsLog(pMac, LOGW, FL("ERROR: Beacon interval is ZERO")); |
| 7155 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7156 | vos_mem_copy(&pConnectProfile->Keys, &pProfile->Keys, sizeof(tCsrKeys)); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 7157 | /* saving the addional IE`s like Hot spot indication element and extended capabilities */ |
| 7158 | if(pProfile->nAddIEAssocLength) |
| 7159 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7160 | pConnectProfile->pAddIEAssoc = vos_mem_malloc(pProfile->nAddIEAssocLength); |
| 7161 | if ( NULL == pConnectProfile->pAddIEAssoc ) |
| 7162 | status = eHAL_STATUS_FAILURE; |
| 7163 | else |
| 7164 | status = eHAL_STATUS_SUCCESS; |
| 7165 | if (!HAL_STATUS_SUCCESS(status)) |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 7166 | { |
| 7167 | smsLog(pMac, LOGE, FL("Failed to allocate memory for additional IEs")) ; |
| 7168 | return eHAL_STATUS_FAILURE; |
| 7169 | } |
| 7170 | pConnectProfile->nAddIEAssocLength = pProfile->nAddIEAssocLength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7171 | vos_mem_copy(pConnectProfile->pAddIEAssoc, pProfile->pAddIEAssoc, |
| 7172 | pProfile->nAddIEAssocLength); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 7173 | } |
| 7174 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7175 | //Save bssid |
| 7176 | csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid); |
| 7177 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7178 | if (pSirBssDesc->mdiePresent) |
| 7179 | { |
| 7180 | pConnectProfile->MDID.mdiePresent = 1; |
| 7181 | pConnectProfile->MDID.mobilityDomain = (pSirBssDesc->mdie[1] << 8) | (pSirBssDesc->mdie[0]); |
| 7182 | } |
| 7183 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | d48e327 | 2013-04-12 14:21:07 -0700 | [diff] [blame] | 7184 | if( NULL == pIesTemp ) |
| 7185 | { |
| 7186 | status = csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp); |
| 7187 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7188 | #ifdef FEATURE_WLAN_ESE |
| 7189 | if ((csrIsProfileESE(pProfile) || |
| 7190 | ((pIesTemp->ESEVersion.present) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7191 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 7192 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 7193 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 7194 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7195 | #ifdef WLAN_FEATURE_11W |
| 7196 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 7197 | #endif |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 7198 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7199 | && (pMac->roam.configParam.isEseIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7200 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7201 | pConnectProfile->isESEAssoc = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7202 | } |
| 7203 | #endif |
| 7204 | //save ssid |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7205 | if(HAL_STATUS_SUCCESS(status)) |
| 7206 | { |
| 7207 | if(pIesTemp->SSID.present) |
| 7208 | { |
| 7209 | pConnectProfile->SSID.length = pIesTemp->SSID.num_ssid; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7210 | vos_mem_copy(pConnectProfile->SSID.ssId, pIesTemp->SSID.ssid, |
| 7211 | pIesTemp->SSID.num_ssid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7212 | } |
| 7213 | |
| 7214 | //Save the bss desc |
| 7215 | status = csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 7216 | |
| 7217 | if( CSR_IS_QOS_BSS(pIesTemp) || pIesTemp->HTCaps.present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7218 | { |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 7219 | //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] | 7220 | pConnectProfile->qap = TRUE; |
| 7221 | } |
| 7222 | else |
| 7223 | { |
| 7224 | pConnectProfile->qap = FALSE; |
| 7225 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7226 | if ( NULL == pIes ) |
| 7227 | { |
| 7228 | //Free memory if it allocated locally |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7229 | vos_mem_free(pIesTemp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7230 | } |
| 7231 | } |
| 7232 | //Save Qos connection |
| 7233 | pConnectProfile->qosConnection = pMac->roam.roamSession[sessionId].fWMMConnection; |
| 7234 | |
| 7235 | if(!HAL_STATUS_SUCCESS(status)) |
| 7236 | { |
| 7237 | csrFreeConnectBssDesc(pMac, sessionId); |
| 7238 | } |
| 7239 | for(index = 0; index < pProfile->SSIDs.numOfSSIDs; index++) |
| 7240 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7241 | if ((pProfile->SSIDs.SSIDList[index].SSID.length == pConnectProfile->SSID.length) && |
| 7242 | vos_mem_compare(pProfile->SSIDs.SSIDList[index].SSID.ssId, |
| 7243 | pConnectProfile->SSID.ssId, |
| 7244 | pConnectProfile->SSID.length)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7245 | { |
| 7246 | pConnectProfile->handoffPermitted = pProfile->SSIDs.SSIDList[index].handoffPermitted; |
| 7247 | break; |
| 7248 | } |
| 7249 | pConnectProfile->handoffPermitted = FALSE; |
| 7250 | } |
| 7251 | |
| 7252 | return (status); |
| 7253 | } |
| 7254 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7255 | static void csrRoamJoinRspProcessor( tpAniSirGlobal pMac, tSirSmeJoinRsp *pSmeJoinRsp ) |
| 7256 | { |
| 7257 | tListElem *pEntry = NULL; |
| 7258 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7259 | //The head of the active list is the request we sent |
| 7260 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7261 | if(pEntry) |
| 7262 | { |
| 7263 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7264 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7265 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 7266 | { |
| 7267 | if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason) |
| 7268 | { |
| 7269 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 7270 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 7271 | #endif |
| 7272 | } |
| 7273 | csrRoamComplete( pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp ); |
| 7274 | } |
| 7275 | else |
| 7276 | { |
| 7277 | tANI_U32 roamId = 0; |
| 7278 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7279 | if(!pSession) |
| 7280 | { |
| 7281 | smsLog(pMac, LOGE, FL(" session %d not found "), pSmeJoinRsp->sessionId); |
| 7282 | return; |
| 7283 | } |
| 7284 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7285 | |
| 7286 | //The head of the active list is the request we sent |
| 7287 | //Try to get back the same profile and roam again |
| 7288 | if(pCommand) |
| 7289 | { |
| 7290 | roamId = pCommand->u.roamCmd.roamId; |
| 7291 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7292 | pSession->joinFailStatusCode.statusCode = pSmeJoinRsp->statusCode; |
| 7293 | pSession->joinFailStatusCode.reasonCode = pSmeJoinRsp->protStatusCode; |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 7294 | smsLog( pMac, LOGW, "SmeJoinReq failed with statusCode= 0x%08X [%d]", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7295 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7296 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 7297 | if (csrRoamIsHandoffInProgress(pMac)) |
| 7298 | { |
| 7299 | csrRoamCallCallback(pMac, pSmeJoinRsp->sessionId, NULL, roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 7300 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 7301 | csrNeighborRoamIndicateConnect(pMac, pSmeJoinRsp->sessionId, VOS_STATUS_E_FAILURE); |
| 7302 | } |
| 7303 | #endif |
| 7304 | if (pCommand) |
| 7305 | { |
| 7306 | if(CSR_IS_WDS_STA( &pCommand->u.roamCmd.roamProfile )) |
| 7307 | { |
| 7308 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 7309 | pSession->connectedProfile.BSSType = eCSR_BSS_TYPE_WDS_STA; |
| 7310 | csrRoamReissueRoamCommand(pMac); |
| 7311 | } |
| 7312 | else if( CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) ) |
| 7313 | { |
| 7314 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7315 | } |
| 7316 | else |
| 7317 | { |
| 7318 | csrRoam(pMac, pCommand); |
| 7319 | } |
| 7320 | } |
| 7321 | else |
| 7322 | { |
| 7323 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7324 | } |
| 7325 | } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */ |
| 7326 | } |
| 7327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7328 | eHalStatus csrRoamIssueJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 7329 | tDot11fBeaconIEs *pIes, |
| 7330 | tCsrRoamProfile *pProfile, tANI_U32 roamId ) |
| 7331 | { |
| 7332 | eHalStatus status; |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7333 | smsLog( pMac, LOG1, "Attempting to Join Bssid= "MAC_ADDRESS_STR, |
| 7334 | MAC_ADDR_ARRAY(pSirBssDesc->bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7335 | |
| 7336 | // Set the roaming substate to 'join attempt'... |
| 7337 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7338 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 7339 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7340 | return (status); |
| 7341 | } |
| 7342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7343 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 7344 | tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile) |
| 7345 | { |
| 7346 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7347 | // Set the roaming substate to 'join attempt'... |
| 7348 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId ); |
| 7349 | |
Kaushik, Sushant | 8489f47 | 2014-01-27 11:41:22 +0530 | [diff] [blame] | 7350 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7351 | FL(" calling csrSendJoinReqMsg (eWNI_SME_REASSOC_REQ)")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7352 | |
| 7353 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 7354 | return csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_REASSOC_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7355 | } |
| 7356 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7357 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac) |
| 7358 | { |
| 7359 | tListElem *pEntry; |
| 7360 | tSmeCmd *pCommand; |
| 7361 | tCsrRoamInfo roamInfo; |
| 7362 | tANI_U32 sessionId; |
| 7363 | tCsrRoamSession *pSession; |
| 7364 | |
| 7365 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7366 | if(pEntry) |
| 7367 | { |
| 7368 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7369 | if ( eSmeCommandRoam == pCommand->command ) |
| 7370 | { |
| 7371 | sessionId = pCommand->sessionId; |
| 7372 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7373 | |
| 7374 | if(!pSession) |
| 7375 | { |
| 7376 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7377 | return; |
| 7378 | } |
Abhishek Singh | af15f15 | 2013-11-30 16:08:55 +0530 | [diff] [blame] | 7379 | /* While switching between two AP, csr will reissue roam command again |
| 7380 | to the nextbss if it was interrupted by the dissconnect req for the |
| 7381 | previous bss.During this csr is incrementing bRefAssocStartCnt twice. |
| 7382 | so reset the bRefAssocStartCnt. |
| 7383 | */ |
| 7384 | if(pSession->bRefAssocStartCnt > 0) |
| 7385 | { |
| 7386 | pSession->bRefAssocStartCnt--; |
| 7387 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7388 | if( pCommand->u.roamCmd.fStopWds ) |
| 7389 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7390 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7391 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 7392 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 7393 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7394 | if (CSR_IS_WDS(&pSession->connectedProfile)){ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7395 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 7396 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 7397 | eCSR_ROAM_WDS_IND, |
| 7398 | eCSR_ROAM_RESULT_WDS_DISASSOCIATED); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7399 | }else if (CSR_IS_INFRA_AP(&pSession->connectedProfile)){ |
| 7400 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 7401 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 7402 | eCSR_ROAM_INFRA_IND, |
| 7403 | eCSR_ROAM_RESULT_INFRA_DISASSOCIATED); |
| 7404 | } |
| 7405 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7406 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7407 | if( !HAL_STATUS_SUCCESS( csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ) ) ) |
| 7408 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7409 | smsLog(pMac, LOGE, " Failed to reissue stop_bss command for WDS after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7410 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7411 | } |
| 7412 | } |
| 7413 | else if(eCsrStopRoaming == csrRoamJoinNextBss(pMac, pCommand, eANI_BOOLEAN_TRUE)) |
| 7414 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7415 | smsLog(pMac, LOGW, " Failed to reissue join command after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7416 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7417 | } |
| 7418 | } |
| 7419 | else |
| 7420 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7421 | smsLog(pMac, LOGW, " Command is not roaming after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7422 | } |
| 7423 | } |
| 7424 | else |
| 7425 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7426 | smsLog(pMac, LOGE, " Disassoc rsp cannot continue because no command is available"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7427 | } |
| 7428 | } |
| 7429 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7430 | tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 7431 | { |
| 7432 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7433 | tListElem *pEntry; |
| 7434 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7435 | //alwasy lock active list before locking pending list |
| 7436 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7437 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7438 | if(pEntry) |
| 7439 | { |
| 7440 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7441 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7442 | { |
| 7443 | fRet = eANI_BOOLEAN_TRUE; |
| 7444 | } |
| 7445 | } |
| 7446 | if(eANI_BOOLEAN_FALSE == fRet) |
| 7447 | { |
| 7448 | csrLLLock(&pMac->sme.smeCmdPendingList); |
| 7449 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK); |
| 7450 | while(pEntry) |
| 7451 | { |
| 7452 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7453 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7454 | { |
| 7455 | fRet = eANI_BOOLEAN_TRUE; |
| 7456 | break; |
| 7457 | } |
| 7458 | pEntry = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK); |
| 7459 | } |
| 7460 | csrLLUnlock(&pMac->sme.smeCmdPendingList); |
| 7461 | } |
Agarwal Ashish | 8514a4f | 2014-02-10 15:57:06 +0530 | [diff] [blame] | 7462 | if (eANI_BOOLEAN_FALSE == fRet) |
| 7463 | { |
| 7464 | csrLLLock(&pMac->roam.roamCmdPendingList); |
| 7465 | pEntry = csrLLPeekHead(&pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK); |
| 7466 | while (pEntry) |
| 7467 | { |
| 7468 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7469 | if (( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7470 | { |
| 7471 | fRet = eANI_BOOLEAN_TRUE; |
| 7472 | break; |
| 7473 | } |
| 7474 | pEntry = csrLLNext(&pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK); |
| 7475 | } |
| 7476 | csrLLUnlock(&pMac->roam.roamCmdPendingList); |
| 7477 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7478 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7479 | return (fRet); |
| 7480 | } |
| 7481 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7482 | tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac) |
| 7483 | { |
| 7484 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7485 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7486 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 7487 | { |
| 7488 | if( CSR_IS_SESSION_VALID( pMac, i ) && ( fRet = csrIsRoamCommandWaitingForSession( pMac, i ) ) ) |
| 7489 | { |
| 7490 | break; |
| 7491 | } |
| 7492 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7493 | return ( fRet ); |
| 7494 | } |
| 7495 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7496 | tANI_BOOLEAN csrIsCommandWaiting(tpAniSirGlobal pMac) |
| 7497 | { |
| 7498 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7499 | //alwasy lock active list before locking pending list |
| 7500 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7501 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7502 | if(eANI_BOOLEAN_FALSE == fRet) |
| 7503 | { |
| 7504 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK); |
| 7505 | } |
| 7506 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7507 | return (fRet); |
| 7508 | } |
| 7509 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7510 | tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac ) |
| 7511 | { |
| 7512 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7513 | tListElem *pEntry; |
| 7514 | tCsrCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7515 | //alwasy lock active list before locking pending list |
| 7516 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7517 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7518 | if( pEntry ) |
| 7519 | { |
| 7520 | pCommand = GET_BASE_ADDR(pEntry, tCsrCmd, Link); |
| 7521 | if( ( eCsrRoamCommandScan == pCommand->command ) && |
| 7522 | ( ( eCsrScanForSsid == pCommand->u.scanCmd.reason ) || |
| 7523 | ( eCsrScanForCapsChange == pCommand->u.scanCmd.reason ) || |
| 7524 | ( eCsrScanP2PFindPeer == pCommand->u.scanCmd.reason ) ) ) |
| 7525 | { |
| 7526 | fRet = eANI_BOOLEAN_TRUE; |
| 7527 | } |
| 7528 | } |
| 7529 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7530 | return (fRet); |
| 7531 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7532 | eHalStatus csrRoamIssueReassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 7533 | { |
| 7534 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7535 | tSmeCmd *pCommand = NULL; |
| 7536 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_TRUE; |
| 7537 | tANI_BOOLEAN fRemoveCmd = FALSE; |
| 7538 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7539 | // Delete the old assoc command. All is setup for reassoc to be serialized |
| 7540 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 7541 | if ( pEntry ) |
| 7542 | { |
| 7543 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 7544 | if ( !pCommand ) |
| 7545 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7546 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7547 | return eHAL_STATUS_RESOURCES; |
| 7548 | } |
| 7549 | if ( eSmeCommandRoam == pCommand->command ) |
| 7550 | { |
| 7551 | if (pCommand->u.roamCmd.roamReason == eCsrSmeIssuedAssocToSimilarAP) |
| 7552 | { |
| 7553 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 7554 | } |
| 7555 | else |
| 7556 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7557 | smsLog( pMac, LOGE, FL(" Unexpected active roam command present ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7558 | } |
| 7559 | if (fRemoveCmd == FALSE) |
| 7560 | { |
| 7561 | // Implies we did not get the serialized assoc command we |
| 7562 | // were expecting |
| 7563 | pCommand = NULL; |
| 7564 | } |
| 7565 | } |
| 7566 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7567 | if(NULL == pCommand) |
| 7568 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7569 | smsLog( pMac, LOGE, FL(" fail to get command buffer as expected based on previous connect roam command") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7570 | return eHAL_STATUS_RESOURCES; |
| 7571 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7572 | do |
| 7573 | { |
| 7574 | //Change the substate in case it is wait-for-key |
| 7575 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7576 | { |
| 7577 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7578 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 7579 | } |
| 7580 | pCommand->command = eSmeCommandRoam; |
| 7581 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7582 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedFTReassoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7583 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 7584 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7585 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7586 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7587 | csrReleaseCommandRoam( pMac, pCommand ); |
| 7588 | } |
| 7589 | } while( 0 ); |
| 7590 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7591 | return( status ); |
| 7592 | } |
| 7593 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ) |
| 7594 | { |
| 7595 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7596 | tCsrScanResult *pScanResult = NULL; |
| 7597 | tSirBssDescription *pBssDesc = NULL; |
| 7598 | tSmeCmd *pCommand = NULL; |
| 7599 | tANI_U32 sessionId; |
| 7600 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7601 | if(NULL == pEntry) |
| 7602 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 7603 | smsLog(pMac, LOGE, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7604 | return; |
| 7605 | } |
| 7606 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7607 | sessionId = pCommand->sessionId; |
| 7608 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7609 | |
| 7610 | if(!pSession) |
| 7611 | { |
| 7612 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7613 | return; |
| 7614 | } |
| 7615 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7616 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 7617 | { |
| 7618 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7619 | smsLog(pMac, LOGW, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7620 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 7621 | } |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 7622 | /* If the roaming has stopped, not to continue the roaming command*/ |
| 7623 | else if ( !CSR_IS_ROAMING(pSession) && CSR_IS_ROAMING_COMMAND(pCommand) ) |
| 7624 | { |
| 7625 | //No need to complete roaming here as it already completes |
| 7626 | smsLog(pMac, LOGW, FL(" Roam command (reason %d) aborted due to roaming completed\n"), |
| 7627 | pCommand->u.roamCmd.roamReason); |
| 7628 | csrSetAbortRoamingCommand( pMac, pCommand ); |
| 7629 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 7630 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7631 | else |
| 7632 | { |
| 7633 | if ( CCM_IS_RESULT_SUCCESS(result) ) |
| 7634 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7635 | smsLog(pMac, LOG2, "Cfg sequence complete"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7636 | // Successfully set the configuration parameters for the new Bss. Attempt to |
| 7637 | // join the roaming Bss. |
| 7638 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 7639 | { |
| 7640 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 7641 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 7642 | } |
| 7643 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) || |
| 7644 | CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7645 | || CSR_IS_INFRA_AP(&pCommand->u.roamCmd.roamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7646 | ) |
| 7647 | { |
| 7648 | if(!HAL_STATUS_SUCCESS(csrRoamIssueStartBss( pMac, sessionId, |
| 7649 | &pSession->bssParams, &pCommand->u.roamCmd.roamProfile, |
| 7650 | pBssDesc, pCommand->u.roamCmd.roamId ))) |
| 7651 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 7652 | smsLog(pMac, LOGE, " CSR start BSS failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7653 | //We need to complete the command |
| 7654 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7655 | } |
| 7656 | } |
| 7657 | else |
| 7658 | { |
| 7659 | if (!pCommand->u.roamCmd.pRoamBssEntry) |
| 7660 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 7661 | smsLog(pMac, LOGE, " pRoamBssEntry is NULL"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7662 | //We need to complete the command |
| 7663 | csrRoamComplete(pMac, eCsrJoinFailure, NULL); |
| 7664 | return; |
| 7665 | } |
| 7666 | // If we are roaming TO an Infrastructure BSS... |
| 7667 | VOS_ASSERT(pScanResult != NULL); |
| 7668 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7669 | { |
| 7670 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7671 | if(pIesLocal || (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 7672 | { |
| 7673 | // ..and currently in an Infrastructure connection.... |
| 7674 | if( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 7675 | { |
| 7676 | // ...and the SSIDs are equal, then we Reassoc. |
| 7677 | if ( csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, |
| 7678 | pIesLocal ) ) |
| 7679 | // ..and currently in an infrastructure connection |
| 7680 | { |
| 7681 | // then issue a Reassoc. |
| 7682 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
| 7683 | csrRoamIssueReassociate( pMac, sessionId, pBssDesc, pIesLocal, |
| 7684 | &pCommand->u.roamCmd.roamProfile ); |
| 7685 | } |
| 7686 | else |
| 7687 | { |
| 7688 | |
| 7689 | // otherwise, we have to issue a new Join request to LIM because we disassociated from the |
| 7690 | // previously associated AP. |
| 7691 | if(!HAL_STATUS_SUCCESS(csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7692 | pIesLocal, |
| 7693 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ))) |
| 7694 | { |
| 7695 | //try something else |
| 7696 | csrRoam( pMac, pCommand ); |
| 7697 | } |
| 7698 | } |
| 7699 | } |
| 7700 | else |
| 7701 | { |
| 7702 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7703 | |
| 7704 | /* We need to come with other way to figure out that this is because of HO in BMP |
| 7705 | The below API will be only available for Android as it uses a different HO algorithm */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7706 | /* Reassoc request will be used only for ESE and 11r handoff whereas other legacy roaming should |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7707 | * use join request */ |
| 7708 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7709 | if (csrRoamIsHandoffInProgress(pMac) && |
| 7710 | csrRoamIs11rAssoc(pMac)) |
| 7711 | { |
| 7712 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 7713 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 7714 | } |
| 7715 | else |
| 7716 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7717 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7718 | if (csrRoamIsHandoffInProgress(pMac) && |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7719 | csrRoamIsESEAssoc(pMac)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7720 | { |
| 7721 | // Now serialize the reassoc command. |
| 7722 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7723 | } |
| 7724 | else |
| 7725 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7726 | #ifdef FEATURE_WLAN_LFR |
| 7727 | if (csrRoamIsHandoffInProgress(pMac) && |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 7728 | csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7729 | { |
| 7730 | // Now serialize the reassoc command. |
| 7731 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7732 | } |
| 7733 | else |
| 7734 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7735 | // else we are not connected and attempting to Join. Issue the |
| 7736 | // Join request. |
| 7737 | { |
| 7738 | status = csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7739 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), |
| 7740 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ); |
| 7741 | } |
| 7742 | if(!HAL_STATUS_SUCCESS(status)) |
| 7743 | { |
| 7744 | //try something else |
| 7745 | csrRoam( pMac, pCommand ); |
| 7746 | } |
| 7747 | } |
| 7748 | if( !pScanResult->Result.pvIes ) |
| 7749 | { |
| 7750 | //Locally allocated |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7751 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7752 | } |
| 7753 | } |
| 7754 | }//if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7755 | else |
| 7756 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7757 | smsLog(pMac, LOGW, FL(" found BSSType mismatching the one in BSS description")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7758 | } |
| 7759 | }//else |
| 7760 | }//if ( WNI_CFG_SUCCESS == result ) |
| 7761 | else |
| 7762 | { |
| 7763 | // In the event the configuration failed, for infra let the roam processor |
| 7764 | //attempt to join something else... |
| 7765 | if( pCommand->u.roamCmd.pRoamBssEntry && CSR_IS_INFRASTRUCTURE( &pCommand->u.roamCmd.roamProfile ) ) |
| 7766 | { |
| 7767 | csrRoam(pMac, pCommand); |
| 7768 | } |
| 7769 | else |
| 7770 | { |
| 7771 | //We need to complete the command |
| 7772 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) ) |
| 7773 | { |
| 7774 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7775 | } |
| 7776 | else |
| 7777 | { |
| 7778 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7779 | } |
| 7780 | } |
| 7781 | } |
| 7782 | }//we have active entry |
| 7783 | } |
| 7784 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7785 | static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp ) |
| 7786 | { |
| 7787 | //No one is sending eWNI_SME_AUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7788 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7789 | if ( eSIR_SME_SUCCESS == pSmeAuthRsp->statusCode ) |
| 7790 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7791 | smsLog( pMac, LOGW, "CSR SmeAuthReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7792 | // Successfully authenticated with a new Bss. Attempt to stop the current Bss and |
| 7793 | // join the new one... |
| 7794 | /***pBssDesc = profGetRoamingBssDesc( pAdapter, &pHddProfile ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7795 | roamStopNetwork( pAdapter, &pBssDesc->SirBssDescription );***/ |
| 7796 | } |
| 7797 | else { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 7798 | smsLog( pMac, LOGW, "CSR SmeAuthReq failed with statusCode= 0x%08X [%d]", pSmeAuthRsp->statusCode, pSmeAuthRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7799 | /***profHandleLostLinkAfterReset(pAdapter); |
| 7800 | // In the event the authenticate fails, let the roam processor attempt to join something else... |
| 7801 | roamRoam( pAdapter );***/ |
| 7802 | } |
| 7803 | } |
| 7804 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7805 | static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSmeJoinRsp pSmeJoinRsp ) |
| 7806 | { |
| 7807 | eCsrRoamCompleteResult result; |
| 7808 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 7809 | tCsrRoamInfo roamInfo; |
| 7810 | tANI_U32 roamId = 0; |
| 7811 | |
| 7812 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 7813 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7814 | smsLog( pMac, LOGW, "CSR SmeReassocReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7815 | result = eCsrReassocSuccess; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7816 | /* Defeaturize this part later if needed */ |
| 7817 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7818 | /* Since the neighbor roam algorithm uses reassoc req for handoff instead of join, |
| 7819 | * we need the response contents while processing the result in csrRoamProcessResults() */ |
| 7820 | if (csrRoamIsHandoffInProgress(pMac)) |
| 7821 | { |
| 7822 | /* Need to dig more on indicating events to SME QoS module */ |
| 7823 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 7824 | csrRoamComplete( pMac, result, pSmeJoinRsp); |
| 7825 | } |
| 7826 | else |
| 7827 | #endif |
| 7828 | { |
| 7829 | csrRoamComplete( pMac, result, NULL ); |
| 7830 | } |
| 7831 | } |
| 7832 | /* Should we handle this similar to handling the join failure? Is it ok |
| 7833 | * to call csrRoamComplete() with state as CsrJoinFailure */ |
| 7834 | else |
| 7835 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 7836 | smsLog( pMac, LOGW, "CSR SmeReassocReq failed with statusCode= 0x%08X [%d]", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7837 | result = eCsrReassocFailure; |
| 7838 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7839 | if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) || |
| 7840 | (eSIR_SME_FT_REASSOC_FAILURE == pSmeJoinRsp->statusCode)) |
| 7841 | { |
| 7842 | // Inform HDD to turn off FT flag in HDD |
| 7843 | if (pNeighborRoamInfo) |
| 7844 | { |
| 7845 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7846 | csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, |
| 7847 | &roamInfo, roamId, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
Madan Mohan Koyyalamudi | 5777216 | 2012-10-18 19:46:14 -0700 | [diff] [blame] | 7848 | /* |
| 7849 | * Since the above callback sends a disconnect |
| 7850 | * to HDD, we should clean-up our state |
| 7851 | * machine as well to be in sync with the upper |
| 7852 | * layers. There is no need to send a disassoc |
| 7853 | * since: 1) we will never reassoc to the current |
| 7854 | * AP in LFR, and 2) there is no need to issue a |
| 7855 | * disassoc to the AP with which we were trying |
| 7856 | * to reassoc. |
| 7857 | */ |
| 7858 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7859 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7860 | } |
| 7861 | } |
| 7862 | #endif |
| 7863 | // In the event that the Reassociation fails, then we need to Disassociate the current association and keep |
| 7864 | // roaming. Note that we will attempt to Join the AP instead of a Reassoc since we may have attempted a |
| 7865 | // 'Reassoc to self', which AP's that don't support Reassoc will force a Disassoc. |
| 7866 | //The disassoc rsp message will remove the command from active list |
| 7867 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, pSmeJoinRsp->sessionId, |
| 7868 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE ))) |
| 7869 | { |
| 7870 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7871 | } |
| 7872 | } |
| 7873 | } |
| 7874 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7875 | static void csrRoamRoamingStateStopBssRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSmeRsp) |
| 7876 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7877 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7878 | { |
| 7879 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7880 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 7881 | if(pIbssLog) |
| 7882 | { |
| 7883 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_RSP; |
| 7884 | if(eSIR_SME_SUCCESS != pSmeRsp->statusCode) |
| 7885 | { |
| 7886 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 7887 | } |
| 7888 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 7889 | } |
| 7890 | } |
| 7891 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7892 | pMac->roam.roamSession[pSmeRsp->sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7893 | if(CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, pSmeRsp->sessionId)) |
| 7894 | { |
| 7895 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7896 | } |
| 7897 | else if(CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId)) |
| 7898 | { |
| 7899 | csrRoamReissueRoamCommand(pMac); |
| 7900 | } |
| 7901 | } |
| 7902 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7903 | void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeRsp ) |
| 7904 | { |
| 7905 | tSirResultCodes statusCode; |
| 7906 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7907 | tScanResultHandle hBSSList; |
| 7908 | tANI_BOOLEAN fCallCallback, fRemoveCmd; |
| 7909 | eHalStatus status; |
| 7910 | tCsrRoamInfo roamInfo; |
| 7911 | tCsrScanResultFilter *pScanFilter = NULL; |
| 7912 | tANI_U32 roamId = 0; |
| 7913 | tCsrRoamProfile *pCurRoamProfile = NULL; |
| 7914 | tListElem *pEntry = NULL; |
| 7915 | tSmeCmd *pCommand = NULL; |
| 7916 | #endif |
| 7917 | tANI_U32 sessionId; |
| 7918 | tCsrRoamSession *pSession; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7919 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7920 | tSirSmeDisassocRsp SmeDisassocRsp; |
| 7921 | |
| 7922 | csrSerDesUnpackDiassocRsp((tANI_U8 *)pSmeRsp, &SmeDisassocRsp); |
| 7923 | sessionId = SmeDisassocRsp.sessionId; |
| 7924 | statusCode = SmeDisassocRsp.statusCode; |
| 7925 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7926 | smsLog( pMac, LOG2, "csrRoamRoamingStateDisassocRspProcessor sessionId %d", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7927 | |
| 7928 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 7929 | { |
| 7930 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7931 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7932 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7933 | |
| 7934 | if(!pSession) |
| 7935 | { |
| 7936 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7937 | return; |
| 7938 | } |
| 7939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7940 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) ) |
| 7941 | { |
| 7942 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7943 | } |
| 7944 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, sessionId ) || |
| 7945 | CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, sessionId ) ) |
| 7946 | { |
| 7947 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7948 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7949 | smsLog( pMac, LOG2, "CSR SmeDisassocReq force disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7950 | //A callback to HDD will be issued from csrRoamComplete so no need to do anything here |
| 7951 | } |
| 7952 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7953 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7954 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId ) ) |
| 7955 | { |
Kaushik, Sushant | 8489f47 | 2014-01-27 11:41:22 +0530 | [diff] [blame] | 7956 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7957 | "CSR SmeDisassocReq due to HO on session %d", sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7958 | #if defined (WLAN_FEATURE_NEIGHBOR_ROAMING) |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7959 | /* |
| 7960 | * First ensure if the roam profile is in the scan cache. |
| 7961 | * If not, post a reassoc failure and disconnect. |
| 7962 | */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7963 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 7964 | if ( NULL == pScanFilter ) |
| 7965 | status = eHAL_STATUS_FAILURE; |
| 7966 | else |
| 7967 | status = eHAL_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7968 | if(HAL_STATUS_SUCCESS(status)) |
| 7969 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7970 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7971 | status = csrRoamPrepareFilterFromProfile(pMac, |
| 7972 | &pMac->roam.neighborRoamInfo.csrNeighborRoamProfile, pScanFilter); |
| 7973 | if(!HAL_STATUS_SUCCESS(status)) |
| 7974 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7975 | smsLog(pMac, LOGE, "%s: failed to prepare scan filter with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7976 | __func__, status); |
| 7977 | goto POST_ROAM_FAILURE; |
| 7978 | } |
| 7979 | else |
| 7980 | { |
| 7981 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 7982 | if (!HAL_STATUS_SUCCESS(status)) |
| 7983 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7984 | smsLog( pMac, LOGE,"%s: csrScanGetResult failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7985 | __func__, status); |
| 7986 | goto POST_ROAM_FAILURE; |
| 7987 | } |
| 7988 | } |
| 7989 | } |
| 7990 | else |
| 7991 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7992 | smsLog( pMac, LOGE,"%s: alloc for pScanFilter failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7993 | __func__, status); |
| 7994 | goto POST_ROAM_FAILURE; |
| 7995 | } |
| 7996 | |
| 7997 | /* |
| 7998 | * After ensuring that the roam profile is in the scan result list, |
| 7999 | * dequeue the command from the active list. |
| 8000 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8001 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 8002 | if ( pEntry ) |
| 8003 | { |
| 8004 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8005 | /* If the head of the queue is Active and it is a ROAM command, remove |
| 8006 | * and put this on the Free queue. |
| 8007 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8008 | if ( eSmeCommandRoam == pCommand->command ) |
| 8009 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8010 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8011 | /* |
| 8012 | * we need to process the result first before removing it from active list |
| 8013 | * because state changes still happening insides roamQProcessRoamResults so |
| 8014 | * no other roam command should be issued. |
| 8015 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8016 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 8017 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 8018 | { |
| 8019 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 8020 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 8021 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8022 | if( fRemoveCmd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8023 | csrReleaseCommandRoam( pMac, pCommand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8024 | else |
| 8025 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8026 | smsLog( pMac, LOGE, "%s: fail to remove cmd reason %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8027 | __func__, pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8028 | } |
| 8029 | } |
| 8030 | else |
| 8031 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8032 | smsLog( pMac, LOGE, "%s: roam command not active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8033 | } |
| 8034 | } |
| 8035 | else |
| 8036 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8037 | smsLog( pMac, LOGE, "%s: NO commands are active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8038 | } |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8039 | |
| 8040 | /* Notify HDD about handoff and provide the BSSID too */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8041 | roamInfo.reasonCode = eCsrRoamReasonBetterAP; |
| 8042 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8043 | vos_mem_copy(roamInfo.bssid, |
| 8044 | pMac->roam.neighborRoamInfo.csrNeighborRoamProfile.BSSIDs.bssid, |
| 8045 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8046 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8047 | csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, |
| 8048 | eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8049 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8050 | /* Copy the connected profile to apply the same for this connection as well */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8051 | pCurRoamProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 8052 | if ( pCurRoamProfile != NULL ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8053 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8054 | vos_mem_set(pCurRoamProfile, sizeof(tCsrRoamProfile), 0); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8055 | csrRoamCopyProfile(pMac, pCurRoamProfile, pSession->pCurRoamProfile); |
| 8056 | //make sure to put it at the head of the cmd queue |
| 8057 | status = csrRoamIssueConnect(pMac, sessionId, pCurRoamProfile, |
| 8058 | hBSSList, eCsrSmeIssuedAssocToSimilarAP, |
| 8059 | roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE); |
| 8060 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8061 | if(!HAL_STATUS_SUCCESS(status)) |
| 8062 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8063 | smsLog( pMac, LOGE,"%s: csrRoamIssueConnect failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8064 | __func__, status); |
| 8065 | fCallCallback = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8066 | } |
| 8067 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8068 | /* Notify sub-modules like QoS etc. that handoff happening */ |
| 8069 | sme_QosCsrEventInd(pMac, sessionId, SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 8070 | csrReleaseProfile(pMac, pCurRoamProfile); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8071 | vos_mem_free(pCurRoamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8072 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8073 | vos_mem_free(pScanFilter); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8074 | return; |
| 8075 | } |
| 8076 | |
| 8077 | POST_ROAM_FAILURE: |
| 8078 | if (pScanFilter) |
| 8079 | { |
| 8080 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8081 | vos_mem_free(pScanFilter); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8082 | } |
| 8083 | if (pCurRoamProfile) |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8084 | vos_mem_free(pCurRoamProfile); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8085 | |
| 8086 | /* Inform the upper layers that the reassoc failed */ |
| 8087 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 8088 | csrRoamCallCallback(pMac, sessionId, |
| 8089 | &roamInfo, 0, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
| 8090 | |
| 8091 | /* |
| 8092 | * Issue a disassoc request so that PE/LIM uses this to clean-up the FT session. |
| 8093 | * Upon success, we would re-enter this routine after receiving the disassoc |
| 8094 | * response and will fall into the reassoc fail sub-state. And, eventually |
| 8095 | * call csrRoamComplete which would remove the roam command from SME active |
| 8096 | * queue. |
| 8097 | */ |
| 8098 | if (!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate(pMac, sessionId, |
| 8099 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE))) |
| 8100 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8101 | smsLog( pMac, LOGE,"%s: csrRoamIssueDisassociate failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8102 | __func__, status); |
| 8103 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8104 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8105 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8106 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8107 | } //else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) ) |
| 8108 | else if ( CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, sessionId ) ) |
| 8109 | { |
| 8110 | // Disassoc due to Reassoc failure falls into this codepath.... |
| 8111 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 8112 | } |
| 8113 | else |
| 8114 | { |
| 8115 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 8116 | { |
| 8117 | // Successfully disassociated from the 'old' Bss... |
| 8118 | // |
| 8119 | // We get Disassociate response in three conditions. |
| 8120 | // - First is the case where we are disasociating from an Infra Bss to start an IBSS. |
| 8121 | // - Second is the when we are disassociating from an Infra Bss to join an IBSS or a new |
| 8122 | // Infrastructure network. |
| 8123 | // - Third is where we are doing an Infra to Infra roam between networks with different |
| 8124 | // SSIDs. In all cases, we set the new Bss configuration here and attempt to join |
| 8125 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8126 | smsLog( pMac, LOG2, "CSR SmeDisassocReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8127 | } |
| 8128 | else |
| 8129 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 8130 | smsLog( pMac, LOGE, "SmeDisassocReq failed with statusCode= 0x%08X", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8131 | } |
| 8132 | //We are not done yet. Get the data and continue roaming |
| 8133 | csrRoamReissueRoamCommand(pMac); |
| 8134 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8135 | } |
| 8136 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8137 | static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp ) |
| 8138 | { |
| 8139 | tSirResultCodes statusCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8140 | //No one is sending eWNI_SME_DEAUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8141 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8142 | statusCode = csrGetDeAuthRspStatusCode( pSmeRsp ); |
Leela Venkata Kiran Kumar Reddy Chirala | 56df73f | 2014-01-30 14:18:00 -0800 | [diff] [blame] | 8143 | pMac->roam.deauthRspStatus = statusCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8144 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 8145 | { |
| 8146 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 8147 | } |
| 8148 | else |
| 8149 | { |
| 8150 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 8151 | { |
| 8152 | // Successfully deauth from the 'old' Bss... |
| 8153 | // |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8154 | smsLog( pMac, LOG2, "CSR SmeDeauthReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8155 | } |
| 8156 | else |
| 8157 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 8158 | smsLog( pMac, LOGW, "SmeDeauthReq failed with statusCode= 0x%08X", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8159 | } |
| 8160 | //We are not done yet. Get the data and continue roaming |
| 8161 | csrRoamReissueRoamCommand(pMac); |
| 8162 | } |
| 8163 | } |
| 8164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8165 | static void csrRoamRoamingStateStartBssRspProcessor( tpAniSirGlobal pMac, tSirSmeStartBssRsp *pSmeStartBssRsp ) |
| 8166 | { |
| 8167 | eCsrRoamCompleteResult result; |
| 8168 | |
| 8169 | if ( eSIR_SME_SUCCESS == pSmeStartBssRsp->statusCode ) |
| 8170 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8171 | smsLog( pMac, LOGW, "SmeStartBssReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8172 | result = eCsrStartBssSuccess; |
| 8173 | } |
| 8174 | else |
| 8175 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 8176 | smsLog( pMac, LOGW, "SmeStartBssReq failed with statusCode= 0x%08X", pSmeStartBssRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8177 | //Let csrRoamComplete decide what to do |
| 8178 | result = eCsrStartBssFailure; |
| 8179 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8180 | csrRoamComplete( pMac, result, pSmeStartBssRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8181 | } |
| 8182 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8183 | /* |
| 8184 | We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of strucutres. |
| 8185 | It depends on how the message is constructed. If the message is sent by limSendSmeRsp, |
| 8186 | the pMsgBuf is only a generic response and can only be used as pointer to tSirSmeRsp. |
| 8187 | For the messages where sender allocates memory for specific structures, then it can be |
| 8188 | cast accordingly. |
| 8189 | */ |
| 8190 | void csrRoamingStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 8191 | { |
| 8192 | tSirSmeRsp *pSmeRsp; |
| 8193 | tSmeIbssPeerInd *pIbssPeerInd; |
| 8194 | tCsrRoamInfo roamInfo; |
| 8195 | // TODO Session Id need to be acquired in this function |
| 8196 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8197 | pSmeRsp = (tSirSmeRsp *)pMsgBuf; |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 8198 | smsLog(pMac, LOG2, FL("Message %d[0x%04X] received in substate %s"), |
| 8199 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 8200 | macTraceGetcsrRoamSubState( |
| 8201 | pMac->roam.curSubState[pSmeRsp->sessionId])); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8202 | pSmeRsp->messageType = (pSmeRsp->messageType); |
| 8203 | pSmeRsp->length = (pSmeRsp->length); |
| 8204 | pSmeRsp->statusCode = (pSmeRsp->statusCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8205 | switch (pSmeRsp->messageType) |
| 8206 | { |
| 8207 | |
| 8208 | case eWNI_SME_JOIN_RSP: // in Roaming state, process the Join response message... |
| 8209 | if (CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, pSmeRsp->sessionId)) |
| 8210 | { |
| 8211 | //We sent a JOIN_REQ |
| 8212 | csrRoamJoinRspProcessor( pMac, (tSirSmeJoinRsp *)pSmeRsp ); |
| 8213 | } |
| 8214 | break; |
| 8215 | |
| 8216 | case eWNI_SME_AUTH_RSP: // or the Authenticate response message... |
| 8217 | if (CSR_IS_ROAM_SUBSTATE_AUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 8218 | { |
| 8219 | //We sent a AUTH_REQ |
| 8220 | csrRoamRoamingStateAuthRspProcessor( pMac, (tSirSmeAuthRsp *)pSmeRsp ); |
| 8221 | } |
| 8222 | break; |
| 8223 | |
| 8224 | case eWNI_SME_REASSOC_RSP: // or the Reassociation response message... |
| 8225 | if (CSR_IS_ROAM_SUBSTATE_REASSOC_REQ( pMac, pSmeRsp->sessionId) ) |
| 8226 | { |
| 8227 | csrRoamRoamingStateReassocRspProcessor( pMac, (tpSirSmeJoinRsp )pSmeRsp ); |
| 8228 | } |
| 8229 | break; |
| 8230 | |
| 8231 | case eWNI_SME_STOP_BSS_RSP: // or the Stop Bss response message... |
| 8232 | { |
| 8233 | csrRoamRoamingStateStopBssRspProcessor(pMac, pSmeRsp); |
| 8234 | } |
| 8235 | break; |
| 8236 | |
| 8237 | case eWNI_SME_DISASSOC_RSP: // or the Disassociate response message... |
| 8238 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, pSmeRsp->sessionId ) || |
| 8239 | CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, pSmeRsp->sessionId ) || |
| 8240 | CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, pSmeRsp->sessionId ) || |
| 8241 | CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, pSmeRsp->sessionId ) || |
| 8242 | CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId ) || |
| 8243 | //HO |
| 8244 | CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, pSmeRsp->sessionId ) ) |
| 8245 | { |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 8246 | smsLog(pMac, LOG1, FL("eWNI_SME_DISASSOC_RSP subState = %s"), |
| 8247 | macTraceGetcsrRoamSubState( |
| 8248 | pMac->roam.curSubState[pSmeRsp->sessionId])); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8249 | csrRoamRoamingStateDisassocRspProcessor( pMac, (tSirSmeDisassocRsp *)pSmeRsp ); |
| 8250 | } |
| 8251 | break; |
| 8252 | |
| 8253 | case eWNI_SME_DEAUTH_RSP: // or the Deauthentication response message... |
| 8254 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId ) ) |
| 8255 | { |
| 8256 | csrRoamRoamingStateDeauthRspProcessor( pMac, (tSirSmeDeauthRsp *)pSmeRsp ); |
| 8257 | } |
| 8258 | break; |
| 8259 | |
| 8260 | case eWNI_SME_START_BSS_RSP: // or the Start BSS response message... |
| 8261 | if (CSR_IS_ROAM_SUBSTATE_START_BSS_REQ( pMac, pSmeRsp->sessionId ) ) |
| 8262 | { |
| 8263 | csrRoamRoamingStateStartBssRspProcessor( pMac, (tSirSmeStartBssRsp *)pSmeRsp ); |
| 8264 | } |
| 8265 | break; |
| 8266 | |
| 8267 | case WNI_CFG_SET_CNF: // process the Config Confirm messages when we are in 'Config' substate... |
| 8268 | if ( CSR_IS_ROAM_SUBSTATE_CONFIG( pMac, pSmeRsp->sessionId ) ) |
| 8269 | { |
| 8270 | csrRoamingStateConfigCnfProcessor( pMac, ((tCsrCfgSetRsp *)pSmeRsp)->respStatus ); |
| 8271 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8272 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8273 | //In case CSR issues STOP_BSS, we need to tell HDD about peer departed becasue PE is removing them |
| 8274 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 8275 | pIbssPeerInd = (tSmeIbssPeerInd*)pSmeRsp; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8276 | smsLog(pMac, LOGE, "CSR: Peer departed notification from LIM in joining state"); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8277 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
| 8278 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8279 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 8280 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8281 | vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, |
| 8282 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8283 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 8284 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 8285 | eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 8286 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8287 | default: |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 8288 | smsLog(pMac, LOG1, |
| 8289 | FL("Unexpected message type = %d[0x%X] received in substate %s"), |
| 8290 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 8291 | macTraceGetcsrRoamSubState( |
| 8292 | pMac->roam.curSubState[pSmeRsp->sessionId])); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8293 | |
| 8294 | //If we are connected, check the link status change |
| 8295 | if(!csrIsConnStateDisconnected(pMac, sessionId)) |
| 8296 | { |
| 8297 | csrRoamCheckForLinkStatusChange( pMac, pSmeRsp ); |
| 8298 | } |
| 8299 | break; |
| 8300 | } |
| 8301 | } |
| 8302 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8303 | void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 8304 | { |
| 8305 | tSirSmeRsp *pSirMsg = (tSirSmeRsp *)pMsgBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8306 | switch (pSirMsg->messageType) |
| 8307 | { |
| 8308 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8309 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8310 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 8311 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8312 | case eWNI_SME_UPPER_LAYER_ASSOC_CNF: |
| 8313 | { |
| 8314 | tCsrRoamSession *pSession; |
| 8315 | tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf; |
| 8316 | tCsrRoamInfo roamInfo; |
| 8317 | tCsrRoamInfo *pRoamInfo = NULL; |
| 8318 | tANI_U32 sessionId; |
| 8319 | eHalStatus status; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8320 | smsLog( pMac, LOG1, FL("ASSOCIATION confirmation can be given to upper layer ")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8321 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8322 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8323 | pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf; |
| 8324 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId ); |
| 8325 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8326 | |
| 8327 | if(!pSession) |
| 8328 | { |
| 8329 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8330 | return; |
| 8331 | } |
| 8332 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8333 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 8334 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8335 | pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid; |
| 8336 | pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length; |
| 8337 | pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8338 | pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length; |
| 8339 | pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8340 | vos_mem_copy(pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, |
| 8341 | sizeof(tSirMacAddr)); |
| 8342 | vos_mem_copy(&pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, |
| 8343 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8344 | pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8345 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) ) |
| 8346 | { |
| 8347 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED; |
| 8348 | pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq; |
| 8349 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 8350 | } |
| 8351 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 8352 | { |
| 8353 | vos_sleep( 100 ); |
| 8354 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta |
| 8355 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
| 8356 | } |
| 8357 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8358 | } |
| 8359 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8360 | default: |
| 8361 | csrRoamCheckForLinkStatusChange( pMac, pSirMsg ); |
| 8362 | break; |
| 8363 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8364 | } |
| 8365 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8366 | eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, |
| 8367 | tSirBssDescription *pBssDescription, |
| 8368 | tSirMacAddr *bssId, tANI_BOOLEAN addKey, |
| 8369 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 8370 | tANI_U8 keyId, tANI_U16 keyLength, |
| 8371 | tANI_U8 *pKey, tANI_U8 paeRole ) |
| 8372 | { |
| 8373 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8374 | tAniEdType edType; |
| 8375 | |
| 8376 | if(eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType) |
| 8377 | { |
| 8378 | EncryptType = eCSR_ENCRYPT_TYPE_NONE; //*** |
| 8379 | } |
| 8380 | |
| 8381 | edType = csrTranslateEncryptTypeToEdType( EncryptType ); |
| 8382 | |
| 8383 | // Allow 0 keys to be set for the non-WPA encrypt types... For WPA encrypt types, the num keys must be non-zero |
| 8384 | // or LIM will reject the set context (assumes the SET_CONTEXT does not occur until the keys are distrubuted). |
| 8385 | if ( CSR_IS_ENC_TYPE_STATIC( EncryptType ) || |
| 8386 | addKey ) |
| 8387 | { |
| 8388 | tCsrRoamSetKey setKey; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8389 | setKey.encType = EncryptType; |
| 8390 | setKey.keyDirection = aniKeyDirection; //Tx, Rx or Tx-and-Rx |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8391 | vos_mem_copy(&setKey.peerMac, bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8392 | setKey.paeRole = paeRole; //0 for supplicant |
| 8393 | setKey.keyId = keyId; // Kye index |
| 8394 | setKey.keyLength = keyLength; |
| 8395 | if( keyLength ) |
| 8396 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8397 | vos_mem_copy(setKey.Key, pKey, keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8398 | } |
| 8399 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, &setKey, 0 ); |
| 8400 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8401 | return (status); |
| 8402 | } |
| 8403 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8404 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8405 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 8406 | { |
| 8407 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 8408 | tSmeCmd *pCommand = NULL; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8409 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8410 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8411 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8412 | |
| 8413 | do |
| 8414 | { |
| 8415 | pCommand = csrGetCommandBuffer(pMac); |
| 8416 | if(NULL == pCommand) |
| 8417 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8418 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8419 | status = eHAL_STATUS_RESOURCES; |
| 8420 | break; |
| 8421 | } |
| 8422 | pCommand->command = eSmeCommandSetKey; |
| 8423 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8424 | // validate the key length, Adjust if too long... |
| 8425 | // for static WEP the keys are not set thru' SetContextReq |
| 8426 | if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || |
| 8427 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ) ) |
| 8428 | { |
| 8429 | //KeyLength maybe 0 for static WEP |
| 8430 | if( pSetKey->keyLength ) |
| 8431 | { |
| 8432 | if ( pSetKey->keyLength < CSR_WEP40_KEY_LEN ) |
| 8433 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8434 | smsLog( pMac, LOGW, "Invalid WEP40 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8435 | break; |
| 8436 | } |
| 8437 | |
| 8438 | pCommand->u.setKeyCmd.keyLength = CSR_WEP40_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8439 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8440 | CSR_WEP40_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8441 | } |
| 8442 | } |
| 8443 | else if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || |
| 8444 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ) ) |
| 8445 | { |
| 8446 | //KeyLength maybe 0 for static WEP |
| 8447 | if( pSetKey->keyLength ) |
| 8448 | { |
| 8449 | if ( pSetKey->keyLength < CSR_WEP104_KEY_LEN ) |
| 8450 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8451 | smsLog( pMac, LOGW, "Invalid WEP104 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8452 | break; |
| 8453 | } |
| 8454 | |
| 8455 | pCommand->u.setKeyCmd.keyLength = CSR_WEP104_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8456 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8457 | CSR_WEP104_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8458 | } |
| 8459 | } |
| 8460 | else if ( eCSR_ENCRYPT_TYPE_TKIP == pSetKey->encType ) |
| 8461 | { |
| 8462 | if ( pSetKey->keyLength < CSR_TKIP_KEY_LEN ) |
| 8463 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8464 | smsLog( pMac, LOGW, "Invalid TKIP keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8465 | break; |
| 8466 | } |
| 8467 | pCommand->u.setKeyCmd.keyLength = CSR_TKIP_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8468 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8469 | CSR_TKIP_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8470 | } |
| 8471 | else if ( eCSR_ENCRYPT_TYPE_AES == pSetKey->encType ) |
| 8472 | { |
| 8473 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 8474 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8475 | smsLog( pMac, LOGW, "Invalid AES/CCMP keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8476 | break; |
| 8477 | } |
| 8478 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8479 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8480 | CSR_AES_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8481 | } |
| 8482 | #ifdef FEATURE_WLAN_WAPI |
| 8483 | else if ( eCSR_ENCRYPT_TYPE_WPI == pSetKey->encType ) |
| 8484 | { |
| 8485 | if ( pSetKey->keyLength < CSR_WAPI_KEY_LEN ) |
| 8486 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8487 | smsLog( pMac, LOGW, "Invalid WAPI keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8488 | break; |
| 8489 | } |
| 8490 | pCommand->u.setKeyCmd.keyLength = CSR_WAPI_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8491 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8492 | CSR_WAPI_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8493 | } |
| 8494 | #endif /* FEATURE_WLAN_WAPI */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8495 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8496 | else if ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 8497 | { |
| 8498 | if ( pSetKey->keyLength < CSR_KRK_KEY_LEN ) |
| 8499 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8500 | smsLog( pMac, LOGW, "Invalid KRK keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8501 | break; |
| 8502 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8503 | vos_mem_copy(pSession->eseCckmInfo.krk, pSetKey->Key, |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8504 | CSR_KRK_KEY_LEN); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8505 | pSession->eseCckmInfo.reassoc_req_num=1; |
| 8506 | pSession->eseCckmInfo.krk_plumbed = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8507 | status = eHAL_STATUS_SUCCESS; |
| 8508 | break; |
| 8509 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8510 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8511 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8512 | #ifdef WLAN_FEATURE_11W |
| 8513 | //Check for 11w BIP |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8514 | else if (eCSR_ENCRYPT_TYPE_AES_CMAC == pSetKey->encType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8515 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8516 | if (pSetKey->keyLength < CSR_AES_KEY_LEN) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8517 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8518 | smsLog(pMac, LOGW, "Invalid AES/CCMP keylength [= %d] in SetContext call", pSetKey->keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8519 | break; |
| 8520 | } |
| 8521 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8522 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, CSR_AES_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8523 | } |
| 8524 | #endif |
| 8525 | status = eHAL_STATUS_SUCCESS; |
| 8526 | pCommand->u.setKeyCmd.roamId = roamId; |
| 8527 | pCommand->u.setKeyCmd.encType = pSetKey->encType; |
| 8528 | pCommand->u.setKeyCmd.keyDirection = pSetKey->keyDirection; //Tx, Rx or Tx-and-Rx |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8529 | vos_mem_copy(&pCommand->u.setKeyCmd.peerMac, &pSetKey->peerMac, |
| 8530 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8531 | pCommand->u.setKeyCmd.paeRole = pSetKey->paeRole; //0 for supplicant |
| 8532 | pCommand->u.setKeyCmd.keyId = pSetKey->keyId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8533 | vos_mem_copy(pCommand->u.setKeyCmd.keyRsc, pSetKey->keyRsc, CSR_MAX_RSC_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8534 | //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 |
| 8535 | |
| 8536 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 8537 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8538 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8539 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8540 | } |
| 8541 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8542 | // Free the command if there has been a failure, or it is a |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8543 | // "local" operation like the set ESE CCKM KRK key. |
Jeff Johnson | 74b3ec5 | 2013-04-03 13:45:51 -0700 | [diff] [blame] | 8544 | if ( ( NULL != pCommand ) && |
| 8545 | ( (!HAL_STATUS_SUCCESS( status ) ) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8546 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8547 | || ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8548 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 74b3ec5 | 2013-04-03 13:45:51 -0700 | [diff] [blame] | 8549 | ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8550 | { |
| 8551 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 8552 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8553 | return( status ); |
| 8554 | } |
| 8555 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8556 | eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8557 | tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId ) |
| 8558 | { |
| 8559 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 8560 | tSmeCmd *pCommand = NULL; |
| 8561 | tANI_BOOLEAN fImediate = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8562 | do |
| 8563 | { |
| 8564 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8565 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8566 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8567 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8568 | break; |
| 8569 | } |
| 8570 | pCommand = csrGetCommandBuffer(pMac); |
| 8571 | if(NULL == pCommand) |
| 8572 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8573 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8574 | status = eHAL_STATUS_RESOURCES; |
| 8575 | break; |
| 8576 | } |
| 8577 | pCommand->command = eSmeCommandRemoveKey; |
| 8578 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8579 | pCommand->u.removeKeyCmd.roamId = roamId; |
| 8580 | pCommand->u.removeKeyCmd.encType = pRemoveKey->encType; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8581 | vos_mem_copy(&pCommand->u.removeKeyCmd.peerMac, &pRemoveKey->peerMac, |
| 8582 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8583 | pCommand->u.removeKeyCmd.keyId = pRemoveKey->keyId; |
| 8584 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8585 | { |
| 8586 | //in this case, put it to the end of the Q incase there is a set key pending. |
| 8587 | fImediate = eANI_BOOLEAN_FALSE; |
| 8588 | } |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8589 | smsLog( pMac, LOGE, FL("keyType=%d, keyId=%d, PeerMac="MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8590 | pRemoveKey->encType, pRemoveKey->keyId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8591 | MAC_ADDR_ARRAY(pCommand->u.removeKeyCmd.peerMac)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8592 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 8593 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8594 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8595 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8596 | break; |
| 8597 | } |
| 8598 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8599 | if( !HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand ) ) |
| 8600 | { |
| 8601 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 8602 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8603 | return (status ); |
| 8604 | } |
| 8605 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8606 | eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8607 | { |
| 8608 | eHalStatus status; |
| 8609 | tANI_U8 numKeys = ( pCommand->u.setKeyCmd.keyLength ) ? 1 : 0; |
| 8610 | tAniEdType edType = csrTranslateEncryptTypeToEdType( pCommand->u.setKeyCmd.encType ); |
| 8611 | tANI_BOOLEAN fUnicast = ( pCommand->u.setKeyCmd.peerMac[0] == 0xFF ) ? eANI_BOOLEAN_FALSE : eANI_BOOLEAN_TRUE; |
| 8612 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8613 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8614 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8615 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8616 | if(eSIR_ED_NONE != edType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8617 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8618 | vos_mem_set(&setKeyEvent, |
| 8619 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8620 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 8621 | { |
| 8622 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ; |
| 8623 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 8624 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8625 | } |
| 8626 | else |
| 8627 | { |
| 8628 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_REQ; |
| 8629 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 8630 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8631 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8632 | vos_mem_copy(setKeyEvent.bssid, pSession->connectedProfile.bssid, 6); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8633 | if(CSR_IS_ENC_TYPE_STATIC(pCommand->u.setKeyCmd.encType)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8634 | { |
| 8635 | tANI_U32 defKeyId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8636 | //It has to be static WEP here |
| 8637 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, &defKeyId))) |
| 8638 | { |
| 8639 | setKeyEvent.keyId = (v_U8_t)defKeyId; |
| 8640 | } |
| 8641 | } |
| 8642 | else |
| 8643 | { |
| 8644 | setKeyEvent.keyId = pCommand->u.setKeyCmd.keyId; |
| 8645 | } |
| 8646 | setKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8647 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8648 | } |
| 8649 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8650 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8651 | { |
| 8652 | status = csrSendMBSetContextReqMsg( pMac, sessionId, |
| 8653 | ( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac, |
| 8654 | numKeys, edType, fUnicast, pCommand->u.setKeyCmd.keyDirection, |
| 8655 | pCommand->u.setKeyCmd.keyId, pCommand->u.setKeyCmd.keyLength, |
| 8656 | pCommand->u.setKeyCmd.Key, pCommand->u.setKeyCmd.paeRole, |
| 8657 | pCommand->u.setKeyCmd.keyRsc); |
| 8658 | } |
| 8659 | else |
| 8660 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8661 | smsLog( pMac, LOGW, FL(" cannot process not connected") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8662 | //Set this status so the error handling take care of the case. |
| 8663 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8664 | } |
| 8665 | if( !HAL_STATUS_SUCCESS(status) ) |
| 8666 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8667 | smsLog( pMac, LOGE, FL(" error status %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8668 | 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] | 8669 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8670 | if(eSIR_ED_NONE != edType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8671 | { |
| 8672 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 8673 | { |
| 8674 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 8675 | } |
| 8676 | else |
| 8677 | { |
| 8678 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 8679 | } |
| 8680 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 8681 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8682 | } |
| 8683 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8684 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8685 | return ( status ); |
| 8686 | } |
| 8687 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8688 | eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8689 | { |
| 8690 | eHalStatus status; |
| 8691 | tpSirSmeRemoveKeyReq pMsg = NULL; |
| 8692 | tANI_U16 wMsgLen = sizeof(tSirSmeRemoveKeyReq); |
| 8693 | tANI_U8 *p; |
| 8694 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8695 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8696 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8697 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8698 | vos_mem_set(&removeKeyEvent, |
| 8699 | sizeof(vos_event_wlan_security_payload_type),0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8700 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_REQ; |
| 8701 | removeKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8702 | removeKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8703 | vos_mem_copy(removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8704 | removeKeyEvent.keyId = pCommand->u.removeKeyCmd.keyId; |
| 8705 | removeKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8706 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8707 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8708 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8709 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8710 | pMsg = vos_mem_malloc(wMsgLen); |
| 8711 | if ( NULL == pMsg ) |
| 8712 | status = eHAL_STATUS_FAILURE; |
| 8713 | else |
| 8714 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8715 | } |
| 8716 | else |
| 8717 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8718 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8719 | //Set the error status so error handling kicks in below |
| 8720 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8721 | } |
| 8722 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8723 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8724 | vos_mem_set(pMsg, wMsgLen ,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8725 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REMOVEKEY_REQ); |
| 8726 | pMsg->length = pal_cpu_to_be16(wMsgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8727 | pMsg->sessionId = (tANI_U8)sessionId; |
| 8728 | pMsg->transactionId = 0; |
| 8729 | p = (tANI_U8 *)pMsg + sizeof(pMsg->messageType) + sizeof(pMsg->length) + |
| 8730 | sizeof(pMsg->sessionId) + sizeof(pMsg->transactionId); |
| 8731 | // bssId - copy from session Info |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8732 | vos_mem_copy(p, |
| 8733 | &pMac->roam.roamSession[sessionId].connectedProfile.bssid, |
| 8734 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8735 | p += sizeof(tSirMacAddr); |
| 8736 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8737 | vos_mem_copy(p, pCommand->u.removeKeyCmd.peerMac, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8738 | p += sizeof(tSirMacAddr); |
| 8739 | // edType |
| 8740 | *p = (tANI_U8)csrTranslateEncryptTypeToEdType( pCommand->u.removeKeyCmd.encType ); |
| 8741 | p++; |
| 8742 | // weptype |
| 8743 | if( ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pCommand->u.removeKeyCmd.encType ) || |
| 8744 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pCommand->u.removeKeyCmd.encType ) ) |
| 8745 | { |
| 8746 | *p = (tANI_U8)eSIR_WEP_STATIC; |
| 8747 | } |
| 8748 | else |
| 8749 | { |
| 8750 | *p = (tANI_U8)eSIR_WEP_DYNAMIC; |
| 8751 | } |
| 8752 | p++; |
| 8753 | //keyid |
| 8754 | *p = pCommand->u.removeKeyCmd.keyId; |
| 8755 | p++; |
| 8756 | *p = (pCommand->u.removeKeyCmd.peerMac[0] == 0xFF ) ? 0 : 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8757 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 8758 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8759 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8760 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 8761 | smsLog( pMac, LOGE, FL(" error status %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8762 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8763 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 8764 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8765 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8766 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8767 | csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.removeKeyCmd.roamId, eCSR_ROAM_REMOVE_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE); |
| 8768 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8769 | return ( status ); |
| 8770 | } |
| 8771 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8772 | eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 8773 | { |
| 8774 | eHalStatus status; |
| 8775 | |
| 8776 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8777 | { |
| 8778 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8779 | } |
| 8780 | else |
| 8781 | { |
| 8782 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, pSetKey, roamId ); |
| 8783 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8784 | return ( status ); |
| 8785 | } |
| 8786 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8787 | /* |
| 8788 | Prepare a filter base on a profile for parsing the scan results. |
| 8789 | Upon successful return, caller MUST call csrFreeScanFilter on |
| 8790 | pScanFilter when it is done with the filter. |
| 8791 | */ |
| 8792 | eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 8793 | tCsrScanResultFilter *pScanFilter) |
| 8794 | { |
| 8795 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8796 | tANI_U32 size = 0; |
| 8797 | tANI_U8 index = 0; |
| 8798 | |
| 8799 | do |
| 8800 | { |
| 8801 | if(pProfile->BSSIDs.numOfBSSIDs) |
| 8802 | { |
| 8803 | size = sizeof(tCsrBssid) * pProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8804 | pScanFilter->BSSIDs.bssid = vos_mem_malloc(size); |
| 8805 | if ( NULL == pScanFilter->BSSIDs.bssid ) |
| 8806 | status = eHAL_STATUS_FAILURE; |
| 8807 | else |
| 8808 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8809 | if(!HAL_STATUS_SUCCESS(status)) |
| 8810 | { |
| 8811 | break; |
| 8812 | } |
| 8813 | pScanFilter->BSSIDs.numOfBSSIDs = pProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8814 | vos_mem_copy(pScanFilter->BSSIDs.bssid, pProfile->BSSIDs.bssid, size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8815 | } |
| 8816 | if(pProfile->SSIDs.numOfSSIDs) |
| 8817 | { |
| 8818 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 8819 | { |
| 8820 | pScanFilter->SSIDs.numOfSSIDs = pProfile->SSIDs.numOfSSIDs; |
| 8821 | } |
| 8822 | else |
| 8823 | { |
| 8824 | //For WDS station |
| 8825 | //We always use index 1 for self SSID. Index 0 for peer's SSID that we want to join |
| 8826 | pScanFilter->SSIDs.numOfSSIDs = 1; |
| 8827 | } |
| 8828 | size = sizeof(tCsrSSIDInfo) * pProfile->SSIDs.numOfSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8829 | pScanFilter->SSIDs.SSIDList = vos_mem_malloc(size); |
| 8830 | if ( NULL == pScanFilter->SSIDs.SSIDList ) |
| 8831 | status = eHAL_STATUS_FAILURE; |
| 8832 | else |
| 8833 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8834 | if(!HAL_STATUS_SUCCESS(status)) |
| 8835 | { |
| 8836 | break; |
| 8837 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8838 | vos_mem_copy(pScanFilter->SSIDs.SSIDList, pProfile->SSIDs.SSIDList, |
| 8839 | size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8840 | } |
| 8841 | if(!pProfile->ChannelInfo.ChannelList || (pProfile->ChannelInfo.ChannelList[0] == 0) ) |
| 8842 | { |
| 8843 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8844 | pScanFilter->ChannelInfo.ChannelList = NULL; |
| 8845 | } |
| 8846 | else if(pProfile->ChannelInfo.numOfChannels) |
| 8847 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8848 | pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc( |
| 8849 | sizeof(*pScanFilter->ChannelInfo.ChannelList) * |
| 8850 | pProfile->ChannelInfo.numOfChannels); |
| 8851 | if ( NULL == pScanFilter->ChannelInfo.ChannelList ) |
| 8852 | status = eHAL_STATUS_FAILURE; |
| 8853 | else |
| 8854 | status = eHAL_STATUS_SUCCESS; |
| 8855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8856 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8857 | if(HAL_STATUS_SUCCESS(status)) |
| 8858 | { |
| 8859 | for(index = 0; index < pProfile->ChannelInfo.numOfChannels; index++) |
| 8860 | { |
| 8861 | if(csrRoamIsChannelValid(pMac, pProfile->ChannelInfo.ChannelList[index])) |
| 8862 | { |
| 8863 | pScanFilter->ChannelInfo.ChannelList[pScanFilter->ChannelInfo.numOfChannels] |
| 8864 | = pProfile->ChannelInfo.ChannelList[index]; |
| 8865 | pScanFilter->ChannelInfo.numOfChannels++; |
| 8866 | } |
| 8867 | else |
| 8868 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8869 | smsLog(pMac, LOG1, FL("process a channel (%d) that is invalid"), pProfile->ChannelInfo.ChannelList[index]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8870 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8871 | } |
| 8872 | } |
| 8873 | else |
| 8874 | { |
| 8875 | break; |
| 8876 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8877 | } |
| 8878 | else |
| 8879 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 8880 | smsLog(pMac, LOGE, FL("Channel list empty")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8881 | status = eHAL_STATUS_FAILURE; |
| 8882 | break; |
| 8883 | } |
| 8884 | pScanFilter->uapsd_mask = pProfile->uapsd_mask; |
| 8885 | pScanFilter->authType = pProfile->AuthType; |
| 8886 | pScanFilter->EncryptionType = pProfile->EncryptionType; |
| 8887 | pScanFilter->mcEncryptionType = pProfile->mcEncryptionType; |
| 8888 | pScanFilter->BSSType = pProfile->BSSType; |
| 8889 | pScanFilter->phyMode = pProfile->phyMode; |
| 8890 | #ifdef FEATURE_WLAN_WAPI |
| 8891 | //check if user asked for WAPI with 11n or auto mode, in that case modify |
| 8892 | //the phymode to 11g |
| 8893 | if(csrIsProfileWapi(pProfile)) |
| 8894 | { |
| 8895 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_11n) |
| 8896 | { |
| 8897 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 8898 | } |
| 8899 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_AUTO) |
| 8900 | { |
| 8901 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_AUTO; |
| 8902 | } |
| 8903 | if(!pScanFilter->phyMode) |
| 8904 | { |
| 8905 | pScanFilter->phyMode = eCSR_DOT11_MODE_11g; |
| 8906 | } |
| 8907 | } |
| 8908 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8909 | /*Save the WPS info*/ |
| 8910 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8911 | if( pProfile->countryCode[0] ) |
| 8912 | { |
| 8913 | //This causes the matching function to use countryCode as one of the criteria. |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8914 | vos_mem_copy(pScanFilter->countryCode, pProfile->countryCode, |
| 8915 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8916 | } |
| 8917 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8918 | if (pProfile->MDID.mdiePresent) |
| 8919 | { |
| 8920 | pScanFilter->MDID.mdiePresent = 1; |
| 8921 | pScanFilter->MDID.mobilityDomain = pProfile->MDID.mobilityDomain; |
| 8922 | } |
| 8923 | #endif |
| 8924 | |
| 8925 | }while(0); |
| 8926 | |
| 8927 | if(!HAL_STATUS_SUCCESS(status)) |
| 8928 | { |
| 8929 | csrFreeScanFilter(pMac, pScanFilter); |
| 8930 | } |
| 8931 | |
| 8932 | return(status); |
| 8933 | } |
| 8934 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8935 | tANI_BOOLEAN csrRoamIssueWmStatusChange( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8936 | eCsrRoamWmStatusChangeTypes Type, tSirSmeRsp *pSmeRsp ) |
| 8937 | { |
| 8938 | tANI_BOOLEAN fCommandQueued = eANI_BOOLEAN_FALSE; |
| 8939 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8940 | do |
| 8941 | { |
| 8942 | // Validate the type is ok... |
| 8943 | if ( ( eCsrDisassociated != Type ) && ( eCsrDeauthenticated != Type ) ) break; |
| 8944 | pCommand = csrGetCommandBuffer( pMac ); |
| 8945 | if ( !pCommand ) |
| 8946 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8947 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8948 | break; |
| 8949 | } |
| 8950 | //Change the substate in case it is waiting for key |
| 8951 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8952 | { |
| 8953 | csrRoamStopWaitForKeyTimer( pMac ); |
| 8954 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 8955 | } |
| 8956 | pCommand->command = eSmeCommandWmStatusChange; |
| 8957 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8958 | pCommand->u.wmStatusChangeCmd.Type = Type; |
| 8959 | if ( eCsrDisassociated == Type ) |
| 8960 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8961 | vos_mem_copy(&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg, |
| 8962 | pSmeRsp, |
| 8963 | sizeof( pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8964 | } |
| 8965 | else |
| 8966 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8967 | vos_mem_copy(&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg, |
| 8968 | pSmeRsp, |
| 8969 | sizeof( pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8970 | } |
| 8971 | if( HAL_STATUS_SUCCESS( csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE) ) ) |
| 8972 | { |
| 8973 | fCommandQueued = eANI_BOOLEAN_TRUE; |
| 8974 | } |
| 8975 | else |
| 8976 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8977 | smsLog( pMac, LOGE, FL(" fail to send message ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8978 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 8979 | } |
| 8980 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8981 | /* AP has issued Dissac/Deauth, Set the operating mode value to configured value */ |
| 8982 | csrSetDefaultDot11Mode( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8983 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8984 | return( fCommandQueued ); |
| 8985 | } |
| 8986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8987 | static void csrUpdateRssi(tpAniSirGlobal pMac, void* pMsg) |
| 8988 | { |
| 8989 | v_S7_t rssi = 0; |
| 8990 | tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq*)pMsg; |
| 8991 | if(pGetRssiReq) |
| 8992 | { |
| 8993 | if(NULL != pGetRssiReq->pVosContext) |
| 8994 | { |
| 8995 | WLANTL_GetRssi(pGetRssiReq->pVosContext, pGetRssiReq->staId, &rssi); |
| 8996 | } |
| 8997 | else |
| 8998 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8999 | smsLog( pMac, LOGE, FL("pGetRssiReq->pVosContext is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9000 | return; |
| 9001 | } |
| 9002 | |
| 9003 | if(NULL != pGetRssiReq->rssiCallback) |
| 9004 | { |
| 9005 | ((tCsrRssiCallback)(pGetRssiReq->rssiCallback))(rssi, pGetRssiReq->staId, pGetRssiReq->pDevContext); |
| 9006 | } |
| 9007 | else |
| 9008 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9009 | smsLog( pMac, LOGE, FL("pGetRssiReq->rssiCallback is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9010 | return; |
| 9011 | } |
| 9012 | } |
| 9013 | else |
| 9014 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9015 | smsLog( pMac, LOGE, FL("pGetRssiReq is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9016 | } |
| 9017 | return; |
| 9018 | } |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9019 | |
| 9020 | static void csrUpdateSnr(tpAniSirGlobal pMac, void* pMsg) |
| 9021 | { |
| 9022 | tANI_S8 snr = 0; |
| 9023 | tAniGetSnrReq *pGetSnrReq = (tAniGetSnrReq*)pMsg; |
| 9024 | |
| 9025 | if (pGetSnrReq) |
| 9026 | { |
| 9027 | if (VOS_STATUS_SUCCESS != |
| 9028 | WDA_GetSnr(pGetSnrReq->staId, &snr)) |
| 9029 | { |
| 9030 | smsLog(pMac, LOGE, FL("Error in WLANTL_GetSnr")); |
| 9031 | return; |
| 9032 | } |
| 9033 | |
| 9034 | if (pGetSnrReq->snrCallback) |
| 9035 | { |
| 9036 | ((tCsrSnrCallback)(pGetSnrReq->snrCallback))(snr, pGetSnrReq->staId, |
| 9037 | pGetSnrReq->pDevContext); |
| 9038 | } |
| 9039 | else |
| 9040 | { |
| 9041 | smsLog(pMac, LOGE, FL("pGetSnrReq->snrCallback is NULL")); |
| 9042 | return; |
| 9043 | } |
| 9044 | } |
| 9045 | else |
| 9046 | { |
| 9047 | smsLog(pMac, LOGE, FL("pGetSnrReq is NULL")); |
| 9048 | } |
| 9049 | return; |
| 9050 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9051 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9052 | void csrRoamRssiRspProcessor(tpAniSirGlobal pMac, void* pMsg) |
| 9053 | { |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9054 | tAniGetRoamRssiRsp* pRoamRssiRsp = (tAniGetRoamRssiRsp*)pMsg; |
| 9055 | |
Jeff Johnson | 36d483b | 2013-04-08 11:08:53 -0700 | [diff] [blame] | 9056 | if (NULL != pRoamRssiRsp) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9057 | { |
Jeff Johnson | 36d483b | 2013-04-08 11:08:53 -0700 | [diff] [blame] | 9058 | /* Get roam Rssi request is backed up and passed back to the response, |
| 9059 | Extract the request message to fetch callback */ |
| 9060 | tpAniGetRssiReq reqBkp = (tAniGetRssiReq*)pRoamRssiRsp->rssiReq; |
| 9061 | v_S7_t rssi = pRoamRssiRsp->rssi; |
| 9062 | |
| 9063 | if ((NULL != reqBkp) && (NULL != reqBkp->rssiCallback)) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9064 | { |
| 9065 | ((tCsrRssiCallback)(reqBkp->rssiCallback))(rssi, pRoamRssiRsp->staId, reqBkp->pDevContext); |
| 9066 | reqBkp->rssiCallback = NULL; |
| 9067 | vos_mem_free(reqBkp); |
Kiran Kumar Lokere | 111cff4 | 2013-12-11 21:05:44 -0800 | [diff] [blame] | 9068 | pRoamRssiRsp->rssiReq = NULL; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9069 | } |
| 9070 | else |
| 9071 | { |
| 9072 | smsLog( pMac, LOGE, FL("reqBkp->rssiCallback is NULL")); |
| 9073 | if (NULL != reqBkp) |
| 9074 | { |
| 9075 | vos_mem_free(reqBkp); |
Kiran Kumar Lokere | 111cff4 | 2013-12-11 21:05:44 -0800 | [diff] [blame] | 9076 | pRoamRssiRsp->rssiReq = NULL; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9077 | } |
| 9078 | } |
| 9079 | } |
| 9080 | else |
| 9081 | { |
| 9082 | smsLog( pMac, LOGE, FL("pRoamRssiRsp is NULL")); |
| 9083 | } |
| 9084 | return; |
| 9085 | } |
| 9086 | #endif |
| 9087 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9088 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9089 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9090 | void csrTsmStatsRspProcessor(tpAniSirGlobal pMac, void* pMsg) |
| 9091 | { |
| 9092 | tAniGetTsmStatsRsp* pTsmStatsRsp = (tAniGetTsmStatsRsp*)pMsg; |
| 9093 | |
| 9094 | if (NULL != pTsmStatsRsp) |
| 9095 | { |
| 9096 | /* Get roam Rssi request is backed up and passed back to the response, |
| 9097 | Extract the request message to fetch callback */ |
| 9098 | tpAniGetTsmStatsReq reqBkp = (tAniGetTsmStatsReq*)pTsmStatsRsp->tsmStatsReq; |
| 9099 | |
| 9100 | if (NULL != reqBkp) |
| 9101 | { |
| 9102 | if (NULL != reqBkp->tsmStatsCallback) |
| 9103 | { |
| 9104 | ((tCsrTsmStatsCallback)(reqBkp->tsmStatsCallback))(pTsmStatsRsp->tsmMetrics, |
| 9105 | pTsmStatsRsp->staId, reqBkp->pDevContext); |
| 9106 | reqBkp->tsmStatsCallback = NULL; |
| 9107 | } |
| 9108 | vos_mem_free(reqBkp); |
Kiran Kumar Lokere | 111cff4 | 2013-12-11 21:05:44 -0800 | [diff] [blame] | 9109 | pTsmStatsRsp->tsmStatsReq = NULL; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9110 | } |
| 9111 | else |
| 9112 | { |
| 9113 | smsLog( pMac, LOGE, FL("reqBkp is NULL")); |
| 9114 | if (NULL != reqBkp) |
| 9115 | { |
| 9116 | vos_mem_free(reqBkp); |
Kiran Kumar Lokere | 111cff4 | 2013-12-11 21:05:44 -0800 | [diff] [blame] | 9117 | pTsmStatsRsp->tsmStatsReq = NULL; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9118 | } |
| 9119 | } |
| 9120 | } |
| 9121 | else |
| 9122 | { |
| 9123 | smsLog( pMac, LOGE, FL("pTsmStatsRsp is NULL")); |
| 9124 | } |
| 9125 | return; |
| 9126 | } |
| 9127 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9128 | void csrSendEseAdjacentApRepInd(tpAniSirGlobal pMac, tCsrRoamSession *pSession) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9129 | { |
| 9130 | tANI_U32 roamTS2 = 0; |
| 9131 | tCsrRoamInfo roamInfo; |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame] | 9132 | tpPESession pSessionEntry = NULL; |
| 9133 | tANI_U8 sessionId = CSR_SESSION_ID_INVALID; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9134 | |
| 9135 | if (NULL == pSession) |
| 9136 | { |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame] | 9137 | smsLog(pMac, LOGE, FL("pSession is NULL")); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9138 | return; |
| 9139 | } |
| 9140 | |
| 9141 | roamTS2 = vos_timer_get_system_time(); |
| 9142 | roamInfo.tsmRoamDelay = roamTS2 - pSession->roamTS1; |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 9143 | smsLog(pMac, LOG1, "Bssid("MAC_ADDRESS_STR") Roaming Delay(%u ms)", |
| 9144 | MAC_ADDR_ARRAY(pSession->connectedProfile.bssid), |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame] | 9145 | roamInfo.tsmRoamDelay); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9146 | |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame] | 9147 | pSessionEntry = peFindSessionByBssid(pMac, pSession->connectedProfile.bssid, &sessionId); |
| 9148 | if (NULL == pSessionEntry) |
| 9149 | { |
| 9150 | smsLog(pMac, LOGE, FL("session %d not found"), sessionId); |
| 9151 | return; |
| 9152 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9153 | pSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly = roamInfo.tsmRoamDelay; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9154 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9155 | 0, eCSR_ROAM_ESE_ADJ_AP_REPORT_IND, 0); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9156 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9157 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9158 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9159 | static void csrRoamRssiIndHdlr(tpAniSirGlobal pMac, void* pMsg) |
| 9160 | { |
| 9161 | WLANTL_TlIndicationReq *pTlRssiInd = (WLANTL_TlIndicationReq*)pMsg; |
| 9162 | if(pTlRssiInd) |
| 9163 | { |
| 9164 | if(NULL != pTlRssiInd->tlCallback) |
| 9165 | { |
| 9166 | ((WLANTL_RSSICrossThresholdCBType)(pTlRssiInd->tlCallback)) |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 9167 | (pTlRssiInd->pAdapter, pTlRssiInd->rssiNotification, pTlRssiInd->pUserCtxt, pTlRssiInd->avgRssi); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9168 | } |
| 9169 | else |
| 9170 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9171 | smsLog( pMac, LOGE, FL("pTlRssiInd->tlCallback is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9172 | } |
| 9173 | } |
| 9174 | else |
| 9175 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9176 | smsLog( pMac, LOGE, FL("pTlRssiInd is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9177 | } |
| 9178 | return; |
| 9179 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9180 | |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9181 | eHalStatus csrSendResetApCapsChanged(tpAniSirGlobal pMac, tSirMacAddr *bssId) |
| 9182 | { |
| 9183 | tpSirResetAPCapsChange pMsg; |
| 9184 | tANI_U16 len; |
| 9185 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9186 | |
| 9187 | /* Create the message and send to lim */ |
| 9188 | len = sizeof(tSirResetAPCapsChange); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9189 | pMsg = vos_mem_malloc(len); |
| 9190 | if ( NULL == pMsg ) |
| 9191 | status = eHAL_STATUS_FAILURE; |
| 9192 | else |
| 9193 | status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9194 | if (HAL_STATUS_SUCCESS(status)) |
| 9195 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9196 | vos_mem_set(pMsg, sizeof(tSirResetAPCapsChange), 0); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9197 | pMsg->messageType = eWNI_SME_RESET_AP_CAPS_CHANGED; |
| 9198 | pMsg->length = len; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9199 | vos_mem_copy(pMsg->bssId, bssId, sizeof(tSirMacAddr)); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9200 | smsLog( pMac, LOG1, FL("CSR reset caps change for Bssid= "MAC_ADDRESS_STR), |
| 9201 | MAC_ADDR_ARRAY(pMsg->bssId)); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9202 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 9203 | } |
| 9204 | else |
| 9205 | { |
| 9206 | smsLog( pMac, LOGE, FL("Memory allocation failed\n")); |
| 9207 | } |
| 9208 | return status; |
| 9209 | } |
| 9210 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9211 | void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) |
| 9212 | { |
| 9213 | tSirSmeAssocInd *pAssocInd; |
| 9214 | tSirSmeDisassocInd *pDisassocInd; |
| 9215 | tSirSmeDeauthInd *pDeauthInd; |
| 9216 | tSirSmeWmStatusChangeNtf *pStatusChangeMsg; |
| 9217 | tSirSmeNewBssInfo *pNewBss; |
| 9218 | tSmeIbssPeerInd *pIbssPeerInd; |
| 9219 | tSirMacAddr Broadcastaddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 9220 | tSirSmeApNewCaps *pApNewCaps; |
| 9221 | eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; |
| 9222 | eRoamCmdStatus roamStatus = eCSR_ROAM_FAILED; |
| 9223 | tCsrRoamInfo *pRoamInfo = NULL; |
| 9224 | tCsrRoamInfo roamInfo; |
| 9225 | eHalStatus status; |
| 9226 | tANI_U32 sessionId = CSR_SESSION_ID_INVALID; |
| 9227 | tCsrRoamSession *pSession = NULL; |
| 9228 | tpSirSmeSwitchChannelInd pSwitchChnInd; |
| 9229 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9230 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
krunal soni | 587bf01 | 2014-02-04 12:35:11 -0800 | [diff] [blame] | 9231 | |
| 9232 | |
| 9233 | if (NULL == pSirMsg) |
| 9234 | { smsLog(pMac, LOGE, FL("pSirMsg is NULL")); |
| 9235 | return; |
| 9236 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9237 | switch( pSirMsg->messageType ) |
| 9238 | { |
| 9239 | case eWNI_SME_ASSOC_IND: |
| 9240 | { |
| 9241 | tCsrRoamSession *pSession; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9242 | smsLog( pMac, LOG1, FL("ASSOCIATION Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9243 | pAssocInd = (tSirSmeAssocInd *)pSirMsg; |
| 9244 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pAssocInd->bssId, &sessionId ); |
| 9245 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9246 | { |
| 9247 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 9248 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9249 | if(!pSession) |
| 9250 | { |
| 9251 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9252 | return; |
| 9253 | } |
| 9254 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9255 | pRoamInfo = &roamInfo; |
| 9256 | |
| 9257 | // Required for indicating the frames to upper layer |
| 9258 | pRoamInfo->assocReqLength = pAssocInd->assocReqLength; |
| 9259 | pRoamInfo->assocReqPtr = pAssocInd->assocReqPtr; |
| 9260 | |
| 9261 | pRoamInfo->beaconPtr = pAssocInd->beaconPtr; |
| 9262 | pRoamInfo->beaconLength = pAssocInd->beaconLength; |
| 9263 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 9264 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9265 | |
| 9266 | pRoamInfo->staId = (tANI_U8)pAssocInd->staId; |
| 9267 | pRoamInfo->rsnIELen = (tANI_U8)pAssocInd->rsnIE.length; |
| 9268 | pRoamInfo->prsnIE = pAssocInd->rsnIE.rsnIEdata; |
| 9269 | |
| 9270 | pRoamInfo->addIELen = (tANI_U8)pAssocInd->addIE.length; |
| 9271 | pRoamInfo->paddIE = pAssocInd->addIE.addIEdata; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9272 | vos_mem_copy(pRoamInfo->peerMac, pAssocInd->peerMacAddr, |
| 9273 | sizeof(tSirMacAddr)); |
| 9274 | vos_mem_copy(&pRoamInfo->bssid, pAssocInd->bssId, |
| 9275 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9276 | pRoamInfo->wmmEnabledSta = pAssocInd->wmmEnabledSta; |
| 9277 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9278 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9279 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile)) |
| 9280 | { |
| 9281 | if( CSR_IS_ENC_TYPE_STATIC( pSession->pCurRoamProfile->negotiatedUCEncryptionType )) |
| 9282 | { |
| 9283 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->pCurRoamProfile->negotiatedUCEncryptionType, |
| 9284 | pSession->pConnectBssDesc, |
| 9285 | &(pRoamInfo->peerMac), |
| 9286 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 9287 | pRoamInfo->fAuthRequired = FALSE; |
| 9288 | } |
| 9289 | else |
| 9290 | { |
| 9291 | pRoamInfo->fAuthRequired = TRUE; |
| 9292 | } |
| 9293 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND); |
| 9294 | if (!HAL_STATUS_SUCCESS(status)) |
| 9295 | pRoamInfo->statusCode = eSIR_SME_ASSOC_REFUSED;// Refused due to Mac filtering |
| 9296 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9297 | /* Send Association completion message to PE */ |
| 9298 | status = csrSendAssocCnfMsg( pMac, pAssocInd, status );//Sta |
| 9299 | |
| 9300 | /* send a message to CSR itself just to avoid the EAPOL frames going |
| 9301 | * OTA before association response */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9302 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 9303 | { |
| 9304 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 9305 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9306 | else if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) && (pRoamInfo->statusCode != eSIR_SME_ASSOC_REFUSED)) |
| 9307 | { |
| 9308 | pRoamInfo->fReassocReq = pAssocInd->reassocReq; |
| 9309 | //status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 9310 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 9311 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9312 | } |
| 9313 | } |
| 9314 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9315 | case eWNI_SME_DISASSOC_IND: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9316 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9317 | // Check if AP dis-associated us because of MIC failure. If so, |
| 9318 | // then we need to take action immediately and not wait till the |
| 9319 | // the WmStatusChange requests is pushed and processed |
| 9320 | tSmeCmd *pCommand; |
| 9321 | |
| 9322 | pDisassocInd = (tSirSmeDisassocInd *)pSirMsg; |
| 9323 | status = csrRoamGetSessionIdFromBSSID( pMac, |
| 9324 | (tCsrBssid *)pDisassocInd->bssId, &sessionId ); |
| 9325 | if( HAL_STATUS_SUCCESS( status ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9326 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9327 | smsLog( pMac, LOGE, FL("DISASSOCIATION Indication from MAC" |
| 9328 | " for session %d "), sessionId); |
| 9329 | smsLog( pMac, LOGE, FL("DISASSOCIATION from peer =" |
| 9330 | MAC_ADDRESS_STR " " |
| 9331 | " reason = %d status = %d "), |
| 9332 | MAC_ADDR_ARRAY(pDisassocInd->peerMacAddr), |
| 9333 | pDisassocInd->reasonCode, |
| 9334 | pDisassocInd->statusCode); |
| 9335 | // If we are in neighbor preauth done state then on receiving |
| 9336 | // disassoc or deauth we dont roam instead we just disassoc |
| 9337 | // from current ap and then go to disconnected state |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9338 | // This happens for ESE and 11r FT connections ONLY. |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9339 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9340 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 9341 | { |
| 9342 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9343 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9344 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9345 | #ifdef FEATURE_WLAN_ESE |
| 9346 | if (csrRoamIsESEAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9347 | { |
| 9348 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9349 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9350 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9351 | #ifdef FEATURE_WLAN_LFR |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9352 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 9353 | { |
| 9354 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9355 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9356 | #endif |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9357 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9358 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9359 | if (!pSession) |
| 9360 | { |
| 9361 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9362 | return; |
| 9363 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9364 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9365 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 9366 | { |
| 9367 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 9368 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9369 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9370 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9371 | #endif |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9372 | csrRoamLinkDown(pMac, sessionId); |
| 9373 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDisassociated, pSirMsg ); |
| 9374 | if (CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 9375 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9376 | pRoamInfo = &roamInfo; |
| 9377 | pRoamInfo->statusCode = pDisassocInd->statusCode; |
| 9378 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9379 | pRoamInfo->staId = (tANI_U8)pDisassocInd->staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9380 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9381 | vos_mem_copy(pRoamInfo->peerMac, pDisassocInd->peerMacAddr, |
| 9382 | sizeof(tSirMacAddr)); |
| 9383 | vos_mem_copy(&pRoamInfo->bssid, pDisassocInd->bssId, |
| 9384 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9385 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9386 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, |
| 9387 | eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DISASSOC_IND); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9388 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9389 | /* |
| 9390 | * STA/P2P client got disassociated so remove any pending deauth |
| 9391 | * commands in sme pending list |
| 9392 | */ |
Kaushik, Sushant | 488df38 | 2014-03-05 11:43:47 +0530 | [diff] [blame] | 9393 | pCommand = csrGetCommandBuffer(pMac); |
| 9394 | if (NULL == pCommand) |
| 9395 | { |
| 9396 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 9397 | status = eHAL_STATUS_RESOURCES; |
| 9398 | return; |
| 9399 | } |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9400 | pCommand->command = eSmeCommandRoam; |
| 9401 | pCommand->sessionId = (tANI_U8)sessionId; |
| 9402 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 9403 | vos_mem_copy(pCommand->u.roamCmd.peerMac, |
| 9404 | pDisassocInd->peerMacAddr, |
| 9405 | sizeof(tSirMacAddr)); |
| 9406 | csrRoamRemoveDuplicateCommand(pMac, sessionId, pCommand, eCsrForcedDeauthSta); |
| 9407 | csrReleaseCommand( pMac, pCommand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9408 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9409 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9410 | } |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9411 | else |
| 9412 | { |
| 9413 | smsLog(pMac, LOGE, FL(" Session Id not found for BSSID " MAC_ADDRESS_STR), |
| 9414 | MAC_ADDR_ARRAY(pDisassocInd->bssId)); |
| 9415 | } |
Kiet Lam | 82004c6 | 2013-11-11 13:24:28 +0530 | [diff] [blame] | 9416 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9417 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9418 | case eWNI_SME_DEAUTH_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9419 | smsLog( pMac, LOG1, FL("DEAUTHENTICATION Indication from MAC")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9420 | pDeauthInd = (tpSirSmeDeauthInd)pSirMsg; |
| 9421 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDeauthInd->bssId, &sessionId ); |
| 9422 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9423 | { |
| 9424 | // If we are in neighbor preauth done state then on receiving |
| 9425 | // disassoc or deauth we dont roam instead we just disassoc |
| 9426 | // from current ap and then go to disconnected state |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9427 | // This happens for ESE and 11r FT connections ONLY. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9428 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9429 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 9430 | { |
| 9431 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9432 | } |
| 9433 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9434 | #ifdef FEATURE_WLAN_ESE |
| 9435 | if (csrRoamIsESEAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9436 | { |
| 9437 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9438 | } |
| 9439 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9440 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 9441 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9442 | { |
| 9443 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9444 | } |
| 9445 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9446 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 9447 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9448 | if(!pSession) |
| 9449 | { |
| 9450 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9451 | return; |
| 9452 | } |
| 9453 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9454 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 9455 | { |
| 9456 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 9457 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9458 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 9459 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 9460 | #endif |
| 9461 | csrRoamLinkDown(pMac, sessionId); |
| 9462 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDeauthenticated, pSirMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9463 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 9464 | { |
| 9465 | |
| 9466 | pRoamInfo = &roamInfo; |
| 9467 | |
| 9468 | pRoamInfo->statusCode = pDeauthInd->statusCode; |
| 9469 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9470 | |
| 9471 | pRoamInfo->staId = (tANI_U8)pDeauthInd->staId; |
| 9472 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9473 | vos_mem_copy(pRoamInfo->peerMac, pDeauthInd->peerMacAddr, |
| 9474 | sizeof(tSirMacAddr)); |
| 9475 | vos_mem_copy(&pRoamInfo->bssid, pDeauthInd->bssId, |
| 9476 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9477 | |
| 9478 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DEAUTH_IND); |
| 9479 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9480 | } |
| 9481 | break; |
| 9482 | |
| 9483 | case eWNI_SME_SWITCH_CHL_REQ: // in case of STA, the SWITCH_CHANNEL originates from its AP |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9484 | smsLog( pMac, LOGW, FL("eWNI_SME_SWITCH_CHL_REQ from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9485 | pSwitchChnInd = (tpSirSmeSwitchChannelInd)pSirMsg; |
| 9486 | //Update with the new channel id. |
| 9487 | //The channel id is hidden in the statusCode. |
| 9488 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pSwitchChnInd->bssId, &sessionId ); |
| 9489 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9490 | { |
| 9491 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9492 | if(!pSession) |
| 9493 | { |
| 9494 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9495 | return; |
| 9496 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9497 | pSession->connectedProfile.operationChannel = (tANI_U8)pSwitchChnInd->newChannelId; |
| 9498 | if(pSession->pConnectBssDesc) |
| 9499 | { |
| 9500 | pSession->pConnectBssDesc->channelId = (tANI_U8)pSwitchChnInd->newChannelId; |
| 9501 | } |
| 9502 | } |
| 9503 | break; |
| 9504 | |
| 9505 | case eWNI_SME_DEAUTH_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9506 | smsLog( pMac, LOGW, FL("eWNI_SME_DEAUTH_RSP from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9507 | { |
| 9508 | tSirSmeDeauthRsp* pDeauthRsp = (tSirSmeDeauthRsp *)pSirMsg; |
| 9509 | sessionId = pDeauthRsp->sessionId; |
| 9510 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 9511 | { |
| 9512 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9513 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 9514 | { |
| 9515 | pRoamInfo = &roamInfo; |
| 9516 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9517 | vos_mem_copy(pRoamInfo->peerMac, pDeauthRsp->peerMacAddr, |
| 9518 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9519 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 9520 | pRoamInfo->statusCode = pDeauthRsp->statusCode; |
| 9521 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 9522 | } |
| 9523 | } |
| 9524 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9525 | break; |
| 9526 | |
| 9527 | case eWNI_SME_DISASSOC_RSP: |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9528 | /* session id is invalid here so cant use it to access the array curSubstate as index */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9529 | smsLog( pMac, LOGW, FL("eWNI_SME_DISASSOC_RSP from SME ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9530 | { |
| 9531 | tSirSmeDisassocRsp *pDisassocRsp = (tSirSmeDisassocRsp *)pSirMsg; |
| 9532 | sessionId = pDisassocRsp->sessionId; |
| 9533 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 9534 | { |
| 9535 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9536 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 9537 | { |
| 9538 | pRoamInfo = &roamInfo; |
| 9539 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9540 | vos_mem_copy(pRoamInfo->peerMac, pDisassocRsp->peerMacAddr, |
| 9541 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9542 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 9543 | pRoamInfo->statusCode = pDisassocRsp->statusCode; |
| 9544 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 9545 | } |
| 9546 | } |
| 9547 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9548 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9549 | case eWNI_SME_MIC_FAILURE_IND: |
| 9550 | { |
| 9551 | tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg; |
| 9552 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 9553 | eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
Leo Chang | 9b01ad9 | 2013-09-12 17:26:56 -0700 | [diff] [blame] | 9554 | |
| 9555 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pMicInd->bssId, &sessionId ); |
| 9556 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9557 | { |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 9558 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Leo Chang | 9b01ad9 | 2013-09-12 17:26:56 -0700 | [diff] [blame] | 9559 | roamInfo.u.pMICFailureInfo = &pMicInd->info; |
| 9560 | pRoamInfo = &roamInfo; |
| 9561 | if(pMicInd->info.multicast) |
| 9562 | { |
| 9563 | result = eCSR_ROAM_RESULT_MIC_ERROR_GROUP; |
| 9564 | } |
| 9565 | else |
| 9566 | { |
| 9567 | result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
| 9568 | } |
| 9569 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_MIC_ERROR_IND, result); |
| 9570 | } |
| 9571 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9572 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9573 | { |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9574 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9575 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9576 | if(!pSession) |
| 9577 | { |
| 9578 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9579 | return; |
| 9580 | } |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9581 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9582 | vos_mem_set(&secEvent, sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9583 | secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR; |
| 9584 | secEvent.encryptionModeMulticast = |
| 9585 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9586 | secEvent.encryptionModeUnicast = |
| 9587 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9588 | secEvent.authMode = |
| 9589 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9590 | vos_mem_copy(secEvent.bssid, |
| 9591 | pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9592 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 9593 | } |
| 9594 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9595 | } |
| 9596 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9597 | case eWNI_SME_WPS_PBC_PROBE_REQ_IND: |
| 9598 | { |
| 9599 | tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd)pSirMsg; |
| 9600 | tCsrRoamInfo roamInfo; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9601 | smsLog( pMac, LOG1, FL("WPS PBC Probe request Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9602 | |
| 9603 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pProbeReqInd->bssId, &sessionId ); |
| 9604 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9605 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9606 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9607 | roamInfo.u.pWPSPBCProbeReq = &pProbeReqInd->WPSPBCProbeReq; |
| 9608 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_WPS_PBC_PROBE_REQ_IND, |
| 9609 | eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND); |
| 9610 | } |
| 9611 | } |
| 9612 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9613 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9614 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 9615 | pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *)pSirMsg; |
| 9616 | switch( pStatusChangeMsg->statusChangeCode ) |
| 9617 | { |
| 9618 | case eSIR_SME_IBSS_ACTIVE: |
| 9619 | sessionId = csrFindIbssSession( pMac ); |
| 9620 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9621 | { |
| 9622 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9623 | if(!pSession) |
| 9624 | { |
| 9625 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9626 | return; |
| 9627 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9628 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED; |
| 9629 | if(pSession->pConnectBssDesc) |
| 9630 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9631 | vos_mem_copy(&roamInfo.bssid, |
| 9632 | pSession->pConnectBssDesc->bssId, |
| 9633 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9634 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 9635 | pRoamInfo = &roamInfo; |
| 9636 | } |
| 9637 | else |
| 9638 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9639 | smsLog(pMac, LOGE, " CSR eSIR_SME_IBSS_NEW_PEER connected BSS is empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9640 | } |
| 9641 | result = eCSR_ROAM_RESULT_IBSS_CONNECT; |
| 9642 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 9643 | } |
| 9644 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9645 | case eSIR_SME_IBSS_INACTIVE: |
| 9646 | sessionId = csrFindIbssSession( pMac ); |
| 9647 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9648 | { |
| 9649 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9650 | if(!pSession) |
| 9651 | { |
| 9652 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9653 | return; |
| 9654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9655 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 9656 | result = eCSR_ROAM_RESULT_IBSS_INACTIVE; |
| 9657 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 9658 | } |
| 9659 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9660 | case eSIR_SME_JOINED_NEW_BSS: // IBSS coalescing. |
| 9661 | sessionId = csrFindIbssSession( pMac ); |
| 9662 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9663 | { |
| 9664 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9665 | if(!pSession) |
| 9666 | { |
| 9667 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9668 | return; |
| 9669 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9670 | // update the connection state information |
| 9671 | pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9672 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9673 | { |
| 9674 | vos_log_ibss_pkt_type *pIbssLog; |
| 9675 | tANI_U32 bi; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9676 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9677 | if(pIbssLog) |
| 9678 | { |
| 9679 | pIbssLog->eventId = WLAN_IBSS_EVENT_COALESCING; |
| 9680 | if(pNewBss) |
| 9681 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9682 | vos_mem_copy(pIbssLog->bssid, pNewBss->bssId, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9683 | if(pNewBss->ssId.length) |
| 9684 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9685 | vos_mem_copy(pIbssLog->ssid, pNewBss->ssId.ssId, |
| 9686 | pNewBss->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9687 | } |
| 9688 | pIbssLog->operatingChannel = pNewBss->channelNumber; |
| 9689 | } |
| 9690 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 9691 | { |
| 9692 | //***U8 is not enough for beacon interval |
| 9693 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 9694 | } |
| 9695 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9696 | } |
| 9697 | } |
| 9698 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9699 | csrRoamUpdateConnectedProfileFromNewBss( pMac, sessionId, pNewBss ); |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9700 | |
| 9701 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 9702 | pSession->connectedProfile.EncryptionType )) |
| 9703 | { |
| 9704 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 9705 | pSession->connectedProfile.EncryptionType, |
| 9706 | pSession->pConnectBssDesc, |
| 9707 | &Broadcastaddr, |
| 9708 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); |
| 9709 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9710 | result = eCSR_ROAM_RESULT_IBSS_COALESCED; |
| 9711 | roamStatus = eCSR_ROAM_IBSS_IND; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9712 | vos_mem_copy(&roamInfo.bssid, &pNewBss->bssId, |
| 9713 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9714 | pRoamInfo = &roamInfo; |
| 9715 | //This BSSID is th ereal BSSID, let's save it |
| 9716 | if(pSession->pConnectBssDesc) |
| 9717 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9718 | vos_mem_copy(pSession->pConnectBssDesc->bssId, |
| 9719 | &pNewBss->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9720 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9721 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9722 | smsLog(pMac, LOGW, "CSR: eSIR_SME_JOINED_NEW_BSS received from PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9723 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9724 | // detection by LIM that the capabilities of the associated AP have changed. |
| 9725 | case eSIR_SME_AP_CAPS_CHANGED: |
| 9726 | pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9727 | smsLog(pMac, LOGW, "CSR handling eSIR_SME_AP_CAPS_CHANGED"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9728 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pApNewCaps->bssId, &sessionId ); |
| 9729 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9730 | { |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9731 | if ((eCSR_ROAMING_STATE_JOINED == pMac->roam.curState[sessionId]) && |
| 9732 | ((eCSR_ROAM_SUBSTATE_JOINED_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9733 | (eCSR_ROAM_SUBSTATE_NONE == pMac->roam.curSubState[sessionId]) || |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9734 | (eCSR_ROAM_SUBSTATE_JOINED_NON_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
| 9735 | (eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC == pMac->roam.curSubState[sessionId])) |
| 9736 | ) |
| 9737 | { |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9738 | smsLog(pMac, LOGW, "Calling csrRoamDisconnectInternal"); |
| 9739 | csrRoamDisconnectInternal(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9740 | } |
| 9741 | else |
| 9742 | { |
| 9743 | smsLog(pMac, LOGW, |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 9744 | FL("Skipping csrScanForCapabilityChange as " |
| 9745 | "CSR is in state %s and sub-state %s"), |
| 9746 | macTraceGetcsrRoamState( |
| 9747 | pMac->roam.curState[sessionId]), |
| 9748 | macTraceGetcsrRoamSubState( |
| 9749 | pMac->roam.curSubState[sessionId])); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9750 | /* We ignore the caps change event if CSR is not in full connected state. |
| 9751 | * Send one event to PE to reset limSentCapsChangeNtf |
| 9752 | * Once limSentCapsChangeNtf set 0, lim can send sub sequent CAPS change event |
| 9753 | * otherwise lim cannot send any CAPS change events to SME */ |
| 9754 | csrSendResetApCapsChanged(pMac, &pApNewCaps->bssId); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9755 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9756 | } |
| 9757 | break; |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9758 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9759 | default: |
| 9760 | roamStatus = eCSR_ROAM_FAILED; |
| 9761 | result = eCSR_ROAM_RESULT_NONE; |
| 9762 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9763 | } // end switch on statusChangeCode |
| 9764 | if(eCSR_ROAM_RESULT_NONE != result) |
| 9765 | { |
| 9766 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, roamStatus, result); |
| 9767 | } |
| 9768 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9769 | case eWNI_SME_IBSS_NEW_PEER_IND: |
| 9770 | pIbssPeerInd = (tSmeIbssPeerInd *)pSirMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9771 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9772 | { |
| 9773 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9774 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9775 | if(pIbssLog) |
| 9776 | { |
| 9777 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_JOIN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9778 | vos_mem_copy(pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9779 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9780 | } |
| 9781 | } |
| 9782 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9783 | sessionId = csrFindIbssSession( pMac ); |
| 9784 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9785 | { |
| 9786 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9787 | |
| 9788 | if(!pSession) |
| 9789 | { |
| 9790 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9791 | return; |
| 9792 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9793 | // Issue the set Context request to LIM to establish the Unicast STA context for the new peer... |
| 9794 | if(pSession->pConnectBssDesc) |
| 9795 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9796 | vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, |
| 9797 | sizeof(tCsrBssid)); |
| 9798 | vos_mem_copy(&roamInfo.bssid, pSession->pConnectBssDesc->bssId, |
| 9799 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9800 | if(pIbssPeerInd->mesgLen > sizeof(tSmeIbssPeerInd)) |
| 9801 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9802 | roamInfo.pbFrames = vos_mem_malloc((pIbssPeerInd->mesgLen |
| 9803 | - sizeof(tSmeIbssPeerInd))); |
| 9804 | if ( NULL == roamInfo.pbFrames ) |
| 9805 | status = eHAL_STATUS_FAILURE; |
| 9806 | else |
| 9807 | status = eHAL_STATUS_SUCCESS; |
| 9808 | if (HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9809 | { |
| 9810 | roamInfo.nBeaconLength = (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd)); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9811 | vos_mem_copy(roamInfo.pbFrames, |
| 9812 | ((tANI_U8 *)pIbssPeerInd) + sizeof(tSmeIbssPeerInd), |
| 9813 | roamInfo.nBeaconLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9814 | } |
| 9815 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 9816 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 9817 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9818 | roamInfo.pBssDesc = vos_mem_malloc(pSession->pConnectBssDesc->length); |
| 9819 | if ( NULL == roamInfo.pBssDesc ) |
| 9820 | status = eHAL_STATUS_FAILURE; |
| 9821 | else |
| 9822 | status = eHAL_STATUS_SUCCESS; |
| 9823 | if (HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9824 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9825 | vos_mem_copy(roamInfo.pBssDesc, |
| 9826 | pSession->pConnectBssDesc, |
| 9827 | pSession->pConnectBssDesc->length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9828 | } |
| 9829 | if(HAL_STATUS_SUCCESS(status)) |
| 9830 | { |
| 9831 | pRoamInfo = &roamInfo; |
| 9832 | } |
| 9833 | else |
| 9834 | { |
| 9835 | if(roamInfo.pbFrames) |
| 9836 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9837 | vos_mem_free(roamInfo.pbFrames); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9838 | } |
| 9839 | if(roamInfo.pBssDesc) |
| 9840 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9841 | vos_mem_free(roamInfo.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9842 | } |
| 9843 | } |
| 9844 | } |
| 9845 | else |
| 9846 | { |
| 9847 | pRoamInfo = &roamInfo; |
| 9848 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9849 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 9850 | pSession->connectedProfile.EncryptionType )) |
| 9851 | { |
| 9852 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 9853 | pSession->connectedProfile.EncryptionType, |
| 9854 | pSession->pConnectBssDesc, |
| 9855 | &(pIbssPeerInd->peerAddr), |
| 9856 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 9857 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9858 | } |
| 9859 | else |
| 9860 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9861 | smsLog(pMac, LOGW, " CSR eSIR_SME_IBSS_NEW_PEER connected BSS is empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9862 | } |
| 9863 | //send up the sec type for the new peer |
| 9864 | if (pRoamInfo) |
| 9865 | { |
| 9866 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9867 | } |
| 9868 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, |
| 9869 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_NEW_PEER); |
| 9870 | if(pRoamInfo) |
| 9871 | { |
| 9872 | if(roamInfo.pbFrames) |
| 9873 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9874 | vos_mem_free(roamInfo.pbFrames); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9875 | } |
| 9876 | if(roamInfo.pBssDesc) |
| 9877 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9878 | vos_mem_free(roamInfo.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9879 | } |
| 9880 | } |
| 9881 | } |
| 9882 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9883 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 9884 | pIbssPeerInd = (tSmeIbssPeerInd*)pSirMsg; |
| 9885 | sessionId = csrFindIbssSession( pMac ); |
| 9886 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9887 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9888 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9889 | { |
| 9890 | vos_log_ibss_pkt_type *pIbssLog; |
| 9891 | |
| 9892 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9893 | if(pIbssLog) |
| 9894 | { |
| 9895 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_LEAVE; |
| 9896 | if(pIbssPeerInd) |
| 9897 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9898 | vos_mem_copy(pIbssLog->peerMacAddr, |
| 9899 | &pIbssPeerInd->peerAddr, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9900 | } |
| 9901 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9902 | } |
| 9903 | } |
| 9904 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9905 | smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9906 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 9907 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 9908 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9909 | vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, |
| 9910 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9911 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 9912 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 9913 | } |
| 9914 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9915 | case eWNI_SME_SETCONTEXT_RSP: |
| 9916 | { |
| 9917 | tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *)pSirMsg; |
| 9918 | tListElem *pEntry; |
| 9919 | tSmeCmd *pCommand; |
| 9920 | |
| 9921 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9922 | if ( pEntry ) |
| 9923 | { |
| 9924 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9925 | if ( eSmeCommandSetKey == pCommand->command ) |
| 9926 | { |
Sandeep Puligilla | 9f38474 | 2014-04-11 02:27:04 +0530 | [diff] [blame] | 9927 | sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9928 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9929 | |
| 9930 | if(!pSession) |
| 9931 | { |
| 9932 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9933 | return; |
| 9934 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9935 | |
| 9936 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9937 | if(eCSR_ENCRYPT_TYPE_NONE != pSession->connectedProfile.EncryptionType) |
| 9938 | { |
| 9939 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9940 | vos_mem_set(&setKeyEvent, |
| 9941 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9942 | if( pRsp->peerMacAddr[0] & 0x01 ) |
| 9943 | { |
| 9944 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 9945 | } |
| 9946 | else |
| 9947 | { |
| 9948 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 9949 | } |
| 9950 | setKeyEvent.encryptionModeMulticast = |
| 9951 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9952 | setKeyEvent.encryptionModeUnicast = |
| 9953 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9954 | vos_mem_copy(setKeyEvent.bssid, |
| 9955 | pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9956 | setKeyEvent.authMode = |
| 9957 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9958 | if( eSIR_SME_SUCCESS != pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9959 | { |
| 9960 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 9961 | } |
| 9962 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 9963 | } |
| 9964 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9965 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 9966 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9967 | csrRoamStopWaitForKeyTimer( pMac ); |
| 9968 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9969 | //We are done with authentication, whethere succeed or not |
| 9970 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9971 | //We do it here because this linkup function is not called after association |
| 9972 | //when a key needs to be set. |
| 9973 | if( csrIsConnStateConnectedInfra(pMac, sessionId) ) |
| 9974 | { |
| 9975 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 9976 | } |
| 9977 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9978 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9979 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9980 | vos_mem_copy(&roamInfo.peerMac, |
| 9981 | &pRsp->peerMacAddr, sizeof(tCsrBssid)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9982 | //Make sure we install the GTK before indicating to HDD as authenticated |
| 9983 | //This is to prevent broadcast packets go out after PTK and before GTK. |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9984 | if ( vos_mem_compare( &Broadcastaddr, pRsp->peerMacAddr, |
| 9985 | sizeof(tSirMacAddr) ) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9986 | { |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 9987 | #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE |
| 9988 | if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE) |
| 9989 | { |
| 9990 | tpSirSetActiveModeSetBncFilterReq pMsg; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9991 | pMsg = vos_mem_malloc(sizeof(tSirSetActiveModeSetBncFilterReq)); |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 9992 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_BCN_FILTER_REQ); |
| 9993 | pMsg->length = pal_cpu_to_be16(sizeof( tANI_U8)); |
| 9994 | pMsg->seesionId = sessionId; |
| 9995 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 9996 | } |
| 9997 | #endif |
Sandeep Puligilla | 9f38474 | 2014-04-11 02:27:04 +0530 | [diff] [blame] | 9998 | /* OBSS SCAN Indication will be sent to Firmware to start OBSS Scan */ |
Sandeep Puligilla | 332ea91 | 2014-02-04 00:16:24 +0530 | [diff] [blame] | 9999 | if( CSR_IS_CHANNEL_24GHZ(pSession->connectedProfile.operationChannel) |
| 10000 | && IS_HT40_OBSS_SCAN_FEATURE_ENABLE ) |
| 10001 | { |
| 10002 | tpSirSmeHT40OBSSScanInd pMsg; |
| 10003 | pMsg = vos_mem_malloc(sizeof(tSirSmeHT40OBSSScanInd)); |
| 10004 | pMsg->messageType = |
| 10005 | pal_cpu_to_be16((tANI_U16)eWNI_SME_HT40_OBSS_SCAN_IND); |
| 10006 | pMsg->length = |
Sandeep Puligilla | 9f38474 | 2014-04-11 02:27:04 +0530 | [diff] [blame] | 10007 | pal_cpu_to_be16(sizeof( tSirSmeHT40OBSSScanInd)); |
| 10008 | vos_mem_copy(pMsg->peerMacAddr, |
| 10009 | pSession->connectedProfile.bssid, |
| 10010 | sizeof(tSirMacAddr)); |
Sandeep Puligilla | 332ea91 | 2014-02-04 00:16:24 +0530 | [diff] [blame] | 10011 | status = palSendMBMessage(pMac->hHdd, |
| 10012 | pMsg ); |
| 10013 | } |
| 10014 | result = eCSR_ROAM_RESULT_AUTHENTICATED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10015 | } |
| 10016 | else |
| 10017 | { |
| 10018 | result = eCSR_ROAM_RESULT_NONE; |
| 10019 | } |
Sandeep Puligilla | 9f38474 | 2014-04-11 02:27:04 +0530 | [diff] [blame] | 10020 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10021 | } |
| 10022 | else |
| 10023 | { |
| 10024 | result = eCSR_ROAM_RESULT_FAILURE; |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 10025 | smsLog(pMac, LOGE, "CSR: Roam Completion setkey " |
| 10026 | "command failed(%d) PeerMac "MAC_ADDRESS_STR, |
| 10027 | pRsp->statusCode, MAC_ADDR_ARRAY(pRsp->peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10028 | } |
| 10029 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 10030 | eCSR_ROAM_SET_KEY_COMPLETE, result); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10031 | // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS |
| 10032 | // can go ahead and initiate the TSPEC if any are pending |
| 10033 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_SET_KEY_SUCCESS_IND, NULL); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10034 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10035 | //Send Adjacent AP repot to new AP. |
| 10036 | if (result == eCSR_ROAM_RESULT_AUTHENTICATED && |
| 10037 | pSession->isPrevApInfoValid && |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10038 | pSession->connectedProfile.isESEAssoc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10039 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10040 | #ifdef FEATURE_WLAN_ESE_UPLOAD |
| 10041 | csrSendEseAdjacentApRepInd(pMac, pSession); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 10042 | #else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10043 | csrEseSendAdjacentApRepMsg(pMac, pSession); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10044 | #endif |
| 10045 | pSession->isPrevApInfoValid = FALSE; |
| 10046 | } |
| 10047 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10048 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10049 | { |
| 10050 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 10051 | } |
| 10052 | } |
| 10053 | else |
| 10054 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10055 | smsLog( pMac, LOGE, "CSR: Roam Completion called but setkey command is not ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10056 | } |
| 10057 | } |
| 10058 | else |
| 10059 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10060 | smsLog( pMac, LOGE, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10061 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10062 | smeProcessPendingQueue( pMac ); |
| 10063 | } |
| 10064 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10065 | case eWNI_SME_REMOVEKEY_RSP: |
| 10066 | { |
| 10067 | tSirSmeRemoveKeyRsp *pRsp = (tSirSmeRemoveKeyRsp *)pSirMsg; |
| 10068 | tListElem *pEntry; |
| 10069 | tSmeCmd *pCommand; |
| 10070 | |
| 10071 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 10072 | if ( pEntry ) |
| 10073 | { |
| 10074 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 10075 | if ( eSmeCommandRemoveKey == pCommand->command ) |
| 10076 | { |
| 10077 | sessionId = pCommand->sessionId; |
| 10078 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10079 | |
| 10080 | if(!pSession) |
| 10081 | { |
| 10082 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10083 | return; |
| 10084 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10085 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10086 | { |
| 10087 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10088 | vos_mem_set(&removeKeyEvent, |
| 10089 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10090 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
| 10091 | removeKeyEvent.encryptionModeMulticast = |
| 10092 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 10093 | removeKeyEvent.encryptionModeUnicast = |
| 10094 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10095 | vos_mem_copy( removeKeyEvent.bssid, |
| 10096 | pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10097 | removeKeyEvent.authMode = |
| 10098 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 10099 | if( eSIR_SME_SUCCESS != pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10100 | { |
| 10101 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 10102 | } |
| 10103 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 10104 | } |
| 10105 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 10106 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10107 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10108 | vos_mem_copy(&roamInfo.peerMac, &pRsp->peerMacAddr, |
| 10109 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10110 | result = eCSR_ROAM_RESULT_NONE; |
| 10111 | pRoamInfo = &roamInfo; |
| 10112 | } |
| 10113 | else |
| 10114 | { |
| 10115 | result = eCSR_ROAM_RESULT_FAILURE; |
| 10116 | } |
| 10117 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 10118 | eCSR_ROAM_REMOVE_KEY_COMPLETE, result); |
| 10119 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10120 | { |
| 10121 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 10122 | } |
| 10123 | } |
| 10124 | else |
| 10125 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10126 | smsLog( pMac, LOGW, "CSR: Roam Completion called but setkey command is not ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10127 | } |
| 10128 | } |
| 10129 | else |
| 10130 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10131 | smsLog( pMac, LOGW, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10132 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10133 | smeProcessPendingQueue( pMac ); |
| 10134 | } |
| 10135 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10136 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10137 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10138 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 10139 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10140 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 10141 | case eWNI_SME_GET_ROAM_RSSI_RSP: |
| 10142 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
| 10143 | csrRoamRssiRspProcessor( pMac, pSirMsg ); |
| 10144 | break; |
| 10145 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10146 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 10147 | case eWNI_SME_GET_TSM_STATS_RSP: |
| 10148 | smsLog( pMac, LOG2, FL("TSM Stats rsp from PE")); |
| 10149 | csrTsmStatsRspProcessor( pMac, pSirMsg ); |
| 10150 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10151 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10152 | case eWNI_SME_GET_RSSI_REQ: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10153 | smsLog( pMac, LOG2, FL("GetRssiReq from self")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10154 | csrUpdateRssi( pMac, pSirMsg ); |
| 10155 | break; |
| 10156 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 10157 | case eWNI_SME_GET_SNR_REQ: |
| 10158 | smsLog( pMac, LOG2, FL("GetSnrReq from self")); |
| 10159 | csrUpdateSnr(pMac, pSirMsg); |
| 10160 | break; |
| 10161 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10162 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10163 | case eWNI_SME_FT_PRE_AUTH_RSP: |
| 10164 | csrRoamFTPreAuthRspProcessor( pMac, (tpSirFTPreAuthRsp)pSirMsg ); |
| 10165 | break; |
| 10166 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10167 | case eWNI_SME_MAX_ASSOC_EXCEEDED: |
| 10168 | pSmeMaxAssocInd = (tSmeMaxAssocInd*)pSirMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10169 | smsLog( pMac, LOG1, FL("send indication that max assoc have been reached and the new peer cannot be accepted")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10170 | sessionId = pSmeMaxAssocInd->sessionId; |
| 10171 | roamInfo.sessionId = sessionId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10172 | vos_mem_copy(&roamInfo.peerMac, pSmeMaxAssocInd->peerMac, |
| 10173 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10174 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 10175 | eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED); |
| 10176 | break; |
| 10177 | |
| 10178 | case eWNI_SME_BTAMP_LOG_LINK_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10179 | smsLog( pMac, LOG1, FL("Establish logical link req from HCI serialized through MC thread")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10180 | btampEstablishLogLinkHdlr( pSirMsg ); |
| 10181 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10182 | case eWNI_SME_RSSI_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10183 | smsLog( pMac, LOG1, FL("RSSI indication from TL serialized through MC thread")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10184 | csrRoamRssiIndHdlr( pMac, pSirMsg ); |
| 10185 | break; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 10186 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 10187 | case eWNI_SME_CANDIDATE_FOUND_IND: |
| 10188 | smsLog( pMac, LOG2, FL("Candidate found indication from PE")); |
| 10189 | csrNeighborRoamCandidateFoundIndHdlr( pMac, pSirMsg ); |
| 10190 | break; |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 10191 | case eWNI_SME_HANDOFF_REQ: |
| 10192 | smsLog( pMac, LOG2, FL("Handoff Req from self")); |
| 10193 | csrNeighborRoamHandoffReqHdlr( pMac, pSirMsg ); |
| 10194 | break; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 10195 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10196 | |
| 10197 | default: |
| 10198 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10199 | } // end switch on message type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10200 | } |
| 10201 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10202 | void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, |
| 10203 | tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult) |
| 10204 | { |
| 10205 | if(pSession) |
| 10206 | { |
| 10207 | if(pSession->bRefAssocStartCnt) |
| 10208 | { |
| 10209 | pSession->bRefAssocStartCnt--; |
| 10210 | VOS_ASSERT( pSession->bRefAssocStartCnt == 0); |
| 10211 | //Need to call association_completion because there is an assoc_start pending. |
| 10212 | csrRoamCallCallback(pMac, pSession->sessionId, NULL, roamId, |
| 10213 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 10214 | eCSR_ROAM_RESULT_FAILURE); |
| 10215 | } |
| 10216 | csrRoamCallCallback(pMac, pSession->sessionId, pRoamInfo, roamId, eCSR_ROAM_ROAMING_COMPLETION, roamResult); |
| 10217 | } |
| 10218 | else |
| 10219 | { |
| 10220 | smsLog(pMac, LOGW, FL(" pSession is NULL")); |
| 10221 | } |
| 10222 | } |
| 10223 | |
| 10224 | |
| 10225 | eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason) |
| 10226 | { |
| 10227 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10228 | if(CSR_IS_LOSTLINK_ROAMING(roamingReason) && |
| 10229 | (eANI_BOOLEAN_FALSE == pMac->roam.roamSession[sessionId].fCancelRoaming)) |
| 10230 | { |
| 10231 | status = csrScanRequestLostLink1( pMac, sessionId ); |
| 10232 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10233 | return(status); |
| 10234 | } |
| 10235 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10236 | //return a boolean to indicate whether roaming completed or continue. |
| 10237 | tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 10238 | tANI_BOOLEAN fForce, eCsrRoamResult roamResult) |
| 10239 | { |
| 10240 | tANI_BOOLEAN fCompleted = eANI_BOOLEAN_TRUE; |
| 10241 | tANI_TIMESTAMP roamTime = (tANI_TIMESTAMP)(pMac->roam.configParam.nRoamingTime * PAL_TICKS_PER_SECOND); |
| 10242 | tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 10243 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10244 | if(!pSession) |
| 10245 | { |
| 10246 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10247 | return eANI_BOOLEAN_FALSE; |
| 10248 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10249 | //Check whether time is up |
| 10250 | if(pSession->fCancelRoaming || fForce || |
| 10251 | ((curTime - pSession->roamingStartTime) > roamTime) || |
| 10252 | eCsrReassocRoaming == pSession->roamingReason || |
| 10253 | eCsrDynamicRoaming == pSession->roamingReason) |
| 10254 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10255 | smsLog(pMac, LOGW, FL(" indicates roaming completion")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10256 | if(pSession->fCancelRoaming && CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason)) |
| 10257 | { |
| 10258 | //roaming is cancelled, tell HDD to indicate disconnect |
| 10259 | //Because LIM overload deauth_ind for both deauth frame and missed beacon |
| 10260 | //we need to use this logic to detinguish it. For missed beacon, LIM set reason |
| 10261 | //to be eSIR_BEACON_MISSED |
| 10262 | if(eSIR_BEACON_MISSED == pSession->roamingStatusCode) |
| 10263 | { |
| 10264 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 10265 | } |
| 10266 | else if(eCsrLostlinkRoamingDisassoc == pSession->roamingReason) |
| 10267 | { |
| 10268 | roamResult = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 10269 | } |
| 10270 | else if(eCsrLostlinkRoamingDeauth == pSession->roamingReason) |
| 10271 | { |
| 10272 | roamResult = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 10273 | } |
| 10274 | else |
| 10275 | { |
| 10276 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 10277 | } |
| 10278 | } |
| 10279 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 10280 | pSession->roamingReason = eCsrNotRoaming; |
| 10281 | } |
| 10282 | else |
| 10283 | { |
| 10284 | pSession->roamResult = roamResult; |
| 10285 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoamingTimer(pMac, sessionId, PAL_TIMER_TO_SEC_UNIT))) |
| 10286 | { |
| 10287 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 10288 | pSession->roamingReason = eCsrNotRoaming; |
| 10289 | } |
| 10290 | else |
| 10291 | { |
| 10292 | fCompleted = eANI_BOOLEAN_FALSE; |
| 10293 | } |
| 10294 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10295 | return(fCompleted); |
| 10296 | } |
| 10297 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10298 | void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10299 | { |
| 10300 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10301 | |
| 10302 | if(!pSession) |
| 10303 | { |
| 10304 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10305 | return; |
| 10306 | } |
| 10307 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10308 | if(CSR_IS_ROAMING(pSession)) |
| 10309 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10310 | smsLog(pMac, LOGW, " Cancelling roaming"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10311 | pSession->fCancelRoaming = eANI_BOOLEAN_TRUE; |
| 10312 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 10313 | { |
| 10314 | //No need to do anything in here because the handler takes care of it |
| 10315 | } |
| 10316 | else |
| 10317 | { |
| 10318 | eCsrRoamResult roamResult = CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason) ? |
| 10319 | eCSR_ROAM_RESULT_LOSTLINK : eCSR_ROAM_RESULT_NONE; |
| 10320 | //Roaming is stopped after here |
| 10321 | csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_TRUE, roamResult); |
| 10322 | //Since CSR may be in lostlink roaming situation, abort all roaming related activities |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 10323 | csrScanAbortMacScan(pMac, sessionId, eCSR_SCAN_ABORT_DEFAULT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10324 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 10325 | } |
| 10326 | } |
| 10327 | } |
| 10328 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10329 | void csrRoamRoamingTimerHandler(void *pv) |
| 10330 | { |
| 10331 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 10332 | tpAniSirGlobal pMac = pInfo->pMac; |
| 10333 | tANI_U32 sessionId = pInfo->sessionId; |
| 10334 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10335 | |
| 10336 | if(!pSession) |
| 10337 | { |
| 10338 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10339 | return; |
| 10340 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10341 | |
| 10342 | if(eANI_BOOLEAN_FALSE == pSession->fCancelRoaming) |
| 10343 | { |
| 10344 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoaming(pMac, sessionId, pSession->roamingReason))) |
| 10345 | { |
| 10346 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, pSession->roamResult); |
| 10347 | pSession->roamingReason = eCsrNotRoaming; |
| 10348 | } |
| 10349 | } |
| 10350 | } |
| 10351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10352 | eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 10353 | { |
| 10354 | eHalStatus status; |
| 10355 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10356 | |
| 10357 | if(!pSession) |
| 10358 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10359 | smsLog(pMac, LOGE, FL(" session %d not found"), sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10360 | return eHAL_STATUS_FAILURE; |
| 10361 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10362 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10363 | smsLog(pMac, LOG1, " csrScanStartRoamingTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10364 | pSession->roamingTimerInfo.sessionId = (tANI_U8)sessionId; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10365 | status = vos_timer_start(&pSession->hTimerRoaming, interval/PAL_TIMER_TO_MS_UNIT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10366 | |
| 10367 | return (status); |
| 10368 | } |
| 10369 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10370 | eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10371 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10372 | return (vos_timer_stop(&pMac->roam.roamSession[sessionId].hTimerRoaming)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10373 | } |
| 10374 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10375 | void csrRoamWaitForKeyTimeOutHandler(void *pv) |
| 10376 | { |
| 10377 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 10378 | tpAniSirGlobal pMac = pInfo->pMac; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10379 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pInfo->sessionId ); |
Leela Venkata Kiran Kumar Reddy Chirala | ecc44b9 | 2013-12-13 20:14:35 -0800 | [diff] [blame] | 10380 | eHalStatus status = eHAL_STATUS_FAILURE; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10381 | |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 10382 | smsLog(pMac, LOGW, FL("WaitForKey timer expired in state=%s sub-state=%s"), |
| 10383 | macTraceGetNeighbourRoamState( |
| 10384 | pMac->roam.neighborRoamInfo.neighborRoamState), |
| 10385 | macTraceGetcsrRoamSubState( |
| 10386 | pMac->roam.curSubState[pInfo->sessionId])); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10387 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10388 | if( CSR_IS_WAIT_FOR_KEY( pMac, pInfo->sessionId ) ) |
| 10389 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10390 | #ifdef FEATURE_WLAN_LFR |
| 10391 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 10392 | { |
| 10393 | /* |
| 10394 | * Enable heartbeat timer when hand-off is in progress |
| 10395 | * and Key Wait timer expired. |
| 10396 | */ |
| 10397 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey expiry" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10398 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10399 | pMac->roam.configParam.HeartbeatThresh24); |
| 10400 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 10401 | pMac->roam.configParam.HeartbeatThresh24, |
| 10402 | NULL, eANI_BOOLEAN_FALSE); |
| 10403 | } |
| 10404 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10405 | smsLog(pMac, LOGW, " SME pre-auth state timeout. "); |
Praveen Kumar Sirisilla | 8bdfac4 | 2013-10-10 17:20:48 -0700 | [diff] [blame] | 10406 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10407 | //Change the substate so command queue is unblocked. |
Praveen Kumar Sirisilla | 8bdfac4 | 2013-10-10 17:20:48 -0700 | [diff] [blame] | 10408 | if (CSR_ROAM_SESSION_MAX > pInfo->sessionId) |
| 10409 | { |
| 10410 | csrRoamSubstateChange(pMac, eCSR_ROAM_SUBSTATE_NONE, |
| 10411 | pInfo->sessionId); |
| 10412 | } |
| 10413 | |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10414 | if (pSession) |
| 10415 | { |
| 10416 | if( csrIsConnStateConnectedInfra(pMac, pInfo->sessionId) ) |
| 10417 | { |
| 10418 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 10419 | smeProcessPendingQueue(pMac); |
Leela Venkata Kiran Kumar Reddy Chirala | ecc44b9 | 2013-12-13 20:14:35 -0800 | [diff] [blame] | 10420 | if( (pSession->connectedProfile.AuthType == |
| 10421 | eCSR_AUTH_TYPE_SHARED_KEY) && |
| 10422 | ( (pSession->connectedProfile.EncryptionType == |
| 10423 | eCSR_ENCRYPT_TYPE_WEP40) || |
| 10424 | (pSession->connectedProfile.EncryptionType == |
| 10425 | eCSR_ENCRYPT_TYPE_WEP104) )) |
| 10426 | { |
| 10427 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 10428 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 10429 | { |
| 10430 | csrRoamDisconnect( pMac, pInfo->sessionId, |
| 10431 | eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 10432 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 10433 | } |
| 10434 | } |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10435 | } |
| 10436 | else |
| 10437 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10438 | smsLog(pMac, LOGW, "%s: could not post link up", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10439 | __func__); |
| 10440 | } |
| 10441 | } |
| 10442 | else |
| 10443 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10444 | smsLog(pMac, LOGW, "%s: session not found", __func__); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10445 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10446 | } |
| 10447 | |
| 10448 | } |
| 10449 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10450 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval) |
| 10451 | { |
| 10452 | eHalStatus status; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10453 | #ifdef FEATURE_WLAN_LFR |
| 10454 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 10455 | { |
| 10456 | /* Disable heartbeat timer when hand-off is in progress */ |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 10457 | smsLog(pMac, LOG2, FL("disabling HB timer in state=%s sub-state=%s"), |
| 10458 | macTraceGetNeighbourRoamState( |
| 10459 | pMac->roam.neighborRoamInfo.neighborRoamState), |
| 10460 | macTraceGetcsrRoamSubState( |
| 10461 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId] |
| 10462 | )); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10463 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE); |
| 10464 | } |
| 10465 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10466 | smsLog(pMac, LOG1, " csrScanStartWaitForKeyTimer"); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10467 | status = vos_timer_start(&pMac->roam.hTimerWaitForKey, interval/PAL_TIMER_TO_MS_UNIT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10468 | |
| 10469 | return (status); |
| 10470 | } |
| 10471 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10472 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac) |
| 10473 | { |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 10474 | smsLog(pMac, LOG2, FL("WaitForKey timer stopped in state=%s sub-state=%s"), |
| 10475 | macTraceGetNeighbourRoamState( |
| 10476 | pMac->roam.neighborRoamInfo.neighborRoamState), |
| 10477 | macTraceGetcsrRoamSubState( |
| 10478 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId])); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10479 | #ifdef FEATURE_WLAN_LFR |
| 10480 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 10481 | { |
| 10482 | /* |
| 10483 | * Enable heartbeat timer when hand-off is in progress |
| 10484 | * and Key Wait timer got stopped for some reason |
| 10485 | */ |
| 10486 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey stop" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10487 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10488 | pMac->roam.configParam.HeartbeatThresh24); |
| 10489 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 10490 | pMac->roam.configParam.HeartbeatThresh24, |
| 10491 | NULL, eANI_BOOLEAN_FALSE); |
| 10492 | } |
| 10493 | #endif |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10494 | return (vos_timer_stop(&pMac->roam.hTimerWaitForKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10495 | } |
| 10496 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10497 | void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, |
| 10498 | eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess) |
| 10499 | { |
| 10500 | eRoamCmdStatus roamStatus = csrGetRoamCompleteStatus(pMac, sessionId); |
| 10501 | tANI_U32 roamId = 0; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10502 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10503 | /* To silence the KW tool Null chaeck is added */ |
| 10504 | if(!pSession) |
| 10505 | { |
| 10506 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10507 | return; |
| 10508 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10509 | |
| 10510 | if(pCommand) |
| 10511 | { |
| 10512 | roamId = pCommand->u.roamCmd.roamId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10513 | VOS_ASSERT( sessionId == pCommand->sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10514 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10515 | if(eCSR_ROAM_ROAMING_COMPLETION == roamStatus) |
| 10516 | { |
| 10517 | //if success, force roaming completion |
| 10518 | csrRoamCompleteRoaming(pMac, sessionId, fSuccess, roamResult); |
| 10519 | } |
| 10520 | else |
| 10521 | { |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10522 | VOS_ASSERT(pSession->bRefAssocStartCnt == 0); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10523 | smsLog(pMac, LOGW, FL(" indicates association completion. roamResult = %d"), roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10524 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, roamId, roamStatus, roamResult); |
| 10525 | } |
| 10526 | } |
| 10527 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10528 | eHalStatus csrRoamLostLink( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 type, tSirSmeRsp *pSirMsg) |
| 10529 | { |
| 10530 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10531 | tSirSmeDeauthInd *pDeauthIndMsg = NULL; |
| 10532 | tSirSmeDisassocInd *pDisassocIndMsg = NULL; |
| 10533 | eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK; |
| 10534 | tCsrRoamInfo *pRoamInfo = NULL; |
| 10535 | tCsrRoamInfo roamInfo; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10536 | tANI_BOOLEAN fToRoam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10537 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10538 | /* To silence the KW tool Null chaeck is added */ |
| 10539 | if(!pSession) |
| 10540 | { |
| 10541 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10542 | return eHAL_STATUS_FAILURE; |
| 10543 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10544 | //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] | 10545 | fToRoam = CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10546 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
| 10547 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 10548 | { |
| 10549 | result = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 10550 | pDisassocIndMsg = (tSirSmeDisassocInd *)pSirMsg; |
| 10551 | pSession->roamingStatusCode = pDisassocIndMsg->statusCode; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 10552 | pSession->joinFailStatusCode.reasonCode = pDisassocIndMsg->reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10553 | } |
| 10554 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 10555 | { |
| 10556 | result = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 10557 | pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg; |
| 10558 | pSession->roamingStatusCode = pDeauthIndMsg->statusCode; |
Madan Mohan Koyyalamudi | 6a80893 | 2012-11-06 16:05:54 -0800 | [diff] [blame] | 10559 | /* Convert into proper reason code */ |
| 10560 | pSession->joinFailStatusCode.reasonCode = |
| 10561 | (pDeauthIndMsg->reasonCode == eSIR_BEACON_MISSED) ? |
Agarwal Ashish | 838f1f3 | 2013-03-11 20:54:52 +0530 | [diff] [blame] | 10562 | 0 : pDeauthIndMsg->reasonCode; |
| 10563 | /* cfg layer expects 0 as reason code if |
| 10564 | the driver dosent know the reason code |
| 10565 | eSIR_BEACON_MISSED is defined as locally */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10566 | } |
| 10567 | else |
| 10568 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10569 | smsLog(pMac, LOGW, FL("gets an unknown type (%d)"), type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10570 | result = eCSR_ROAM_RESULT_NONE; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 10571 | pSession->joinFailStatusCode.reasonCode = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10572 | } |
| 10573 | |
| 10574 | // call profile lost link routine here |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10575 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10576 | { |
| 10577 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_LOSTLINK_DETECTED, result); |
| 10578 | } |
| 10579 | |
| 10580 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 10581 | { |
| 10582 | status = csrSendMBDisassocCnfMsg(pMac, pDisassocIndMsg); |
| 10583 | } |
| 10584 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 10585 | { |
| 10586 | status = csrSendMBDeauthCnfMsg(pMac, pDeauthIndMsg); |
| 10587 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10588 | if(!HAL_STATUS_SUCCESS(status)) |
| 10589 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10590 | //If fail to send confirmation to PE, not to trigger roaming |
| 10591 | fToRoam = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10592 | } |
| 10593 | |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10594 | //prepare to tell HDD to disconnect |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10595 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10596 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 10597 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10598 | if( eWNI_SME_DISASSOC_IND == type) |
| 10599 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10600 | //staMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10601 | vos_mem_copy(roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, |
| 10602 | sizeof(tSirMacAddr)); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10603 | roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId; |
| 10604 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10605 | else if( eWNI_SME_DEAUTH_IND == type ) |
| 10606 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10607 | //staMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10608 | vos_mem_copy(roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, |
| 10609 | sizeof(tSirMacAddr)); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10610 | roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId; |
| 10611 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10612 | smsLog(pMac, LOGW, FL("roamInfo.staId (%d)"), roamInfo.staId); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10613 | |
| 10614 | /* See if we can possibly roam. If so, start the roaming process and notify HDD |
| 10615 | that we are roaming. But if we cannot possibly roam, or if we are unable to |
| 10616 | currently roam, then notify HDD of the lost link */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10617 | if(fToRoam) |
| 10618 | { |
| 10619 | //Only remove the connected BSS in infrastructure mode |
| 10620 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 10621 | //Not to do anying for lostlink with WDS |
| 10622 | if( pMac->roam.configParam.nRoamingTime ) |
| 10623 | { |
| 10624 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac, sessionId, |
| 10625 | ( eWNI_SME_DEAUTH_IND == type ) ? |
| 10626 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc))) |
| 10627 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10628 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10629 | //For IBSS, we need to give some more info to HDD |
| 10630 | if(csrIsBssTypeIBSS(pSession->connectedProfile.BSSType)) |
| 10631 | { |
| 10632 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 10633 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 10634 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 10635 | } |
| 10636 | else |
| 10637 | { |
| 10638 | roamInfo.reasonCode = eCsrRoamReasonSmeIssuedForLostLink; |
| 10639 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10640 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10641 | pSession->roamingReason = ( eWNI_SME_DEAUTH_IND == type ) ? |
| 10642 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc; |
| 10643 | pSession->roamingStartTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 10644 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_LOSTLINK); |
| 10645 | } |
| 10646 | else |
| 10647 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10648 | smsLog(pMac, LOGW, " %s Fail to start roaming, status = %d", __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10649 | fToRoam = eANI_BOOLEAN_FALSE; |
| 10650 | } |
| 10651 | } |
| 10652 | else |
| 10653 | { |
| 10654 | //We are told not to roam, indicate lostlink |
| 10655 | fToRoam = eANI_BOOLEAN_FALSE; |
| 10656 | } |
| 10657 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10658 | if(!fToRoam) |
| 10659 | { |
Madan Mohan Koyyalamudi | af854cf | 2012-10-30 17:56:25 -0700 | [diff] [blame] | 10660 | //Tell HDD about the lost link |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10661 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 10662 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10663 | /* Don't call csrRoamCallCallback for GO/SoftAp case as this indication |
| 10664 | * was already given as part of eWNI_SME_DISASSOC_IND msg handling in |
| 10665 | * csrRoamCheckForLinkStatusChange API. |
| 10666 | */ |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 10667 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result); |
| 10668 | } |
| 10669 | |
| 10670 | /*No need to start idle scan in case of IBSS/SAP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10671 | Still enable idle scan for polling in case concurrent sessions are running */ |
| 10672 | if(CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile)) |
| 10673 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10674 | csrScanStartIdleScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10675 | } |
| 10676 | } |
| 10677 | |
| 10678 | return (status); |
| 10679 | } |
| 10680 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10681 | eHalStatus csrRoamLostLinkAfterhandoffFailure( tpAniSirGlobal pMac,tANI_U32 sessionId) |
| 10682 | { |
| 10683 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10684 | tListElem *pEntry = NULL; |
| 10685 | tSmeCmd *pCommand = NULL; |
| 10686 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10687 | |
| 10688 | if(!pSession) |
| 10689 | { |
| 10690 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10691 | return eHAL_STATUS_FAILURE; |
| 10692 | } |
| 10693 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10694 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10695 | //Only remove the connected BSS in infrastructure mode |
| 10696 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 10697 | if(pMac->roam.configParam.nRoamingTime) |
| 10698 | { |
| 10699 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac,sessionId, pSession->roamingReason))) |
| 10700 | { |
| 10701 | //before starting the lost link logic release the roam command for handoff |
| 10702 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 10703 | if(pEntry) |
| 10704 | { |
| 10705 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 10706 | } |
| 10707 | if(pCommand) |
| 10708 | { |
| 10709 | if (( eSmeCommandRoam == pCommand->command ) && |
| 10710 | ( eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)) |
| 10711 | { |
| 10712 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10713 | { |
| 10714 | csrReleaseCommandRoam( pMac, pCommand ); |
| 10715 | } |
| 10716 | } |
| 10717 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10718 | smsLog( pMac, LOGW, "Lost link roaming started ..."); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10719 | } |
| 10720 | } |
| 10721 | else |
| 10722 | { |
| 10723 | //We are told not to roam, indicate lostlink |
| 10724 | status = eHAL_STATUS_FAILURE; |
| 10725 | } |
| 10726 | |
| 10727 | return (status); |
| 10728 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10729 | void csrRoamWmStatusChangeComplete( tpAniSirGlobal pMac ) |
| 10730 | { |
| 10731 | tListElem *pEntry; |
| 10732 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10733 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 10734 | if ( pEntry ) |
| 10735 | { |
| 10736 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 10737 | if ( eSmeCommandWmStatusChange == pCommand->command ) |
| 10738 | { |
| 10739 | // Nothing to process in a Lost Link completion.... It just kicks off a |
| 10740 | // roaming sequence. |
| 10741 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10742 | { |
| 10743 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 10744 | } |
| 10745 | else |
| 10746 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10747 | smsLog( pMac, LOGE, " ******csrRoamWmStatusChangeComplete fail to release command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10748 | } |
| 10749 | |
| 10750 | } |
| 10751 | else |
| 10752 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10753 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but LOST LINK command is not ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10754 | } |
| 10755 | } |
| 10756 | else |
| 10757 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10758 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10759 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10760 | smeProcessPendingQueue( pMac ); |
| 10761 | } |
| 10762 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10763 | void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 10764 | { |
| 10765 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 10766 | tSirSmeRsp *pSirSmeMsg; |
| 10767 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pCommand->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10768 | |
| 10769 | if(!pSession) |
| 10770 | { |
| 10771 | smsLog(pMac, LOGE, FL(" session %d not found "), pCommand->sessionId); |
| 10772 | return; |
| 10773 | } |
| 10774 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10775 | switch ( pCommand->u.wmStatusChangeCmd.Type ) |
| 10776 | { |
| 10777 | case eCsrDisassociated: |
| 10778 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg; |
| 10779 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DISASSOC_IND, pSirSmeMsg); |
| 10780 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10781 | case eCsrDeauthenticated: |
| 10782 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg; |
| 10783 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DEAUTH_IND, pSirSmeMsg); |
| 10784 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10785 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10786 | smsLog(pMac, LOGW, FL("gets an unknown command %d"), pCommand->u.wmStatusChangeCmd.Type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10787 | break; |
| 10788 | } |
| 10789 | //For WDS, we want to stop BSS as well when it is indicated that it is disconnected. |
| 10790 | if( CSR_IS_CONN_WDS(&pSession->connectedProfile) ) |
| 10791 | { |
| 10792 | if( !HAL_STATUS_SUCCESS(csrRoamIssueStopBssCmd( pMac, pCommand->sessionId, eANI_BOOLEAN_TRUE )) ) |
| 10793 | { |
| 10794 | //This is not good |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10795 | smsLog(pMac, LOGE, FL(" failed to issue stopBSS command")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10796 | } |
| 10797 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10798 | // Lost Link just triggers a roaming sequence. We can complte the Lost Link |
| 10799 | // command here since there is nothing else to do. |
| 10800 | csrRoamWmStatusChangeComplete( pMac ); |
| 10801 | } |
| 10802 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10803 | //This function returns band and mode information. |
| 10804 | //The only tricky part is that if phyMode is set to 11abg, this function may return eCSR_CFG_DOT11_MODE_11B |
| 10805 | //instead of eCSR_CFG_DOT11_MODE_11G if everything is set to auto-pick. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10806 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 10807 | tANI_U8 operationChn, eCsrBand *pBand ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10808 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10809 | eCsrPhyMode phyModeIn = (eCsrPhyMode)pProfile->phyMode; |
| 10810 | eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pProfile, phyModeIn, |
| 10811 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10812 | eCsrBand eBand; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 10813 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10814 | //If the global setting for dot11Mode is set to auto/abg, we overwrite the setting in the profile. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10815 | if( ((!CSR_IS_INFRA_AP(pProfile )&& !CSR_IS_WDS(pProfile )) && |
| 10816 | ((eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) || |
| 10817 | (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode))) || |
| 10818 | (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10819 | { |
| 10820 | switch( pMac->roam.configParam.uCfgDot11Mode ) |
| 10821 | { |
| 10822 | case eCSR_CFG_DOT11_MODE_11A: |
| 10823 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10824 | eBand = eCSR_BAND_5G; |
| 10825 | break; |
| 10826 | case eCSR_CFG_DOT11_MODE_11B: |
| 10827 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10828 | eBand = eCSR_BAND_24; |
| 10829 | break; |
| 10830 | case eCSR_CFG_DOT11_MODE_11G: |
| 10831 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 10832 | eBand = eCSR_BAND_24; |
| 10833 | break; |
| 10834 | case eCSR_CFG_DOT11_MODE_11N: |
| 10835 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10836 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10837 | break; |
| 10838 | #ifdef WLAN_FEATURE_11AC |
| 10839 | case eCSR_CFG_DOT11_MODE_11AC: |
| 10840 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 10841 | { |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 10842 | /* If the operating channel is in 2.4 GHz band, check for |
| 10843 | * INI item to disable VHT operation in 2.4 GHz band |
| 10844 | */ |
| 10845 | if (CSR_IS_CHANNEL_24GHZ(operationChn) && |
| 10846 | !pMac->roam.configParam.enableVhtFor24GHz) |
| 10847 | { |
| 10848 | /* Disable 11AC operation */ |
| 10849 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10850 | } |
| 10851 | else |
| 10852 | { |
| 10853 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 10854 | } |
| 10855 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10856 | } |
| 10857 | else |
| 10858 | { |
| 10859 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10860 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10861 | } |
| 10862 | break; |
| 10863 | case eCSR_CFG_DOT11_MODE_11AC_ONLY: |
| 10864 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 10865 | { |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 10866 | /* If the operating channel is in 2.4 GHz band, check for |
| 10867 | * INI item to disable VHT operation in 2.4 GHz band |
| 10868 | */ |
| 10869 | if (CSR_IS_CHANNEL_24GHZ(operationChn) && |
| 10870 | !pMac->roam.configParam.enableVhtFor24GHz) |
| 10871 | { |
| 10872 | /* Disable 11AC operation */ |
| 10873 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10874 | } |
| 10875 | else |
| 10876 | { |
| 10877 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC_ONLY; |
| 10878 | } |
| 10879 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10880 | } |
| 10881 | else |
| 10882 | { |
| 10883 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10884 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10885 | } |
| 10886 | break; |
| 10887 | #endif |
| 10888 | case eCSR_CFG_DOT11_MODE_AUTO: |
| 10889 | eBand = pMac->roam.configParam.eBand; |
| 10890 | if (eCSR_BAND_24 == eBand) |
| 10891 | { |
| 10892 | // WiFi tests require IBSS networks to start in 11b mode |
| 10893 | // without any change to the default parameter settings |
| 10894 | // on the adapter. We use ACU to start an IBSS through |
| 10895 | // creation of a startIBSS profile. This startIBSS profile |
| 10896 | // has Auto MACProtocol and the adapter property setting |
| 10897 | // for dot11Mode is also AUTO. So in this case, let's |
| 10898 | // start the IBSS network in 11b mode instead of 11g mode. |
| 10899 | // So this is for Auto=profile->MacProtocol && Auto=Global. |
| 10900 | // dot11Mode && profile->channel is < 14, then start the IBSS |
| 10901 | // in b mode. |
| 10902 | // |
| 10903 | // Note: we used to have this start as an 11g IBSS for best |
| 10904 | // performance... now to specify that the user will have to |
| 10905 | // set the do11Mode in the property page to 11g to force it. |
| 10906 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10907 | } |
| 10908 | else |
| 10909 | { |
| 10910 | #ifdef WLAN_FEATURE_11AC |
| 10911 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 10912 | { |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 10913 | /* If the operating channel is in 2.4 GHz band, check for |
| 10914 | * INI item to disable VHT operation in 2.4 GHz band |
| 10915 | */ |
| 10916 | if (CSR_IS_CHANNEL_24GHZ(operationChn) && |
| 10917 | !pMac->roam.configParam.enableVhtFor24GHz) |
| 10918 | { |
| 10919 | /* Disable 11AC operation */ |
| 10920 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10921 | } |
| 10922 | else |
| 10923 | { |
| 10924 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 10925 | } |
| 10926 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10927 | } |
| 10928 | else |
| 10929 | { |
| 10930 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10931 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10932 | } |
| 10933 | #else |
| 10934 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10935 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10936 | #endif |
| 10937 | } |
| 10938 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10939 | default: |
| 10940 | // Global dot11 Mode setting is 11a/b/g. |
| 10941 | // use the channel number to determine the Mode setting. |
| 10942 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 10943 | { |
| 10944 | eBand = pMac->roam.configParam.eBand; |
| 10945 | if(eCSR_BAND_24 == eBand) |
| 10946 | { |
| 10947 | //See reason in else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) to pick 11B |
| 10948 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10949 | } |
| 10950 | else |
| 10951 | { |
| 10952 | //prefer 5GHz |
| 10953 | eBand = eCSR_BAND_5G; |
| 10954 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10955 | } |
| 10956 | } |
| 10957 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10958 | { |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10959 | // WiFi tests require IBSS networks to start in 11b mode |
| 10960 | // without any change to the default parameter settings |
| 10961 | // on the adapter. We use ACU to start an IBSS through |
| 10962 | // creation of a startIBSS profile. This startIBSS profile |
| 10963 | // has Auto MACProtocol and the adapter property setting |
| 10964 | // for dot11Mode is also AUTO. So in this case, let's |
| 10965 | // start the IBSS network in 11b mode instead of 11g mode. |
| 10966 | // So this is for Auto=profile->MacProtocol && Auto=Global. |
| 10967 | // dot11Mode && profile->channel is < 14, then start the IBSS |
| 10968 | // in b mode. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10969 | // |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10970 | // Note: we used to have this start as an 11g IBSS for best |
| 10971 | // performance... now to specify that the user will have to |
| 10972 | // set the do11Mode in the property page to 11g to force it. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10973 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10974 | eBand = eCSR_BAND_24; |
| 10975 | } |
| 10976 | else |
| 10977 | { |
| 10978 | // else, it's a 5.0GHz channel. Set mode to 11a. |
| 10979 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10980 | eBand = eCSR_BAND_5G; |
| 10981 | } |
| 10982 | break; |
| 10983 | }//switch |
| 10984 | }//if( eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 10985 | else |
| 10986 | { |
| 10987 | //dot11 mode is set, lets pick the band |
| 10988 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 10989 | { |
| 10990 | // channel is Auto also. |
| 10991 | eBand = pMac->roam.configParam.eBand; |
| 10992 | if(eCSR_BAND_ALL == eBand) |
| 10993 | { |
| 10994 | //prefer 5GHz |
| 10995 | eBand = eCSR_BAND_5G; |
| 10996 | } |
| 10997 | } |
| 10998 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10999 | { |
| 11000 | eBand = eCSR_BAND_24; |
| 11001 | } |
| 11002 | else |
| 11003 | { |
| 11004 | eBand = eCSR_BAND_5G; |
| 11005 | } |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11006 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11007 | if(pBand) |
| 11008 | { |
| 11009 | *pBand = eBand; |
| 11010 | } |
| 11011 | |
| 11012 | if (operationChn == 14){ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11013 | smsLog(pMac, LOGE, FL(" Switching to Dot11B mode ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11014 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 11015 | } |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 11016 | |
Madan Mohan Koyyalamudi | 5ec4b18 | 2012-11-28 16:15:17 -0800 | [diff] [blame] | 11017 | /* Incase of WEP Security encryption type is coming as part of add key. So while STart BSS dont have information */ |
| 11018 | 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] | 11019 | ((eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 11020 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 11021 | (eCSR_CFG_DOT11_MODE_11AC == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 11022 | #endif |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 11023 | (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode)) ) |
| 11024 | { |
| 11025 | //We cannot do 11n here |
| 11026 | if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 11027 | { |
| 11028 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 11029 | } |
| 11030 | else |
| 11031 | { |
| 11032 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 11033 | } |
| 11034 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11035 | return( cfgDot11Mode ); |
| 11036 | } |
| 11037 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11038 | eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 11039 | { |
| 11040 | eHalStatus status; |
| 11041 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11042 | |
| 11043 | if(!pSession) |
| 11044 | { |
| 11045 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11046 | return eHAL_STATUS_FAILURE; |
| 11047 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11048 | |
| 11049 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11050 | { |
| 11051 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11052 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 11053 | if(pIbssLog) |
| 11054 | { |
| 11055 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_REQ; |
| 11056 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 11057 | } |
| 11058 | } |
| 11059 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11060 | // Set the roaming substate to 'stop Bss request'... |
| 11061 | csrRoamSubstateChange( pMac, NewSubstate, sessionId ); |
| 11062 | |
| 11063 | // attempt to stop the Bss (reason code is ignored...) |
| 11064 | status = csrSendMBStopBssReqMsg( pMac, sessionId ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 11065 | if(!HAL_STATUS_SUCCESS(status)) |
| 11066 | { |
| 11067 | smsLog(pMac, LOGW, FL("csrSendMBStopBssReqMsg failed with status %d"), status); |
| 11068 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11069 | return (status); |
| 11070 | } |
| 11071 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11072 | //pNumChan is a caller allocated space with the sizeof pChannels |
| 11073 | eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan) |
| 11074 | { |
| 11075 | |
| 11076 | return (ccmCfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 11077 | (tANI_U8 *)pChannels, |
| 11078 | pNumChan)); |
| 11079 | } |
| 11080 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11081 | tPowerdBm csrGetCfgMaxTxPower (tpAniSirGlobal pMac, tANI_U8 channel) |
| 11082 | { |
| 11083 | tANI_U32 cfgLength = 0; |
| 11084 | tANI_U16 cfgId = 0; |
| 11085 | tPowerdBm maxTxPwr = 0; |
| 11086 | tANI_U8 *pCountryInfo = NULL; |
| 11087 | eHalStatus status; |
| 11088 | tANI_U8 count = 0; |
| 11089 | tANI_U8 firstChannel; |
| 11090 | tANI_U8 maxChannels; |
| 11091 | |
| 11092 | if (CSR_IS_CHANNEL_5GHZ(channel)) |
| 11093 | { |
| 11094 | cfgId = WNI_CFG_MAX_TX_POWER_5; |
| 11095 | cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN; |
| 11096 | } |
| 11097 | else if (CSR_IS_CHANNEL_24GHZ(channel)) |
| 11098 | { |
| 11099 | cfgId = WNI_CFG_MAX_TX_POWER_2_4; |
| 11100 | cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN; |
| 11101 | } |
| 11102 | else |
| 11103 | return maxTxPwr; |
| 11104 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11105 | pCountryInfo = vos_mem_malloc(cfgLength); |
| 11106 | if ( NULL == pCountryInfo ) |
| 11107 | status = eHAL_STATUS_FAILURE; |
| 11108 | else |
| 11109 | status = eHAL_STATUS_SUCCESS; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11110 | if (status != eHAL_STATUS_SUCCESS) |
| 11111 | { |
| 11112 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11113 | FL("%s: failed to allocate memory, status = %d"), |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11114 | __FUNCTION__, status); |
| 11115 | goto error; |
| 11116 | } |
| 11117 | status = ccmCfgGetStr(pMac, cfgId, (tANI_U8 *)pCountryInfo, &cfgLength); |
| 11118 | if (status != eHAL_STATUS_SUCCESS) |
| 11119 | { |
| 11120 | goto error; |
| 11121 | } |
| 11122 | /* Identify the channel and maxtxpower */ |
| 11123 | while (count <= (cfgLength - (sizeof(tSirMacChanInfo)))) |
| 11124 | { |
| 11125 | firstChannel = pCountryInfo[count++]; |
| 11126 | maxChannels = pCountryInfo[count++]; |
| 11127 | maxTxPwr = pCountryInfo[count++]; |
| 11128 | |
| 11129 | if ((channel >= firstChannel) && |
| 11130 | (channel < (firstChannel + maxChannels))) |
| 11131 | { |
| 11132 | break; |
| 11133 | } |
| 11134 | } |
| 11135 | |
| 11136 | error: |
| 11137 | if (NULL != pCountryInfo) |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11138 | vos_mem_free(pCountryInfo); |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11139 | |
| 11140 | return maxTxPwr; |
| 11141 | } |
| 11142 | |
| 11143 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11144 | tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel ) |
| 11145 | { |
| 11146 | tANI_BOOLEAN fValid = FALSE; |
| 11147 | tANI_U32 idxValidChannels; |
| 11148 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 11149 | |
| 11150 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len))) |
| 11151 | { |
| 11152 | for ( idxValidChannels = 0; ( idxValidChannels < len ); idxValidChannels++ ) |
| 11153 | { |
| 11154 | if ( channel == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 11155 | { |
| 11156 | fValid = TRUE; |
| 11157 | break; |
| 11158 | } |
| 11159 | } |
| 11160 | } |
| 11161 | pMac->roam.numValidChannels = len; |
| 11162 | return fValid; |
| 11163 | } |
| 11164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11165 | tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel) |
| 11166 | { |
| 11167 | tANI_BOOLEAN fValid = eANI_BOOLEAN_FALSE; |
| 11168 | tANI_U8 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11169 | for(i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++) |
| 11170 | { |
| 11171 | if(channel == pMac->scan.base40MHzChannels.channelList[i]) |
| 11172 | { |
| 11173 | fValid = eANI_BOOLEAN_TRUE; |
| 11174 | break; |
| 11175 | } |
| 11176 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11177 | return (fValid); |
| 11178 | } |
| 11179 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11180 | //This function check and validate whether the NIC can do CB (40MHz) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11181 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11182 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11183 | ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11184 | tANI_U8 centerChn; |
| 11185 | tANI_U32 ChannelBondingMode; |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 11186 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11187 | if(CSR_IS_CHANNEL_24GHZ(primaryChn)) |
| 11188 | { |
| 11189 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 11190 | } |
| 11191 | else |
| 11192 | { |
| 11193 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 11194 | } |
| 11195 | //Figure what the other side's CB mode |
| 11196 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 11197 | { |
| 11198 | if(pIes->HTCaps.present && (eHT_CHANNEL_WIDTH_40MHZ == pIes->HTCaps.supportedChannelWidthSet)) |
| 11199 | { |
Agrawal Ashish | f187d51 | 2014-04-03 17:01:52 +0530 | [diff] [blame] | 11200 | // In Case WPA2 and TKIP is the only one cipher suite in Pairwise. |
| 11201 | if ((pIes->RSN.present && (pIes->RSN.pwise_cipher_suite_count == 1) && |
| 11202 | !memcmp(&(pIes->RSN.pwise_cipher_suites[0][0]), |
| 11203 | "\x00\x0f\xac\x02",4)) |
| 11204 | //In Case WPA1 and TKIP is the only one cipher suite in Unicast. |
| 11205 | ||(pIes->WPA.present && (pIes->WPA.unicast_cipher_count == 1) && |
| 11206 | !memcmp(&(pIes->WPA.unicast_ciphers[0][0]), |
| 11207 | "\x00\x50\xf2\x02",4))) |
| 11208 | |
Leela Venkata Kiran Kumar Reddy Chirala | 10c5a2e | 2013-12-18 14:41:28 -0800 | [diff] [blame] | 11209 | { |
| 11210 | smsLog(pMac, LOGW, " No channel bonding in TKIP mode "); |
| 11211 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 11212 | } |
| 11213 | |
| 11214 | else if(pIes->HTInfo.present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11215 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11216 | /* This is called during INFRA STA/CLIENT and should use the merged value of |
| 11217 | * supported channel width and recommended tx width as per standard |
| 11218 | */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11219 | smsLog(pMac, LOG1, "scws %u rtws %u sco %u", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11220 | pIes->HTCaps.supportedChannelWidthSet, |
| 11221 | pIes->HTInfo.recommendedTxWidthSet, |
| 11222 | pIes->HTInfo.secondaryChannelOffset); |
| 11223 | |
| 11224 | if (pIes->HTInfo.recommendedTxWidthSet == eHT_CHANNEL_WIDTH_40MHZ) |
| 11225 | eRet = (ePhyChanBondState)pIes->HTInfo.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11226 | else |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11227 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 11228 | switch (eRet) { |
| 11229 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 11230 | centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET; |
| 11231 | break; |
| 11232 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 11233 | centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET; |
| 11234 | break; |
| 11235 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 11236 | default: |
| 11237 | centerChn = primaryChn; |
| 11238 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11239 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11240 | if((PHY_SINGLE_CHANNEL_CENTERED != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11241 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11242 | smsLog(pMac, LOGE, " Invalid center channel (%d), disable 40MHz mode", centerChn); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11243 | //eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11244 | } |
| 11245 | } |
| 11246 | } |
| 11247 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11248 | return eRet; |
| 11249 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11250 | tANI_BOOLEAN csrIsEncryptionInList( tpAniSirGlobal pMac, tCsrEncryptionList *pCipherList, eCsrEncryptionType encryptionType ) |
| 11251 | { |
| 11252 | tANI_BOOLEAN fFound = FALSE; |
| 11253 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11254 | for( idx = 0; idx < pCipherList->numEntries; idx++ ) |
| 11255 | { |
| 11256 | if( pCipherList->encryptionType[idx] == encryptionType ) |
| 11257 | { |
| 11258 | fFound = TRUE; |
| 11259 | break; |
| 11260 | } |
| 11261 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11262 | return fFound; |
| 11263 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11264 | tANI_BOOLEAN csrIsAuthInList( tpAniSirGlobal pMac, tCsrAuthList *pAuthList, eCsrAuthType authType ) |
| 11265 | { |
| 11266 | tANI_BOOLEAN fFound = FALSE; |
| 11267 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11268 | for( idx = 0; idx < pAuthList->numEntries; idx++ ) |
| 11269 | { |
| 11270 | if( pAuthList->authType[idx] == authType ) |
| 11271 | { |
| 11272 | fFound = TRUE; |
| 11273 | break; |
| 11274 | } |
| 11275 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11276 | return fFound; |
| 11277 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11278 | tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2) |
| 11279 | { |
| 11280 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 11281 | tCsrScanResultFilter *pScanFilter = NULL; |
| 11282 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11283 | |
| 11284 | if(pProfile1 && pProfile2) |
| 11285 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11286 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 11287 | if ( NULL == pScanFilter ) |
| 11288 | status = eHAL_STATUS_FAILURE; |
| 11289 | else |
| 11290 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11291 | if(HAL_STATUS_SUCCESS(status)) |
| 11292 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11293 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11294 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile2, pScanFilter); |
| 11295 | if(HAL_STATUS_SUCCESS(status)) |
| 11296 | { |
| 11297 | fCheck = eANI_BOOLEAN_FALSE; |
| 11298 | do |
| 11299 | { |
| 11300 | tANI_U32 i; |
| 11301 | for(i = 0; i < pScanFilter->SSIDs.numOfSSIDs; i++) |
| 11302 | { |
| 11303 | fCheck = csrIsSsidMatch( pMac, pScanFilter->SSIDs.SSIDList[i].SSID.ssId, |
| 11304 | pScanFilter->SSIDs.SSIDList[i].SSID.length, |
| 11305 | pProfile1->SSID.ssId, pProfile1->SSID.length, eANI_BOOLEAN_FALSE ); |
| 11306 | if ( fCheck ) break; |
| 11307 | } |
| 11308 | if(!fCheck) |
| 11309 | { |
| 11310 | break; |
| 11311 | } |
| 11312 | if( !csrIsAuthInList( pMac, &pProfile2->AuthType, pProfile1->AuthType) |
| 11313 | || pProfile2->BSSType != pProfile1->BSSType |
| 11314 | || !csrIsEncryptionInList( pMac, &pProfile2->EncryptionType, pProfile1->EncryptionType ) |
| 11315 | ) |
| 11316 | { |
| 11317 | fCheck = eANI_BOOLEAN_FALSE; |
| 11318 | break; |
| 11319 | } |
| 11320 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11321 | if (pProfile1->MDID.mdiePresent || pProfile2->MDID.mdiePresent) |
| 11322 | { |
| 11323 | if (pProfile1->MDID.mobilityDomain != pProfile2->MDID.mobilityDomain) |
| 11324 | { |
| 11325 | fCheck = eANI_BOOLEAN_FALSE; |
| 11326 | break; |
| 11327 | } |
| 11328 | } |
| 11329 | #endif |
| 11330 | //Match found |
| 11331 | fCheck = eANI_BOOLEAN_TRUE; |
| 11332 | }while(0); |
| 11333 | csrFreeScanFilter(pMac, pScanFilter); |
| 11334 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11335 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11336 | } |
| 11337 | } |
| 11338 | |
| 11339 | return (fCheck); |
| 11340 | } |
| 11341 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11342 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2) |
| 11343 | { |
| 11344 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 11345 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11346 | do |
| 11347 | { |
| 11348 | //Only check for static WEP |
| 11349 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) && |
| 11350 | !csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) |
| 11351 | { |
| 11352 | fCheck = eANI_BOOLEAN_TRUE; |
| 11353 | break; |
| 11354 | } |
| 11355 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, pConnProfile->EncryptionType)) break; |
| 11356 | if(pConnProfile->Keys.defaultIndex != pProfile2->Keys.defaultIndex) break; |
| 11357 | for(i = 0; i < CSR_MAX_NUM_KEY; i++) |
| 11358 | { |
| 11359 | if(pConnProfile->Keys.KeyLength[i] != pProfile2->Keys.KeyLength[i]) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11360 | if (!vos_mem_compare(&pConnProfile->Keys.KeyMaterial[i], |
| 11361 | &pProfile2->Keys.KeyMaterial[i], pProfile2->Keys.KeyLength[i])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11362 | { |
| 11363 | break; |
| 11364 | } |
| 11365 | } |
| 11366 | if( i == CSR_MAX_NUM_KEY) |
| 11367 | { |
| 11368 | fCheck = eANI_BOOLEAN_TRUE; |
| 11369 | } |
| 11370 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11371 | return (fCheck); |
| 11372 | } |
| 11373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11374 | //IBSS |
| 11375 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11376 | tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac ) |
| 11377 | { |
| 11378 | tANI_U8 channel = 0; |
| 11379 | tANI_U32 idx; |
| 11380 | tANI_U32 idxValidChannels; |
| 11381 | tANI_BOOLEAN fFound = FALSE; |
| 11382 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 11383 | |
| 11384 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel5G) |
| 11385 | { |
| 11386 | channel = pMac->roam.configParam.AdHocChannel5G; |
| 11387 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 11388 | { |
| 11389 | channel = 0; |
| 11390 | } |
| 11391 | } |
| 11392 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 11393 | { |
| 11394 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_50 ) && !fFound; idx++ ) |
| 11395 | { |
| 11396 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 11397 | { |
| 11398 | if ( csrStartIbssChannels50[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 11399 | { |
| 11400 | fFound = TRUE; |
| 11401 | channel = csrStartIbssChannels50[ idx ]; |
| 11402 | } |
| 11403 | } |
| 11404 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11405 | // this is rare, but if it does happen, we find anyone in 11a bandwidth and return the first 11a channel found! |
| 11406 | if (!fFound) |
| 11407 | { |
| 11408 | for ( idxValidChannels = 0; idxValidChannels < len ; idxValidChannels++ ) |
| 11409 | { |
| 11410 | if ( CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ idx ]) ) // the max channel# in 11g is 14 |
| 11411 | { |
| 11412 | channel = csrStartIbssChannels50[ idx ]; |
| 11413 | break; |
| 11414 | } |
| 11415 | } |
| 11416 | } |
| 11417 | }//if |
| 11418 | |
| 11419 | return( channel ); |
| 11420 | } |
| 11421 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11422 | tANI_U8 csrRoamGetIbssStartChannelNumber24( tpAniSirGlobal pMac ) |
| 11423 | { |
| 11424 | tANI_U8 channel = 1; |
| 11425 | tANI_U32 idx; |
| 11426 | tANI_U32 idxValidChannels; |
| 11427 | tANI_BOOLEAN fFound = FALSE; |
| 11428 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 11429 | |
| 11430 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel24) |
| 11431 | { |
| 11432 | channel = pMac->roam.configParam.AdHocChannel24; |
| 11433 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 11434 | { |
| 11435 | channel = 0; |
| 11436 | } |
| 11437 | } |
| 11438 | |
| 11439 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 11440 | { |
| 11441 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_24 ) && !fFound; idx++ ) |
| 11442 | { |
| 11443 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 11444 | { |
| 11445 | if ( csrStartIbssChannels24[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 11446 | { |
| 11447 | fFound = TRUE; |
| 11448 | channel = csrStartIbssChannels24[ idx ]; |
| 11449 | } |
| 11450 | } |
| 11451 | } |
| 11452 | } |
| 11453 | |
| 11454 | return( channel ); |
| 11455 | } |
| 11456 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11457 | static void csrRoamGetBssStartParms( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 11458 | tCsrRoamStartBssParams *pParam ) |
| 11459 | { |
| 11460 | eCsrCfgDot11Mode cfgDot11Mode; |
| 11461 | eCsrBand eBand; |
| 11462 | tANI_U8 channel = 0; |
| 11463 | tSirNwType nwType; |
| 11464 | tANI_U8 operationChannel = 0; |
| 11465 | |
| 11466 | if(pProfile->ChannelInfo.numOfChannels && pProfile->ChannelInfo.ChannelList) |
| 11467 | { |
| 11468 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 11469 | } |
| 11470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11471 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11472 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11473 | if( ( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 11474 | (pProfile->csrPersona == VOS_P2P_GO_MODE) ) |
| 11475 | && ( cfgDot11Mode == eCSR_CFG_DOT11_MODE_11B) |
| 11476 | ) |
| 11477 | { |
| 11478 | /* This should never happen */ |
| 11479 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11480 | FL("For P2PClient/P2P-GO (persona %d) cfgDot11Mode is 11B"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11481 | pProfile->csrPersona); |
| 11482 | VOS_ASSERT(0); |
| 11483 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11484 | switch( cfgDot11Mode ) |
| 11485 | { |
| 11486 | case eCSR_CFG_DOT11_MODE_11G: |
| 11487 | nwType = eSIR_11G_NW_TYPE; |
| 11488 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11489 | case eCSR_CFG_DOT11_MODE_11B: |
| 11490 | nwType = eSIR_11B_NW_TYPE; |
| 11491 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11492 | case eCSR_CFG_DOT11_MODE_11A: |
| 11493 | nwType = eSIR_11A_NW_TYPE; |
| 11494 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11495 | default: |
| 11496 | case eCSR_CFG_DOT11_MODE_11N: |
| 11497 | case eCSR_CFG_DOT11_MODE_TAURUS: |
| 11498 | //Because LIM only verifies it against 11a, 11b or 11g, set only 11g or 11a here |
| 11499 | if(eCSR_BAND_24 == eBand) |
| 11500 | { |
| 11501 | nwType = eSIR_11G_NW_TYPE; |
| 11502 | } |
| 11503 | else |
| 11504 | { |
| 11505 | nwType = eSIR_11A_NW_TYPE; |
| 11506 | } |
| 11507 | break; |
| 11508 | } |
| 11509 | |
| 11510 | pParam->extendedRateSet.numRates = 0; |
| 11511 | |
| 11512 | switch ( nwType ) |
| 11513 | { |
| 11514 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11515 | smsLog(pMac, LOGE, FL("sees an unknown pSirNwType (%d)"), nwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11516 | case eSIR_11A_NW_TYPE: |
| 11517 | |
| 11518 | pParam->operationalRateSet.numRates = 8; |
| 11519 | |
| 11520 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 11521 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 11522 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 11523 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 11524 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 11525 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 11526 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 11527 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 11528 | |
| 11529 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 11530 | { |
| 11531 | channel = csrRoamGetIbssStartChannelNumber50( pMac ); |
| 11532 | if( 0 == channel && |
| 11533 | CSR_IS_PHY_MODE_DUAL_BAND(pProfile->phyMode) && |
| 11534 | CSR_IS_PHY_MODE_DUAL_BAND(pMac->roam.configParam.phyMode) |
| 11535 | ) |
| 11536 | { |
| 11537 | //We could not find a 5G channel by auto pick, let's try 2.4G channels |
| 11538 | //We only do this here because csrRoamGetPhyModeBandForBss always picks 11a for AUTO |
| 11539 | nwType = eSIR_11B_NW_TYPE; |
| 11540 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 11541 | pParam->operationalRateSet.numRates = 4; |
| 11542 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 11543 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 11544 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 11545 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 11546 | } |
| 11547 | } |
| 11548 | else |
| 11549 | { |
| 11550 | channel = operationChannel; |
| 11551 | } |
| 11552 | break; |
| 11553 | |
| 11554 | case eSIR_11B_NW_TYPE: |
| 11555 | pParam->operationalRateSet.numRates = 4; |
| 11556 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 11557 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 11558 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 11559 | 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] | 11560 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 11561 | { |
| 11562 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 11563 | } |
| 11564 | else |
| 11565 | { |
| 11566 | channel = operationChannel; |
| 11567 | } |
| 11568 | |
| 11569 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11570 | case eSIR_11G_NW_TYPE: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11571 | /* For P2P Client and P2P GO, disable 11b rates */ |
| 11572 | if( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 11573 | (pProfile->csrPersona == VOS_P2P_GO_MODE) |
| 11574 | ) |
| 11575 | { |
| 11576 | pParam->operationalRateSet.numRates = 8; |
| 11577 | |
| 11578 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 11579 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 11580 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 11581 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 11582 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 11583 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 11584 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 11585 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 11586 | } |
| 11587 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11588 | { |
| 11589 | pParam->operationalRateSet.numRates = 4; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11590 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 11591 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 11592 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 11593 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 11594 | |
| 11595 | pParam->extendedRateSet.numRates = 8; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11596 | pParam->extendedRateSet.rate[0] = SIR_MAC_RATE_6; |
| 11597 | pParam->extendedRateSet.rate[1] = SIR_MAC_RATE_9; |
| 11598 | pParam->extendedRateSet.rate[2] = SIR_MAC_RATE_12; |
| 11599 | pParam->extendedRateSet.rate[3] = SIR_MAC_RATE_18; |
| 11600 | pParam->extendedRateSet.rate[4] = SIR_MAC_RATE_24; |
| 11601 | pParam->extendedRateSet.rate[5] = SIR_MAC_RATE_36; |
| 11602 | pParam->extendedRateSet.rate[6] = SIR_MAC_RATE_48; |
| 11603 | pParam->extendedRateSet.rate[7] = SIR_MAC_RATE_54; |
| 11604 | } |
| 11605 | |
| 11606 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 11607 | { |
| 11608 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 11609 | } |
| 11610 | else |
| 11611 | { |
| 11612 | channel = operationChannel; |
| 11613 | } |
| 11614 | |
| 11615 | break; |
| 11616 | } |
| 11617 | pParam->operationChn = channel; |
| 11618 | pParam->sirNwType = nwType; |
| 11619 | } |
| 11620 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11621 | static void csrRoamGetBssStartParmsFromBssDesc( tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, |
| 11622 | tDot11fBeaconIEs *pIes, tCsrRoamStartBssParams *pParam ) |
| 11623 | { |
| 11624 | |
| 11625 | if( pParam ) |
| 11626 | { |
| 11627 | pParam->sirNwType = pBssDesc->nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11628 | pParam->cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11629 | pParam->operationChn = pBssDesc->channelId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11630 | vos_mem_copy(&pParam->bssid, pBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11631 | |
| 11632 | if( pIes ) |
| 11633 | { |
| 11634 | if(pIes->SuppRates.present) |
| 11635 | { |
| 11636 | pParam->operationalRateSet.numRates = pIes->SuppRates.num_rates; |
| 11637 | if(pIes->SuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) |
| 11638 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11639 | smsLog(pMac, LOGE, FL("num_rates :%d is more than SIR_MAC_RATESET_EID_MAX, resetting to SIR_MAC_RATESET_EID_MAX"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11640 | pIes->SuppRates.num_rates); |
| 11641 | pIes->SuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
| 11642 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11643 | vos_mem_copy(pParam->operationalRateSet.rate, pIes->SuppRates.rates, |
| 11644 | sizeof(*pIes->SuppRates.rates) * pIes->SuppRates.num_rates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11645 | } |
Praveen Kumar Sirisilla | 1f6b649 | 2013-10-15 18:25:06 -0700 | [diff] [blame] | 11646 | if (pIes->ExtSuppRates.present) |
| 11647 | { |
| 11648 | pParam->extendedRateSet.numRates = pIes->ExtSuppRates.num_rates; |
Kaushik, Sushant | d39915b | 2014-04-23 15:12:28 +0530 | [diff] [blame] | 11649 | if(pIes->ExtSuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) |
Praveen Kumar Sirisilla | 1f6b649 | 2013-10-15 18:25:06 -0700 | [diff] [blame] | 11650 | { |
| 11651 | smsLog(pMac, LOGE, FL("num_rates :%d is more than \ |
| 11652 | SIR_MAC_RATESET_EID_MAX, resetting to \ |
| 11653 | SIR_MAC_RATESET_EID_MAX"), |
| 11654 | pIes->ExtSuppRates.num_rates); |
Kaushik, Sushant | d39915b | 2014-04-23 15:12:28 +0530 | [diff] [blame] | 11655 | pIes->ExtSuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
Praveen Kumar Sirisilla | 1f6b649 | 2013-10-15 18:25:06 -0700 | [diff] [blame] | 11656 | } |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 11657 | vos_mem_copy(pParam->extendedRateSet.rate, |
Praveen Kumar Sirisilla | 1f6b649 | 2013-10-15 18:25:06 -0700 | [diff] [blame] | 11658 | pIes->ExtSuppRates.rates, |
| 11659 | sizeof(*pIes->ExtSuppRates.rates) * pIes->ExtSuppRates.num_rates); |
| 11660 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11661 | if( pIes->SSID.present ) |
| 11662 | { |
| 11663 | pParam->ssId.length = pIes->SSID.num_ssid; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11664 | vos_mem_copy(pParam->ssId.ssId, pIes->SSID.ssid, |
| 11665 | pParam->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11666 | } |
| 11667 | pParam->cbMode = csrGetCBModeFromIes(pMac, pParam->operationChn, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11668 | } |
| 11669 | else |
| 11670 | { |
| 11671 | pParam->ssId.length = 0; |
| 11672 | pParam->operationalRateSet.numRates = 0; |
| 11673 | } |
| 11674 | } |
| 11675 | } |
| 11676 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11677 | static void csrRoamDetermineMaxRateForAdHoc( tpAniSirGlobal pMac, tSirMacRateSet *pSirRateSet ) |
| 11678 | { |
| 11679 | tANI_U8 MaxRate = 0; |
| 11680 | tANI_U32 i; |
| 11681 | tANI_U8 *pRate; |
| 11682 | |
| 11683 | pRate = pSirRateSet->rate; |
| 11684 | for ( i = 0; i < pSirRateSet->numRates; i++ ) |
| 11685 | { |
| 11686 | MaxRate = CSR_MAX( MaxRate, ( pRate[ i ] & (~CSR_DOT11_BASIC_RATE_MASK) ) ); |
| 11687 | } |
| 11688 | |
| 11689 | // Save the max rate in the connected state information... |
| 11690 | |
| 11691 | // modify LastRates variable as well |
| 11692 | |
| 11693 | return; |
| 11694 | } |
| 11695 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11696 | eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, |
| 11697 | tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId ) |
| 11698 | { |
| 11699 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11700 | eCsrBand eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11701 | // Set the roaming substate to 'Start BSS attempt'... |
| 11702 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11703 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11704 | //Need to figure out whether we need to log WDS??? |
| 11705 | if( CSR_IS_IBSS( pProfile ) ) |
| 11706 | { |
| 11707 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11708 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 11709 | if(pIbssLog) |
| 11710 | { |
| 11711 | if(pBssDesc) |
| 11712 | { |
| 11713 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_REQ; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11714 | vos_mem_copy(pIbssLog->bssid, pBssDesc->bssId, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11715 | } |
| 11716 | else |
| 11717 | { |
| 11718 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_REQ; |
| 11719 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11720 | vos_mem_copy(pIbssLog->ssid, pParam->ssId.ssId, pParam->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11721 | if(pProfile->ChannelInfo.numOfChannels == 0) |
| 11722 | { |
| 11723 | pIbssLog->channelSetting = AUTO_PICK; |
| 11724 | } |
| 11725 | else |
| 11726 | { |
| 11727 | pIbssLog->channelSetting = SPECIFIED; |
| 11728 | } |
| 11729 | pIbssLog->operatingChannel = pParam->operationChn; |
| 11730 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 11731 | } |
| 11732 | } |
| 11733 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11734 | //Put RSN information in for Starting BSS |
| 11735 | pParam->nRSNIELength = (tANI_U16)pProfile->nRSNReqIELength; |
| 11736 | pParam->pRSNIE = pProfile->pRSNReqIE; |
| 11737 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11738 | pParam->privacy = pProfile->privacy; |
| 11739 | pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq; |
| 11740 | pParam->authType = pProfile->csr80211AuthType; |
| 11741 | pParam->beaconInterval = pProfile->beaconInterval; |
| 11742 | pParam->dtimPeriod = pProfile->dtimPeriod; |
| 11743 | pParam->ApUapsdEnable = pProfile->ApUapsdEnable; |
| 11744 | pParam->ssidHidden = pProfile->SSIDs.SSIDList[0].ssidHidden; |
| 11745 | if (CSR_IS_INFRA_AP(pProfile)&& (pParam->operationChn != 0)) |
| 11746 | { |
| 11747 | if (csrIsValidChannel(pMac, pParam->operationChn) != eHAL_STATUS_SUCCESS) |
| 11748 | { |
| 11749 | pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL; |
| 11750 | } |
| 11751 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11752 | pParam->protEnabled = pProfile->protEnabled; |
| 11753 | pParam->obssProtEnabled = pProfile->obssProtEnabled; |
| 11754 | pParam->ht_protection = pProfile->cfg_protection; |
| 11755 | pParam->wps_state = pProfile->wps_state; |
Jeff Johnson | 96fbeeb | 2013-02-26 21:23:00 -0800 | [diff] [blame] | 11756 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11757 | pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, pParam->operationChn /* pProfile->operationChannel*/, |
| 11758 | &eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11759 | pParam->bssPersona = pProfile->csrPersona; |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 11760 | |
| 11761 | #ifdef WLAN_FEATURE_11W |
| 11762 | pParam->mfpCapable = (0 != pProfile->MFPCapable); |
| 11763 | pParam->mfpRequired = (0 != pProfile->MFPRequired); |
| 11764 | #endif |
| 11765 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11766 | // When starting an IBSS, start on the channel from the Profile. |
| 11767 | status = csrSendMBStartBssReqMsg( pMac, sessionId, pProfile->BSSType, pParam, pBssDesc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11768 | return (status); |
| 11769 | } |
| 11770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11771 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11772 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11773 | { |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11774 | tANI_U8 Channel; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11775 | ePhyChanBondState cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11776 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11777 | |
| 11778 | if(!pSession) |
| 11779 | { |
| 11780 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11781 | return; |
| 11782 | } |
| 11783 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11784 | if( pBssDesc ) |
| 11785 | { |
| 11786 | csrRoamGetBssStartParmsFromBssDesc( pMac, pBssDesc, pIes, &pSession->bssParams ); |
| 11787 | //Since csrRoamGetBssStartParmsFromBssDesc fills in the bssid for pSession->bssParams |
| 11788 | //The following code has to be do after that. |
| 11789 | //For WDS station, use selfMac as the self BSSID |
| 11790 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 11791 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11792 | vos_mem_copy(&pSession->bssParams.bssid, &pSession->selfMacAddr, |
| 11793 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11794 | } |
| 11795 | } |
| 11796 | else |
| 11797 | { |
| 11798 | csrRoamGetBssStartParms(pMac, pProfile, &pSession->bssParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11799 | //Use the first SSID |
| 11800 | if(pProfile->SSIDs.numOfSSIDs) |
| 11801 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11802 | vos_mem_copy(&pSession->bssParams.ssId, pProfile->SSIDs.SSIDList, |
| 11803 | sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11804 | } |
| 11805 | //For WDS station, use selfMac as the self BSSID |
| 11806 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 11807 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11808 | vos_mem_copy(&pSession->bssParams.bssid, &pSession->selfMacAddr, |
| 11809 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11810 | } |
| 11811 | //Use the first BSSID |
| 11812 | else if( pProfile->BSSIDs.numOfBSSIDs ) |
| 11813 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11814 | vos_mem_copy(&pSession->bssParams.bssid, pProfile->BSSIDs.bssid, |
| 11815 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11816 | } |
| 11817 | else |
| 11818 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11819 | vos_mem_set(&pSession->bssParams.bssid, sizeof(tCsrBssid), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11820 | } |
| 11821 | } |
| 11822 | Channel = pSession->bssParams.operationChn; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11823 | //Set operating channel in pProfile which will be used |
| 11824 | //in csrRoamSetBssConfigCfg() to determine channel bonding |
| 11825 | //mode and will be configured in CFG later |
| 11826 | pProfile->operationChannel = Channel; |
| 11827 | |
| 11828 | if(Channel == 0) |
| 11829 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 11830 | smsLog(pMac, LOGE, " CSR cannot find a channel to start IBSS"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11831 | } |
| 11832 | else |
| 11833 | { |
| 11834 | |
| 11835 | csrRoamDetermineMaxRateForAdHoc( pMac, &pSession->bssParams.operationalRateSet ); |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11836 | if (CSR_IS_INFRA_AP(pProfile) || CSR_IS_START_IBSS( pProfile ) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11837 | { |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11838 | if(CSR_IS_CHANNEL_24GHZ(Channel) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11839 | { |
Sandeep Puligilla | e3f239f | 2014-04-17 02:11:46 +0530 | [diff] [blame] | 11840 | /* TODO- SAP: HT40 Support in SAP 2.4Ghz mode is not enabled. |
| 11841 | so channel bonding in 2.4Ghz is configured as 20MHZ |
| 11842 | irrespective of the 'channelBondingMode24GHz' Parameter */ |
| 11843 | cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11844 | } |
| 11845 | else |
| 11846 | { |
| 11847 | cbMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 11848 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11849 | smsLog(pMac, LOG1, "## cbMode %d", cbMode); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11850 | pBssConfig->cbMode = cbMode; |
| 11851 | pSession->bssParams.cbMode = cbMode; |
| 11852 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11853 | } |
| 11854 | } |
| 11855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11856 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 11857 | tANI_BOOLEAN *pfSameIbss ) |
| 11858 | { |
| 11859 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11860 | tANI_BOOLEAN fSameIbss = FALSE; |
| 11861 | |
| 11862 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 11863 | { |
| 11864 | // Check if any profile parameter has changed ? If any profile parameter |
| 11865 | // has changed then stop old BSS and start a new one with new parameters |
| 11866 | if ( csrIsSameProfile( pMac, &pMac->roam.roamSession[sessionId].connectedProfile, pProfile ) ) |
| 11867 | { |
| 11868 | fSameIbss = TRUE; |
| 11869 | } |
| 11870 | else |
| 11871 | { |
| 11872 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 11873 | } |
| 11874 | } |
| 11875 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 11876 | { |
| 11877 | // Disassociate from the connected Infrastructure network... |
| 11878 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 11879 | } |
| 11880 | else |
| 11881 | { |
| 11882 | tBssConfigParam *pBssConfig; |
| 11883 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11884 | pBssConfig = vos_mem_malloc(sizeof(tBssConfigParam)); |
| 11885 | if ( NULL == pBssConfig ) |
| 11886 | status = eHAL_STATUS_FAILURE; |
| 11887 | else |
| 11888 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11889 | if(HAL_STATUS_SUCCESS(status)) |
| 11890 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11891 | vos_mem_set(pBssConfig, sizeof(tBssConfigParam), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11892 | // there is no Bss description before we start an IBSS so we need to adopt |
| 11893 | // all Bss configuration parameters from the Profile. |
| 11894 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, pBssConfig, NULL); |
| 11895 | if(HAL_STATUS_SUCCESS(status)) |
| 11896 | { |
| 11897 | //save dotMode |
| 11898 | pMac->roam.roamSession[sessionId].bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
| 11899 | //Prepare some more parameters for this IBSS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11900 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 11901 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 11902 | NULL, pBssConfig, |
| 11903 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11904 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11905 | |
| 11906 | vos_mem_free(pBssConfig); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11907 | }//Allocate memory |
| 11908 | } |
| 11909 | |
| 11910 | if(pfSameIbss) |
| 11911 | { |
| 11912 | *pfSameIbss = fSameIbss; |
| 11913 | } |
| 11914 | return( status ); |
| 11915 | } |
| 11916 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11917 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11918 | tSirSmeNewBssInfo *pNewBss ) |
| 11919 | { |
| 11920 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11921 | |
| 11922 | if(!pSession) |
| 11923 | { |
| 11924 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11925 | return; |
| 11926 | } |
| 11927 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11928 | if( pNewBss ) |
| 11929 | { |
| 11930 | // Set the operating channel. |
| 11931 | pSession->connectedProfile.operationChannel = pNewBss->channelNumber; |
| 11932 | // move the BSSId from the BSS description into the connected state information. |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11933 | vos_mem_copy(&pSession->connectedProfile.bssid, &(pNewBss->bssId), |
| 11934 | sizeof( tCsrBssid )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11935 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11936 | return; |
| 11937 | } |
| 11938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11939 | #ifdef FEATURE_WLAN_WAPI |
| 11940 | eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, |
| 11941 | tANI_U32 numItems ) |
| 11942 | { |
| 11943 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11944 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11945 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11946 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11947 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11948 | return status; |
| 11949 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11950 | smsLog(pMac, LOGW, "csrRoamSetBKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11951 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11952 | if(numItems <= CSR_MAX_BKID_ALLOWED) |
| 11953 | { |
| 11954 | status = eHAL_STATUS_SUCCESS; |
| 11955 | //numItems may be 0 to clear the cache |
| 11956 | pSession->NumBkidCache = (tANI_U16)numItems; |
| 11957 | if(numItems && pBKIDCache) |
| 11958 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11959 | vos_mem_copy(pSession->BkidCacheInfo, pBKIDCache, |
| 11960 | sizeof(tBkidCacheInfo) * numItems); |
| 11961 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11962 | } |
| 11963 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11964 | return (status); |
| 11965 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11966 | eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, |
| 11967 | tBkidCacheInfo *pBkidCache) |
| 11968 | { |
| 11969 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11970 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11971 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11972 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11973 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11974 | return status; |
| 11975 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11976 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11977 | if(pNum && pBkidCache) |
| 11978 | { |
| 11979 | if(pSession->NumBkidCache == 0) |
| 11980 | { |
| 11981 | *pNum = 0; |
| 11982 | status = eHAL_STATUS_SUCCESS; |
| 11983 | } |
| 11984 | else if(*pNum >= pSession->NumBkidCache) |
| 11985 | { |
| 11986 | if(pSession->NumBkidCache > CSR_MAX_PMKID_ALLOWED) |
| 11987 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11988 | smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11989 | pSession->NumBkidCache); |
| 11990 | pSession->NumBkidCache = CSR_MAX_PMKID_ALLOWED; |
| 11991 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11992 | vos_mem_copy(pBkidCache, pSession->BkidCacheInfo, |
| 11993 | sizeof(tBkidCacheInfo) * pSession->NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11994 | *pNum = pSession->NumBkidCache; |
| 11995 | status = eHAL_STATUS_SUCCESS; |
| 11996 | } |
| 11997 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11998 | return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11999 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12000 | tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12001 | { |
| 12002 | return (pMac->roam.roamSession[sessionId].NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12003 | } |
| 12004 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12005 | eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12006 | tPmkidCacheInfo *pPMKIDCache, tANI_U32 numItems ) |
| 12007 | { |
| 12008 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12009 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12010 | |
| 12011 | if(!pSession) |
| 12012 | { |
| 12013 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12014 | return eHAL_STATUS_FAILURE; |
| 12015 | } |
| 12016 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12017 | smsLog(pMac, LOGW, "csrRoamSetPMKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12018 | if(numItems <= CSR_MAX_PMKID_ALLOWED) |
| 12019 | { |
| 12020 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 12021 | { |
| 12022 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12023 | vos_mem_set(&secEvent, |
| 12024 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12025 | secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_UPDATE; |
| 12026 | secEvent.encryptionModeMulticast = |
| 12027 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 12028 | secEvent.encryptionModeUnicast = |
| 12029 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12030 | vos_mem_copy(secEvent.bssid, pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12031 | secEvent.authMode = |
| 12032 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 12033 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 12034 | } |
| 12035 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12036 | status = eHAL_STATUS_SUCCESS; |
| 12037 | //numItems may be 0 to clear the cache |
| 12038 | pSession->NumPmkidCache = (tANI_U16)numItems; |
| 12039 | if(numItems && pPMKIDCache) |
| 12040 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12041 | vos_mem_copy(pSession->PmkidCacheInfo, pPMKIDCache, |
| 12042 | sizeof(tPmkidCacheInfo) * numItems); |
| 12043 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12044 | } |
| 12045 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12046 | return (status); |
| 12047 | } |
| 12048 | |
Leela Venkata Kiran Kumar Reddy Chirala | ede1065 | 2013-09-11 18:48:46 -0700 | [diff] [blame] | 12049 | eHalStatus csrRoamDelPMKIDfromCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12050 | tANI_U8 *pBSSId ) |
| 12051 | { |
| 12052 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12053 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12054 | tANI_BOOLEAN fMatchFound = FALSE; |
| 12055 | tANI_U32 Index; |
| 12056 | if(!pSession) |
| 12057 | { |
| 12058 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12059 | return eHAL_STATUS_FAILURE; |
| 12060 | } |
| 12061 | do |
| 12062 | { |
| 12063 | for( Index=0; Index < pSession->NumPmkidCache; Index++ ) |
| 12064 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 12065 | smsLog(pMac, LOGW, "Delete PMKID for " |
| 12066 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pBSSId)); |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 12067 | if( vos_mem_compare( pBSSId, pSession->PmkidCacheInfo[Index].BSSID, sizeof(tCsrBssid) ) ) |
Leela Venkata Kiran Kumar Reddy Chirala | ede1065 | 2013-09-11 18:48:46 -0700 | [diff] [blame] | 12068 | { |
| 12069 | fMatchFound = TRUE; |
| 12070 | break; |
| 12071 | } |
| 12072 | } |
| 12073 | if( !fMatchFound ) break; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 12074 | vos_mem_set(pSession->PmkidCacheInfo[Index].BSSID, sizeof(tCsrBssid), 0); |
Leela Venkata Kiran Kumar Reddy Chirala | ede1065 | 2013-09-11 18:48:46 -0700 | [diff] [blame] | 12075 | status = eHAL_STATUS_SUCCESS; |
| 12076 | } |
| 12077 | while( 0 ); |
| 12078 | smsLog(pMac, LOGW, "csrDelPMKID called return match = %d Status = %d", |
| 12079 | fMatchFound, status); |
| 12080 | return status; |
| 12081 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12082 | tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12083 | { |
| 12084 | return (pMac->roam.roamSession[sessionId].NumPmkidCache); |
| 12085 | } |
| 12086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12087 | eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache) |
| 12088 | { |
| 12089 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12090 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12091 | |
| 12092 | if(!pSession) |
| 12093 | { |
| 12094 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12095 | return eHAL_STATUS_FAILURE; |
| 12096 | } |
| 12097 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12098 | if(pNum && pPmkidCache) |
| 12099 | { |
| 12100 | if(pSession->NumPmkidCache == 0) |
| 12101 | { |
| 12102 | *pNum = 0; |
| 12103 | status = eHAL_STATUS_SUCCESS; |
| 12104 | } |
| 12105 | else if(*pNum >= pSession->NumPmkidCache) |
| 12106 | { |
| 12107 | if(pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED) |
| 12108 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12109 | smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12110 | pSession->NumPmkidCache); |
| 12111 | pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED; |
| 12112 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12113 | vos_mem_copy(pPmkidCache, pSession->PmkidCacheInfo, |
| 12114 | sizeof(tPmkidCacheInfo) * pSession->NumPmkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12115 | *pNum = pSession->NumPmkidCache; |
| 12116 | status = eHAL_STATUS_SUCCESS; |
| 12117 | } |
| 12118 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12119 | return (status); |
| 12120 | } |
| 12121 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12122 | eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 12123 | { |
| 12124 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12125 | tANI_U32 len; |
| 12126 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12127 | |
| 12128 | if(!pSession) |
| 12129 | { |
| 12130 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12131 | return eHAL_STATUS_FAILURE; |
| 12132 | } |
| 12133 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12134 | if(pLen) |
| 12135 | { |
| 12136 | len = *pLen; |
| 12137 | *pLen = pSession->nWpaRsnReqIeLength; |
| 12138 | if(pBuf) |
| 12139 | { |
| 12140 | if(len >= pSession->nWpaRsnReqIeLength) |
| 12141 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12142 | vos_mem_copy(pBuf, pSession->pWpaRsnReqIE, |
| 12143 | pSession->nWpaRsnReqIeLength); |
| 12144 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12145 | } |
| 12146 | } |
| 12147 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12148 | return (status); |
| 12149 | } |
| 12150 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12151 | eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 12152 | { |
| 12153 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12154 | tANI_U32 len; |
| 12155 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12156 | |
| 12157 | if(!pSession) |
| 12158 | { |
| 12159 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12160 | return eHAL_STATUS_FAILURE; |
| 12161 | } |
| 12162 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12163 | if(pLen) |
| 12164 | { |
| 12165 | len = *pLen; |
| 12166 | *pLen = pSession->nWpaRsnRspIeLength; |
| 12167 | if(pBuf) |
| 12168 | { |
| 12169 | if(len >= pSession->nWpaRsnRspIeLength) |
| 12170 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12171 | vos_mem_copy(pBuf, pSession->pWpaRsnRspIE, |
| 12172 | pSession->nWpaRsnRspIeLength); |
| 12173 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12174 | } |
| 12175 | } |
| 12176 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12177 | return (status); |
| 12178 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12179 | #ifdef FEATURE_WLAN_WAPI |
| 12180 | eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 12181 | { |
| 12182 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12183 | tANI_U32 len; |
| 12184 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12185 | |
| 12186 | if(!pSession) |
| 12187 | { |
| 12188 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12189 | return eHAL_STATUS_FAILURE; |
| 12190 | } |
| 12191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12192 | if(pLen) |
| 12193 | { |
| 12194 | len = *pLen; |
| 12195 | *pLen = pSession->nWapiReqIeLength; |
| 12196 | if(pBuf) |
| 12197 | { |
| 12198 | if(len >= pSession->nWapiReqIeLength) |
| 12199 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12200 | vos_mem_copy(pBuf, pSession->pWapiReqIE, |
| 12201 | pSession->nWapiReqIeLength); |
| 12202 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12203 | } |
| 12204 | } |
| 12205 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12206 | return (status); |
| 12207 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12208 | eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 12209 | { |
| 12210 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12211 | tANI_U32 len; |
| 12212 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12213 | |
| 12214 | if(!pSession) |
| 12215 | { |
| 12216 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12217 | return eHAL_STATUS_FAILURE; |
| 12218 | } |
| 12219 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12220 | if(pLen) |
| 12221 | { |
| 12222 | len = *pLen; |
| 12223 | *pLen = pSession->nWapiRspIeLength; |
| 12224 | if(pBuf) |
| 12225 | { |
| 12226 | if(len >= pSession->nWapiRspIeLength) |
| 12227 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12228 | vos_mem_copy(pBuf, pSession->pWapiRspIE, |
| 12229 | pSession->nWapiRspIeLength); |
| 12230 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12231 | } |
| 12232 | } |
| 12233 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12234 | return (status); |
| 12235 | } |
| 12236 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12237 | eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12238 | { |
| 12239 | eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION; |
| 12240 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12241 | |
| 12242 | if(!pSession) |
| 12243 | { |
| 12244 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12245 | return (retStatus); |
| 12246 | } |
| 12247 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12248 | if(CSR_IS_ROAMING(pSession)) |
| 12249 | { |
| 12250 | retStatus = eCSR_ROAM_ROAMING_COMPLETION; |
| 12251 | pSession->fRoaming = eANI_BOOLEAN_FALSE; |
| 12252 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12253 | return (retStatus); |
| 12254 | } |
| 12255 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12256 | //This function remove the connected BSS from te cached scan result |
| 12257 | eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac, |
| 12258 | tCsrRoamConnectedProfile *pConnProfile) |
| 12259 | { |
| 12260 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12261 | tCsrScanResultFilter *pScanFilter = NULL; |
| 12262 | tListElem *pEntry; |
| 12263 | tCsrScanResult *pResult; |
| 12264 | tDot11fBeaconIEs *pIes; |
| 12265 | tANI_BOOLEAN fMatch; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12266 | if(!(csrIsMacAddressZero(pMac, &pConnProfile->bssid) || |
| 12267 | csrIsMacAddressBroadcast(pMac, &pConnProfile->bssid))) |
| 12268 | { |
| 12269 | do |
| 12270 | { |
| 12271 | //Prepare the filter. Only fill in the necessary fields. Not all fields are needed |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12272 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 12273 | if ( NULL == pScanFilter ) |
| 12274 | status = eHAL_STATUS_FAILURE; |
| 12275 | else |
| 12276 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12277 | if(!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12278 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
| 12279 | pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tCsrBssid)); |
| 12280 | if ( NULL == pScanFilter->BSSIDs.bssid ) |
| 12281 | status = eHAL_STATUS_FAILURE; |
| 12282 | else |
| 12283 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12284 | if(!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12285 | vos_mem_copy(pScanFilter->BSSIDs.bssid, &pConnProfile->bssid, |
| 12286 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12287 | pScanFilter->BSSIDs.numOfBSSIDs = 1; |
| 12288 | if(!csrIsNULLSSID(pConnProfile->SSID.ssId, pConnProfile->SSID.length)) |
| 12289 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12290 | pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo)); |
| 12291 | if ( NULL == pScanFilter->SSIDs.SSIDList ) |
| 12292 | status = eHAL_STATUS_FAILURE; |
| 12293 | else |
| 12294 | status = eHAL_STATUS_SUCCESS; |
| 12295 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12296 | vos_mem_copy(&pScanFilter->SSIDs.SSIDList[0].SSID, |
| 12297 | &pConnProfile->SSID, sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12298 | } |
| 12299 | pScanFilter->authType.numEntries = 1; |
| 12300 | pScanFilter->authType.authType[0] = pConnProfile->AuthType; |
| 12301 | pScanFilter->BSSType = pConnProfile->BSSType; |
| 12302 | pScanFilter->EncryptionType.numEntries = 1; |
| 12303 | pScanFilter->EncryptionType.encryptionType[0] = pConnProfile->EncryptionType; |
| 12304 | pScanFilter->mcEncryptionType.numEntries = 1; |
| 12305 | pScanFilter->mcEncryptionType.encryptionType[0] = pConnProfile->mcEncryptionType; |
| 12306 | //We ignore the channel for now, BSSID should be enough |
| 12307 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 12308 | //Also ignore the following fields |
| 12309 | pScanFilter->uapsd_mask = 0; |
| 12310 | pScanFilter->bWPSAssociation = eANI_BOOLEAN_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 12311 | pScanFilter->bOSENAssociation = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12312 | pScanFilter->countryCode[0] = 0; |
| 12313 | pScanFilter->phyMode = eCSR_DOT11_MODE_TAURUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12314 | csrLLLock(&pMac->scan.scanResultList); |
| 12315 | pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK ); |
| 12316 | while( pEntry ) |
| 12317 | { |
| 12318 | pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link ); |
| 12319 | pIes = (tDot11fBeaconIEs *)( pResult->Result.pvIes ); |
| 12320 | fMatch = csrMatchBSS(pMac, &pResult->Result.BssDescriptor, |
| 12321 | pScanFilter, NULL, NULL, NULL, &pIes); |
| 12322 | //Release the IEs allocated by csrMatchBSS is needed |
| 12323 | if( !pResult->Result.pvIes ) |
| 12324 | { |
| 12325 | //need to free the IEs since it is allocated by csrMatchBSS |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12326 | vos_mem_free(pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12327 | } |
| 12328 | if(fMatch) |
| 12329 | { |
| 12330 | //We found the one |
| 12331 | if( csrLLRemoveEntry(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK) ) |
| 12332 | { |
| 12333 | //Free the memory |
| 12334 | csrFreeScanResultEntry( pMac, pResult ); |
| 12335 | } |
| 12336 | break; |
| 12337 | } |
| 12338 | pEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK); |
| 12339 | }//while |
| 12340 | csrLLUnlock(&pMac->scan.scanResultList); |
| 12341 | }while(0); |
| 12342 | if(pScanFilter) |
| 12343 | { |
| 12344 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12345 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12346 | } |
| 12347 | } |
| 12348 | return (status); |
| 12349 | } |
| 12350 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12351 | //BT-AMP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12352 | eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId ) |
| 12353 | { |
| 12354 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12355 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12356 | for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 12357 | { |
| 12358 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 12359 | { |
| 12360 | if( csrIsConnStateIbss( pMac, sessionId ) || csrIsBTAMP( pMac, sessionId ) ) |
| 12361 | { |
| 12362 | //co-exist with IBSS or BT-AMP is not supported |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12363 | smsLog( pMac, LOGW, " BTAMP is not allowed due to IBSS/BT-AMP exist in session %d", sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12364 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 12365 | break; |
| 12366 | } |
| 12367 | if( csrIsConnStateInfra( pMac, sessionId ) ) |
| 12368 | { |
| 12369 | if( chnId && |
| 12370 | ( (tANI_U8)chnId != pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ) ) |
| 12371 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12372 | smsLog( pMac, LOGW, " BTAMP is not allowed due to channel (%d) diff than infr channel (%d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12373 | chnId, pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ); |
| 12374 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 12375 | break; |
| 12376 | } |
| 12377 | } |
| 12378 | } |
| 12379 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12380 | return ( status ); |
| 12381 | } |
| 12382 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12383 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ) |
| 12384 | { |
| 12385 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12386 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12387 | tBssConfigParam bssConfig; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12388 | |
| 12389 | if(!pSession) |
| 12390 | { |
| 12391 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12392 | return eHAL_STATUS_FAILURE; |
| 12393 | } |
| 12394 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12395 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 12396 | { |
| 12397 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 12398 | } |
| 12399 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 12400 | { |
| 12401 | // Disassociate from the connected Infrastructure network... |
| 12402 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 12403 | } |
| 12404 | else |
| 12405 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12406 | //We don't expect Bt-AMP HDD not to disconnect the last connection first at this time. |
| 12407 | //Otherwise we need to add code to handle the |
| 12408 | //situation just like IBSS. Though for WDS station, we need to send disassoc to PE first then |
| 12409 | //send stop_bss to PE, before we can continue. |
| 12410 | VOS_ASSERT( !csrIsConnStateWds( pMac, sessionId ) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12411 | vos_mem_set(&bssConfig, sizeof(tBssConfigParam), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12412 | /* Assume HDD provide bssid in profile */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12413 | vos_mem_copy(&pSession->bssParams.bssid, pProfile->BSSIDs.bssid[0], |
| 12414 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12415 | // there is no Bss description before we start an WDS so we need |
| 12416 | // to adopt all Bss configuration parameters from the Profile. |
| 12417 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, &bssConfig, pBssDesc); |
| 12418 | if(HAL_STATUS_SUCCESS(status)) |
| 12419 | { |
| 12420 | //Save profile for late use |
| 12421 | csrFreeRoamProfile( pMac, sessionId ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12422 | pSession->pCurRoamProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 12423 | if (pSession->pCurRoamProfile != NULL ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12424 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12425 | vos_mem_set(pSession->pCurRoamProfile, |
| 12426 | sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12427 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile); |
| 12428 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12429 | //Prepare some more parameters for this WDS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12430 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 12431 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 12432 | NULL, &bssConfig, |
| 12433 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12434 | } |
| 12435 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 12436 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12437 | return( status ); |
| 12438 | } |
| 12439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12440 | ////////////////////Mail box |
| 12441 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12442 | //pBuf is caller allocated memory point to &(tSirSmeJoinReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 12443 | //or &(tSirSmeReassocReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 12444 | static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, |
| 12445 | tSirBssDescription *pBssDescription, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12446 | tANI_U8 *pBuf, tANI_U8 uapsdMask) |
| 12447 | { |
| 12448 | tCsrChannelSet channelGroup; |
| 12449 | tSirMacCapabilityInfo *pAP_capabilityInfo; |
| 12450 | tAniBool fTmp; |
| 12451 | tANI_BOOLEAN found = FALSE; |
| 12452 | tANI_U32 size = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12453 | tANI_S8 pwrLimit = 0; |
| 12454 | tANI_U16 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12455 | // plug in neighborhood occupancy info (i.e. BSSes on primary or secondary channels) |
| 12456 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundPri |
| 12457 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecDown |
| 12458 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecUp |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12459 | // 802.11h |
| 12460 | //We can do this because it is in HOST CPU order for now. |
| 12461 | pAP_capabilityInfo = (tSirMacCapabilityInfo *)&pBssDescription->capabilityInfo; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12462 | //tell the target AP my 11H capability only if both AP and STA support 11H and the channel being used is 11a |
| 12463 | if ( csrIs11hSupported( pMac ) && pAP_capabilityInfo->spectrumMgt && eSIR_11A_NW_TYPE == pBssDescription->nwType ) |
| 12464 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12465 | fTmp = (tAniBool)pal_cpu_to_be32(1); |
| 12466 | } |
| 12467 | else |
| 12468 | fTmp = (tAniBool)0; |
| 12469 | |
| 12470 | // corresponds to --- pMsg->spectrumMgtIndicator = ON; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12471 | vos_mem_copy(pBuf, (tANI_U8 *)&fTmp, sizeof(tAniBool)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12472 | pBuf += sizeof(tAniBool); |
| 12473 | *pBuf++ = MIN_STA_PWR_CAP_DBM; // it is for pMsg->powerCap.minTxPower = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12474 | found = csrSearchChannelListForTxPower(pMac, pBssDescription, &channelGroup); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12475 | // This is required for 11k test VoWiFi Ent: Test 2. |
| 12476 | // We need the power capabilities for Assoc Req. |
| 12477 | // This macro is provided by the halPhyCfg.h. We pick our |
| 12478 | // max and min capability by the halPhy provided macros |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12479 | pwrLimit = csrGetCfgMaxTxPower (pMac, pBssDescription->channelId); |
| 12480 | if (0 != pwrLimit) |
| 12481 | { |
| 12482 | *pBuf++ = pwrLimit; |
| 12483 | } |
| 12484 | else |
| 12485 | { |
| 12486 | *pBuf++ = MAX_STA_PWR_CAP_DBM; |
| 12487 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12488 | size = sizeof(pMac->roam.validChannelList); |
| 12489 | if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size))) |
| 12490 | { |
| 12491 | *pBuf++ = (tANI_U8)size; //tSirSupChnl->numChnl |
| 12492 | for ( i = 0; i < size; i++) |
| 12493 | { |
| 12494 | *pBuf++ = pMac->roam.validChannelList[ i ]; //tSirSupChnl->channelList[ i ] |
| 12495 | |
| 12496 | } |
| 12497 | } |
| 12498 | else |
| 12499 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12500 | smsLog(pMac, LOGE, FL("can not find any valid channel")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12501 | *pBuf++ = 0; //tSirSupChnl->numChnl |
| 12502 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12503 | //Check whether it is ok to enter UAPSD |
| 12504 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 12505 | if( btcIsReadyForUapsd(pMac) ) |
| 12506 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 12507 | { |
| 12508 | *pBuf++ = uapsdMask; |
| 12509 | } |
| 12510 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 12511 | else |
| 12512 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12513 | smsLog(pMac, LOGE, FL(" BTC doesn't allow UAPSD for uapsd_mask(0x%X)"), uapsdMask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12514 | *pBuf++ = 0; |
| 12515 | } |
| 12516 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 12517 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12518 | // move the entire BssDescription into the join request. |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12519 | vos_mem_copy(pBuf, pBssDescription, |
| 12520 | pBssDescription->length + sizeof( pBssDescription->length )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12521 | pBuf += pBssDescription->length + sizeof( pBssDescription->length ); // update to new location |
| 12522 | } |
| 12523 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12524 | /* |
| 12525 | * The communication between HDD and LIM is thru mailbox (MB). |
| 12526 | * Both sides will access the data structure "tSirSmeJoinReq". |
| 12527 | * The rule is, while the components of "tSirSmeJoinReq" can be accessed in the regular way like tSirSmeJoinReq.assocType, this guideline |
| 12528 | * stops at component tSirRSNie; any acces to the components after tSirRSNie is forbidden because the space from tSirRSNie is quueezed |
| 12529 | * with the component "tSirBssDescription". And since the size of actual 'tSirBssDescription' varies, the receiving side (which is the routine |
| 12530 | * limJoinReqSerDes() of limSerDesUtils.cc) should keep in mind not to access the components DIRECTLY after tSirRSNie. |
| 12531 | */ |
| 12532 | eHalStatus csrSendJoinReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12533 | tCsrRoamProfile *pProfile, tDot11fBeaconIEs *pIes, tANI_U16 messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12534 | { |
| 12535 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12536 | tSirSmeJoinReq *pMsg; |
| 12537 | tANI_U8 *pBuf; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12538 | v_U8_t acm_mask = 0, uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12539 | tANI_U16 msgLen, wTmp, ieLen; |
| 12540 | tSirMacRateSet OpRateSet; |
| 12541 | tSirMacRateSet ExRateSet; |
| 12542 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12543 | tANI_U32 dwTmp; |
| 12544 | tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN]; //RSN MAX is bigger than WPA MAX |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 12545 | tANI_U32 ucDot11Mode = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12546 | |
| 12547 | if(!pSession) |
| 12548 | { |
| 12549 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12550 | return eHAL_STATUS_FAILURE; |
| 12551 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12552 | /* To satisfy klockworks */ |
| 12553 | if (NULL == pBssDescription) |
| 12554 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12555 | smsLog(pMac, LOGE, FL(" pBssDescription is NULL")); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12556 | return eHAL_STATUS_FAILURE; |
| 12557 | } |
| 12558 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12559 | do { |
| 12560 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 12561 | pSession->joinFailStatusCode.reasonCode = 0; |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 12562 | memcpy (&pSession->joinFailStatusCode.bssId, &pBssDescription->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12563 | // There are a number of variable length fields to consider. First, the tSirSmeJoinReq |
| 12564 | // includes a single bssDescription. bssDescription includes a single tANI_U32 for the |
| 12565 | // IE fields, but the length field in the bssDescription needs to be interpreted to |
| 12566 | // determine length of the IE fields. |
| 12567 | // |
| 12568 | // So, take the size of the JoinReq, subtract the size of the bssDescription and |
| 12569 | // add in the length from the bssDescription (then add the size of the 'length' field |
| 12570 | // itself because that is NOT included in the length field). |
| 12571 | msgLen = sizeof( tSirSmeJoinReq ) - sizeof( *pBssDescription ) + |
| 12572 | pBssDescription->length + sizeof( pBssDescription->length ) + |
| 12573 | sizeof( tCsrWpaIe ) + sizeof( tCsrWpaAuthIe ) + sizeof( tANI_U16 ); // add in the size of the WPA IE that we may build. |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12574 | pMsg = vos_mem_malloc(msgLen); |
| 12575 | if (NULL == pMsg) |
| 12576 | status = eHAL_STATUS_FAILURE; |
| 12577 | else |
| 12578 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12579 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12580 | vos_mem_set(pMsg, msgLen , 0); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12581 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)messageType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12582 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 12583 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12584 | // sessionId |
| 12585 | *pBuf = (tANI_U8)sessionId; |
| 12586 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12587 | // transactionId |
| 12588 | *pBuf = 0; |
| 12589 | *( pBuf + 1 ) = 0; |
| 12590 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12591 | // ssId |
| 12592 | if( pIes->SSID.present && pIes->SSID.num_ssid ) |
| 12593 | { |
| 12594 | // ssId len |
| 12595 | *pBuf = pIes->SSID.num_ssid; |
| 12596 | pBuf++; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12597 | vos_mem_copy(pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12598 | pBuf += pIes->SSID.num_ssid; |
| 12599 | } |
| 12600 | else |
| 12601 | { |
| 12602 | *pBuf = 0; |
| 12603 | pBuf++; |
| 12604 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12605 | // selfMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12606 | vos_mem_copy((tSirMacAddr *)pBuf, &pSession->selfMacAddr, |
| 12607 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12608 | pBuf += sizeof(tSirMacAddr); |
| 12609 | // bsstype |
| 12610 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) ); |
| 12611 | if (dwTmp == eSIR_BTAMP_STA_MODE) dwTmp = eSIR_BTAMP_AP_MODE; // Override BssType for BTAMP |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12612 | vos_mem_copy(pBuf, &dwTmp, sizeof(tSirBssType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12613 | pBuf += sizeof(tSirBssType); |
| 12614 | // dot11mode |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 12615 | ucDot11Mode = csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode ); |
| 12616 | if (pBssDescription->channelId <= 14 && |
| 12617 | FALSE == pMac->roam.configParam.enableVhtFor24GHz && |
| 12618 | WNI_CFG_DOT11_MODE_11AC == ucDot11Mode) |
| 12619 | { |
| 12620 | //Need to disable VHT operation in 2.4 GHz band |
| 12621 | ucDot11Mode = WNI_CFG_DOT11_MODE_11N; |
| 12622 | } |
| 12623 | *pBuf = (tANI_U8)ucDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12624 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12625 | //Persona |
| 12626 | *pBuf = (tANI_U8)pProfile->csrPersona; |
| 12627 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12628 | //CBMode |
| 12629 | *pBuf = (tANI_U8)pSession->bssParams.cbMode; |
| 12630 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12631 | |
| 12632 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12633 | FL("CSR PERSONA=%d CSR CbMode %d"), pProfile->csrPersona, pSession->bssParams.cbMode); |
| 12634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12635 | // uapsdPerAcBitmask |
| 12636 | *pBuf = pProfile->uapsd_mask; |
| 12637 | pBuf++; |
| 12638 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12639 | |
| 12640 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12641 | status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12642 | if (HAL_STATUS_SUCCESS(status) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12643 | { |
| 12644 | // OperationalRateSet |
| 12645 | if (OpRateSet.numRates) { |
| 12646 | *pBuf++ = OpRateSet.numRates; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12647 | vos_mem_copy(pBuf, OpRateSet.rate, OpRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12648 | pBuf += OpRateSet.numRates; |
| 12649 | } else *pBuf++ = 0; |
| 12650 | // ExtendedRateSet |
| 12651 | if (ExRateSet.numRates) { |
| 12652 | *pBuf++ = ExRateSet.numRates; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12653 | vos_mem_copy(pBuf, ExRateSet.rate, ExRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12654 | pBuf += ExRateSet.numRates; |
| 12655 | } else *pBuf++ = 0; |
| 12656 | } |
| 12657 | else |
| 12658 | { |
| 12659 | *pBuf++ = 0; |
| 12660 | *pBuf++ = 0; |
| 12661 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12662 | // rsnIE |
| 12663 | if ( csrIsProfileWpa( pProfile ) ) |
| 12664 | { |
| 12665 | // Insert the Wpa IE into the join request |
| 12666 | ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes, |
| 12667 | (tCsrWpaIe *)( wpaRsnIE ) ); |
| 12668 | } |
| 12669 | else if( csrIsProfileRSN( pProfile ) ) |
| 12670 | { |
| 12671 | // Insert the RSN IE into the join request |
| 12672 | ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 12673 | (tCsrRSNIe *)( wpaRsnIE ) ); |
| 12674 | } |
| 12675 | #ifdef FEATURE_WLAN_WAPI |
| 12676 | else if( csrIsProfileWapi( pProfile ) ) |
| 12677 | { |
| 12678 | // Insert the WAPI IE into the join request |
| 12679 | ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 12680 | (tCsrWapiIe *)( wpaRsnIE ) ); |
| 12681 | } |
| 12682 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12683 | else |
| 12684 | { |
| 12685 | ieLen = 0; |
| 12686 | } |
| 12687 | //remember the IE for future use |
| 12688 | if( ieLen ) |
| 12689 | { |
| 12690 | if(ieLen > DOT11F_IE_RSN_MAX_LEN) |
| 12691 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12692 | smsLog(pMac, LOGE, FL(" WPA RSN IE length :%d is more than DOT11F_IE_RSN_MAX_LEN, resetting to %d"), ieLen, DOT11F_IE_RSN_MAX_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12693 | ieLen = DOT11F_IE_RSN_MAX_LEN; |
| 12694 | } |
| 12695 | #ifdef FEATURE_WLAN_WAPI |
| 12696 | if( csrIsProfileWapi( pProfile ) ) |
| 12697 | { |
| 12698 | //Check whether we need to allocate more memory |
| 12699 | if(ieLen > pSession->nWapiReqIeLength) |
| 12700 | { |
| 12701 | if(pSession->pWapiReqIE && pSession->nWapiReqIeLength) |
| 12702 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12703 | vos_mem_free(pSession->pWapiReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12704 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12705 | pSession->pWapiReqIE = vos_mem_malloc(ieLen); |
| 12706 | if (NULL == pSession->pWapiReqIE) |
| 12707 | status = eHAL_STATUS_FAILURE; |
| 12708 | else |
| 12709 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12710 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 12711 | } |
| 12712 | pSession->nWapiReqIeLength = ieLen; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12713 | vos_mem_copy(pSession->pWapiReqIE, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12714 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12715 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12716 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12717 | vos_mem_copy(pBuf, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12718 | pBuf += ieLen; |
| 12719 | } |
| 12720 | else//should be WPA/WPA2 otherwise |
| 12721 | #endif /* FEATURE_WLAN_WAPI */ |
| 12722 | { |
| 12723 | //Check whether we need to allocate more memory |
| 12724 | if(ieLen > pSession->nWpaRsnReqIeLength) |
| 12725 | { |
| 12726 | if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength) |
| 12727 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12728 | vos_mem_free(pSession->pWpaRsnReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12729 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12730 | pSession->pWpaRsnReqIE = vos_mem_malloc(ieLen); |
| 12731 | if (NULL == pSession->pWpaRsnReqIE) |
| 12732 | status = eHAL_STATUS_FAILURE; |
| 12733 | else |
| 12734 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12735 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 12736 | } |
| 12737 | pSession->nWpaRsnReqIeLength = ieLen; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12738 | vos_mem_copy(pSession->pWpaRsnReqIE, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12739 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12740 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12741 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12742 | vos_mem_copy(pBuf, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12743 | pBuf += ieLen; |
| 12744 | } |
| 12745 | } |
| 12746 | else |
| 12747 | { |
| 12748 | //free whatever old info |
| 12749 | pSession->nWpaRsnReqIeLength = 0; |
| 12750 | if(pSession->pWpaRsnReqIE) |
| 12751 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12752 | vos_mem_free(pSession->pWpaRsnReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12753 | pSession->pWpaRsnReqIE = NULL; |
| 12754 | } |
| 12755 | #ifdef FEATURE_WLAN_WAPI |
| 12756 | pSession->nWapiReqIeLength = 0; |
| 12757 | if(pSession->pWapiReqIE) |
| 12758 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12759 | vos_mem_free(pSession->pWapiReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12760 | pSession->pWapiReqIE = NULL; |
| 12761 | } |
| 12762 | #endif /* FEATURE_WLAN_WAPI */ |
| 12763 | //length is two bytes |
| 12764 | *pBuf = 0; |
| 12765 | *(pBuf + 1) = 0; |
| 12766 | pBuf += 2; |
| 12767 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12768 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12769 | if( eWNI_SME_JOIN_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12770 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12771 | // Never include the cckmIE in an Join Request |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12772 | //length is two bytes |
| 12773 | *pBuf = 0; |
| 12774 | *(pBuf + 1) = 0; |
| 12775 | pBuf += 2; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12776 | } |
| 12777 | else if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12778 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12779 | // cckmIE |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12780 | if( csrIsProfileESE( pProfile ) ) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12781 | { |
| 12782 | // Insert the CCKM IE into the join request |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12783 | #ifdef FEATURE_WLAN_ESE_UPLOAD |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 12784 | ieLen = pSession->suppCckmIeInfo.cckmIeLen; |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 12785 | vos_mem_copy((void *) (wpaRsnIE), |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 12786 | pSession->suppCckmIeInfo.cckmIe, ieLen); |
| 12787 | #else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12788 | ieLen = csrConstructEseCckmIe( pMac, |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12789 | pSession, |
| 12790 | pProfile, |
| 12791 | pBssDescription, |
| 12792 | pSession->pWpaRsnReqIE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12793 | pSession->nWpaRsnReqIeLength, |
| 12794 | (void *)( wpaRsnIE ) ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12795 | #endif /* FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12796 | } |
| 12797 | else |
| 12798 | { |
| 12799 | ieLen = 0; |
| 12800 | } |
| 12801 | //If present, copy the IE into the eWNI_SME_REASSOC_REQ message buffer |
| 12802 | if( ieLen ) |
| 12803 | { |
| 12804 | //Copy the CCKM IE over from the temp buffer (wpaRsnIE) |
| 12805 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12806 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12807 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12808 | vos_mem_copy(pBuf, wpaRsnIE, ieLen); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12809 | pBuf += ieLen; |
| 12810 | } |
| 12811 | else |
| 12812 | { |
| 12813 | //Indicate you have no CCKM IE |
| 12814 | //length is two bytes |
| 12815 | *pBuf = 0; |
| 12816 | *(pBuf + 1) = 0; |
| 12817 | pBuf += 2; |
| 12818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12819 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12820 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12821 | // addIEScan |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 12822 | if (pProfile->nAddIEScanLength) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12823 | { |
| 12824 | ieLen = pProfile->nAddIEScanLength; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 12825 | memset(pSession->addIEScan, 0 , pSession->nAddIEScanLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12826 | pSession->nAddIEScanLength = ieLen; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 12827 | vos_mem_copy(pSession->addIEScan, pProfile->addIEScan, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12828 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12829 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12830 | pBuf += sizeof(tANI_U16); |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 12831 | vos_mem_copy(pBuf, pProfile->addIEScan, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12832 | pBuf += ieLen; |
| 12833 | } |
| 12834 | else |
| 12835 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 12836 | memset(pSession->addIEScan, 0, pSession->nAddIEScanLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12837 | pSession->nAddIEScanLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12838 | *pBuf = 0; |
| 12839 | *(pBuf + 1) = 0; |
| 12840 | pBuf += 2; |
| 12841 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12842 | // addIEAssoc |
| 12843 | if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc) |
| 12844 | { |
| 12845 | ieLen = pProfile->nAddIEAssocLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12846 | if(ieLen > pSession->nAddIEAssocLength) |
| 12847 | { |
| 12848 | if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength) |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12849 | { |
| 12850 | vos_mem_free(pSession->pAddIEAssoc); |
| 12851 | } |
| 12852 | pSession->pAddIEAssoc = vos_mem_malloc(ieLen); |
| 12853 | if (NULL == pSession->pAddIEAssoc) |
| 12854 | status = eHAL_STATUS_FAILURE; |
| 12855 | else |
| 12856 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12857 | if(!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12858 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12859 | pSession->nAddIEAssocLength = ieLen; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12860 | vos_mem_copy(pSession->pAddIEAssoc, pProfile->pAddIEAssoc, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12861 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12862 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12863 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12864 | vos_mem_copy(pBuf, pProfile->pAddIEAssoc, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12865 | pBuf += ieLen; |
| 12866 | } |
| 12867 | else |
| 12868 | { |
| 12869 | pSession->nAddIEAssocLength = 0; |
| 12870 | if(pSession->pAddIEAssoc) |
| 12871 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12872 | vos_mem_free(pSession->pAddIEAssoc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12873 | pSession->pAddIEAssoc = NULL; |
| 12874 | } |
| 12875 | *pBuf = 0; |
| 12876 | *(pBuf + 1) = 0; |
| 12877 | pBuf += 2; |
| 12878 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12879 | |
| 12880 | if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12881 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12882 | //Unmask any AC in reassoc that is ACM-set |
| 12883 | uapsd_mask = (v_U8_t)pProfile->uapsd_mask; |
| 12884 | if( uapsd_mask && ( NULL != pBssDescription ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12885 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12886 | if( CSR_IS_QOS_BSS(pIes) && CSR_IS_UAPSD_BSS(pIes) ) |
| 12887 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12888 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12889 | acm_mask = sme_QosGetACMMask(pMac, pBssDescription, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12890 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12891 | } |
| 12892 | else |
| 12893 | { |
| 12894 | uapsd_mask = 0; |
| 12895 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12896 | } |
| 12897 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12898 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12899 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12900 | vos_mem_copy(pBuf, &dwTmp, sizeof(tANI_U32)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12901 | pBuf += sizeof(tANI_U32); |
| 12902 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12903 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12904 | vos_mem_copy(pBuf, &dwTmp, sizeof(tANI_U32)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12905 | pBuf += sizeof(tANI_U32); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12906 | #ifdef WLAN_FEATURE_11W |
| 12907 | //MgmtEncryption |
| 12908 | if (pProfile->MFPEnabled) |
| 12909 | { |
| 12910 | dwTmp = pal_cpu_to_be32(eSIR_ED_AES_128_CMAC); |
| 12911 | } |
| 12912 | else |
| 12913 | { |
| 12914 | dwTmp = pal_cpu_to_be32(eSIR_ED_NONE); |
| 12915 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12916 | vos_mem_copy(pBuf, &dwTmp, sizeof(tANI_U32)); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12917 | pBuf += sizeof(tANI_U32); |
| 12918 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12919 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12920 | pProfile->MDID.mdiePresent = pBssDescription->mdiePresent; |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 12921 | if (csrIsProfile11r( pProfile ) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12922 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 09dd66b | 2013-04-01 17:13:01 +0530 | [diff] [blame] | 12923 | && !((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) && |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12924 | (pIes->ESEVersion.present) && (pMac->roam.configParam.isEseIniFeatureEnabled)) |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 12925 | #endif |
| 12926 | ) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12927 | { |
| 12928 | // is11Rconnection; |
| 12929 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12930 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)) ; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12931 | pBuf += sizeof(tAniBool); |
| 12932 | } |
| 12933 | else |
| 12934 | { |
| 12935 | // is11Rconnection; |
| 12936 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12937 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12938 | pBuf += sizeof(tAniBool); |
| 12939 | } |
| 12940 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12941 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 12942 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12943 | // isESEFeatureIniEnabled |
| 12944 | if (TRUE == pMac->roam.configParam.isEseIniFeatureEnabled) |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 12945 | { |
| 12946 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12947 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 12948 | pBuf += sizeof(tAniBool); |
| 12949 | } |
| 12950 | else |
| 12951 | { |
| 12952 | dwTmp = pal_cpu_to_be32(FALSE); |
Srinivas Girigowda | 1811278 | 2013-11-27 12:21:19 -0800 | [diff] [blame] | 12953 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 12954 | pBuf += sizeof(tAniBool); |
| 12955 | } |
| 12956 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12957 | /* A profile can not be both ESE and 11R. But an 802.11R AP |
| 12958 | * may be advertising support for ESE as well. So if we are |
| 12959 | * associating Open or explicitly ESE then we will get ESE. |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12960 | * If we are associating explictly 11R only then we will get |
| 12961 | * 11R. |
| 12962 | */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12963 | if ((csrIsProfileESE(pProfile) || |
| 12964 | ((pIes->ESEVersion.present) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12965 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12966 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 12967 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 12968 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12969 | #ifdef WLAN_FEATURE_11W |
| 12970 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 12971 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12972 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12973 | && (pMac->roam.configParam.isEseIniFeatureEnabled)) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12974 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12975 | // isESEconnection; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12976 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12977 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12978 | pBuf += sizeof(tAniBool); |
| 12979 | } |
| 12980 | else |
| 12981 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12982 | //isESEconnection; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12983 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12984 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12985 | pBuf += sizeof(tAniBool); |
| 12986 | } |
| 12987 | |
| 12988 | if (eWNI_SME_JOIN_REQ == messageType) |
| 12989 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12990 | tESETspecInfo eseTspec; |
| 12991 | // ESE-Tspec IEs in the ASSOC request is presently not supported |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12992 | // so nullify the TSPEC parameters |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12993 | vos_mem_set(&eseTspec, sizeof(tESETspecInfo), 0); |
| 12994 | vos_mem_copy(pBuf, &eseTspec, sizeof(tESETspecInfo)); |
| 12995 | pBuf += sizeof(tESETspecInfo); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12996 | } |
| 12997 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 12998 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12999 | if ((csrIsProfileESE(pProfile) || |
| 13000 | ((pIes->ESEVersion.present) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13001 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13002 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 13003 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 13004 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 13005 | #ifdef WLAN_FEATURE_11W |
| 13006 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 13007 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13008 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13009 | && (pMac->roam.configParam.isEseIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13010 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13011 | tESETspecInfo eseTspec; |
| 13012 | // ESE Tspec information |
| 13013 | vos_mem_set(&eseTspec, sizeof(tESETspecInfo), 0); |
| 13014 | eseTspec.numTspecs = sme_QosESERetrieveTspecInfo(pMac, sessionId, (tTspecInfo *) &eseTspec.tspec[0]); |
| 13015 | *pBuf = eseTspec.numTspecs; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13016 | pBuf += sizeof(tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13017 | // Copy the TSPEC information only if present |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13018 | if (eseTspec.numTspecs) { |
| 13019 | vos_mem_copy(pBuf, (void*)&eseTspec.tspec[0], |
| 13020 | (eseTspec.numTspecs*sizeof(tTspecInfo))); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13021 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13022 | pBuf += sizeof(eseTspec.tspec); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13023 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13024 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13025 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13026 | tESETspecInfo eseTspec; |
| 13027 | // ESE-Tspec IEs in the ASSOC request is presently not supported |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13028 | // so nullify the TSPEC parameters |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13029 | vos_mem_set(&eseTspec, sizeof(tESETspecInfo), 0); |
| 13030 | vos_mem_copy(pBuf, &eseTspec, sizeof(tESETspecInfo)); |
| 13031 | pBuf += sizeof(tESETspecInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13032 | } |
| 13033 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13034 | #endif // FEATURE_WLAN_ESE |
| 13035 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13036 | // Fill in isFastTransitionEnabled |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13037 | if (pMac->roam.configParam.isFastTransitionEnabled |
| 13038 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 13039 | || csrRoamIsFastRoamEnabled(pMac, sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13040 | #endif |
| 13041 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13042 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13043 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13044 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13045 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13046 | } |
| 13047 | else |
| 13048 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13049 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13050 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13051 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13052 | } |
| 13053 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 13054 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 13055 | if(csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 13056 | { |
| 13057 | //legacy fast roaming enabled |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13058 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13059 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13060 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 13061 | } |
| 13062 | else |
| 13063 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13064 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13065 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13066 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 13067 | } |
| 13068 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13069 | |
| 13070 | // txLdpcIniFeatureEnabled |
| 13071 | *pBuf = (tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 13072 | pBuf++; |
| 13073 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 13074 | if ((csrIs11hSupported (pMac)) && (CSR_IS_CHANNEL_5GHZ(pBssDescription->channelId)) && |
| 13075 | (pIes->Country.present) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)) |
| 13076 | { |
| 13077 | csrSaveToChannelPower2G_5G( pMac, pIes->Country.num_triplets * sizeof(tSirMacChanInfo), |
| 13078 | (tSirMacChanInfo *)(&pIes->Country.triplets[0]) ); |
| 13079 | csrApplyPower2Current(pMac); |
| 13080 | } |
| 13081 | |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 13082 | #ifdef WLAN_FEATURE_11AC |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 13083 | // txBFIniFeatureEnabled |
| 13084 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFEnable; |
| 13085 | pBuf++; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 13086 | |
| 13087 | // txBFCsnValue |
| 13088 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFCsnValue; |
| 13089 | pBuf++; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 13090 | #endif |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 13091 | *pBuf = (tANI_U8)pMac->roam.configParam.isAmsduSupportInAMPDU; |
| 13092 | pBuf++; |
| 13093 | |
Sandeep Puligilla | aea98a2 | 2013-12-04 13:36:32 +0530 | [diff] [blame] | 13094 | // WME |
| 13095 | if(pMac->roam.roamSession[sessionId].fWMMConnection) |
| 13096 | { |
| 13097 | //WME enabled |
| 13098 | dwTmp = pal_cpu_to_be32(TRUE); |
| 13099 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
| 13100 | pBuf += sizeof(tAniBool); |
| 13101 | } |
| 13102 | else |
| 13103 | { |
| 13104 | dwTmp = pal_cpu_to_be32(FALSE); |
| 13105 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
| 13106 | pBuf += sizeof(tAniBool); |
| 13107 | } |
| 13108 | |
| 13109 | // QOS |
| 13110 | if(pMac->roam.roamSession[sessionId].fQOSConnection) |
| 13111 | { |
| 13112 | //QOS enabled |
| 13113 | dwTmp = pal_cpu_to_be32(TRUE); |
| 13114 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
| 13115 | pBuf += sizeof(tAniBool); |
| 13116 | } |
| 13117 | else |
| 13118 | { |
| 13119 | dwTmp = pal_cpu_to_be32(FALSE); |
| 13120 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
| 13121 | pBuf += sizeof(tAniBool); |
| 13122 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13123 | //BssDesc |
| 13124 | csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, |
| 13125 | (tANI_U8)pProfile->uapsd_mask); |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 13126 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13127 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 13128 | if(!HAL_STATUS_SUCCESS(status)) |
| 13129 | { |
| 13130 | break; |
| 13131 | } |
| 13132 | else |
| 13133 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13134 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13135 | if (eWNI_SME_JOIN_REQ == messageType) |
| 13136 | { |
| 13137 | //Tush-QoS: notify QoS module that join happening |
| 13138 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_JOIN_REQ, NULL); |
| 13139 | } |
| 13140 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 13141 | { |
| 13142 | //Tush-QoS: notify QoS module that reassoc happening |
| 13143 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_REASSOC_REQ, NULL); |
| 13144 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13145 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13147 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13148 | return( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13149 | } |
| 13150 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13151 | // |
| 13152 | eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 13153 | { |
| 13154 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13155 | tSirSmeDisassocReq *pMsg; |
| 13156 | tANI_U8 *pBuf; |
| 13157 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13158 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13159 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 13160 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13161 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13162 | pMsg = vos_mem_malloc(sizeof(tSirSmeDisassocReq)); |
| 13163 | if (NULL == pMsg) |
| 13164 | status = eHAL_STATUS_FAILURE; |
| 13165 | else |
| 13166 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13167 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13168 | vos_mem_set(pMsg, sizeof( tSirSmeDisassocReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13169 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_REQ); |
| 13170 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13171 | pBuf = &pMsg->sessionId; |
| 13172 | // sessionId |
| 13173 | *pBuf++ = (tANI_U8)sessionId; |
| 13174 | // transactionId |
| 13175 | *pBuf = 0; |
| 13176 | *( pBuf + 1 ) = 0; |
| 13177 | pBuf += sizeof(tANI_U16); |
| 13178 | |
Gopichand Nakkala | 06a7b3f | 2013-03-05 17:56:50 +0530 | [diff] [blame] | 13179 | if ( (pSession->pCurRoamProfile != NULL) && |
| 13180 | ((CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
| 13181 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile))) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13182 | { |
| 13183 | // Set the bssid address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13184 | vos_mem_copy((tSirMacAddr *)pBuf, pSession->selfMacAddr, |
| 13185 | sizeof( tSirMacAddr )); |
| 13186 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13187 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13188 | // Set the peer MAC address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13189 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr )); |
| 13190 | //perMacAddr is passed as bssId for softAP |
| 13191 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13192 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 13193 | } |
| 13194 | else |
| 13195 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13196 | // Set the peer MAC address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13197 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr )); |
| 13198 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13199 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13200 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof( pMsg->bssId )); |
| 13201 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13202 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13203 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13204 | if(!HAL_STATUS_SUCCESS(status)) |
| 13205 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13206 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13207 | break; |
| 13208 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13209 | // reasonCode |
| 13210 | wTmp = pal_cpu_to_be16(reasonCode); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13211 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
| 13212 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13213 | if(!HAL_STATUS_SUCCESS(status)) |
| 13214 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13215 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13216 | break; |
| 13217 | } |
| 13218 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13219 | /* The state will be DISASSOC_HANDOFF only when we are doing handoff. |
| 13220 | Here we should not send the disassoc over the air to the AP */ |
| 13221 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId) |
| 13222 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 13223 | && csrRoamIs11rAssoc(pMac) |
| 13224 | #endif |
| 13225 | ) |
| 13226 | { |
| 13227 | *pBuf = CSR_DONT_SEND_DISASSOC_OVER_THE_AIR; /* Set DoNotSendOverTheAir flag to 1 only for handoff case */ |
| 13228 | } |
| 13229 | pBuf += sizeof(tANI_U8); |
| 13230 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13231 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13232 | return( status ); |
| 13233 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13234 | eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable, tSirMacAddr bssId ) |
| 13235 | { |
| 13236 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13237 | tSirSmeTkipCntrMeasReq *pMsg; |
| 13238 | tANI_U8 *pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13239 | do |
| 13240 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13241 | pMsg = vos_mem_malloc(sizeof( tSirSmeTkipCntrMeasReq )); |
| 13242 | if ( NULL == pMsg ) |
| 13243 | status = eHAL_STATUS_FAILURE; |
| 13244 | else |
| 13245 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13246 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13247 | vos_mem_set(pMsg, sizeof( tSirSmeTkipCntrMeasReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13248 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_TKIP_CNTR_MEAS_REQ); |
| 13249 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeTkipCntrMeasReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13250 | pBuf = &pMsg->sessionId; |
| 13251 | // sessionId |
| 13252 | *pBuf++ = (tANI_U8)sessionId; |
| 13253 | // transactionId |
| 13254 | *pBuf = 0; |
| 13255 | *( pBuf + 1 ) = 0; |
| 13256 | pBuf += sizeof(tANI_U16); |
| 13257 | // bssid |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13258 | vos_mem_copy(pMsg->bssId, bssId, sizeof( tSirMacAddr )); |
| 13259 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13260 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 13261 | // bEnable |
| 13262 | *pBuf = (tANI_BOOLEAN)bEnable; |
| 13263 | if(!HAL_STATUS_SUCCESS(status)) |
| 13264 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13265 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13266 | break; |
| 13267 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13268 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13269 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13270 | return( status ); |
| 13271 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13272 | eHalStatus |
| 13273 | csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13274 | VOS_MODULE_ID modId, tSirMacAddr bssId, |
| 13275 | void *pUsrContext, void *pfnSapEventCallback, |
| 13276 | tANI_U8 *pAssocStasBuf ) |
| 13277 | { |
| 13278 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13279 | tSirSmeGetAssocSTAsReq *pMsg; |
| 13280 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 13281 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13282 | do |
| 13283 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13284 | pMsg = vos_mem_malloc(sizeof( tSirSmeGetAssocSTAsReq )); |
| 13285 | if ( NULL == pMsg ) |
| 13286 | status = eHAL_STATUS_FAILURE; |
| 13287 | else |
| 13288 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13289 | if (!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13290 | vos_mem_set(pMsg, sizeof( tSirSmeGetAssocSTAsReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13291 | 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] | 13292 | pBuf = (tANI_U8 *)&pMsg->bssId; |
| 13293 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13294 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13295 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13296 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13297 | // modId |
| 13298 | dwTmp = pal_cpu_to_be16((tANI_U16)modId); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13299 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13300 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13301 | // pUsrContext |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13302 | vos_mem_copy(pBuf, (tANI_U8 *)pUsrContext, sizeof(void *)); |
| 13303 | pBuf += sizeof(void*); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13304 | // pfnSapEventCallback |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13305 | vos_mem_copy(pBuf, (tANI_U8 *)pfnSapEventCallback, sizeof(void*)); |
| 13306 | pBuf += sizeof(void*); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13307 | // pAssocStasBuf |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13308 | vos_mem_copy(pBuf, pAssocStasBuf, sizeof(void*)); |
| 13309 | pBuf += sizeof(void*); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13310 | 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] | 13311 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13312 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13313 | return( status ); |
| 13314 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13315 | eHalStatus |
| 13316 | csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13317 | tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac) |
| 13318 | { |
| 13319 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13320 | tSirSmeGetWPSPBCSessionsReq *pMsg; |
| 13321 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13322 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13323 | do |
| 13324 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13325 | pMsg = vos_mem_malloc(sizeof(tSirSmeGetWPSPBCSessionsReq)); |
| 13326 | if ( NULL == pMsg ) |
| 13327 | status = eHAL_STATUS_FAILURE; |
| 13328 | else |
| 13329 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13330 | if (!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13331 | vos_mem_set(pMsg, sizeof( tSirSmeGetWPSPBCSessionsReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13332 | 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] | 13333 | pBuf = (tANI_U8 *)&pMsg->pUsrContext; |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 13334 | VOS_ASSERT(pBuf); |
| 13335 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13336 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13337 | // pUsrContext |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13338 | vos_mem_copy(pBuf, (tANI_U8 *)pUsrContext, sizeof(void*)); |
| 13339 | pBuf += sizeof(void *); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13340 | // pSapEventCallback |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13341 | vos_mem_copy(pBuf, (tANI_U8 *)pfnSapEventCallback, sizeof(void *)); |
| 13342 | pBuf += sizeof(void *); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13343 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13344 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13345 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13346 | // MAC Address of STA in WPS session |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13347 | vos_mem_copy((tSirMacAddr *)pBuf, pRemoveMac.bytes, sizeof(v_MACADDR_t)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13348 | pBuf += sizeof(v_MACADDR_t); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13349 | 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] | 13350 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13351 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13352 | return( status ); |
| 13353 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13354 | |
| 13355 | eHalStatus |
| 13356 | csrSendChngMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13357 | { |
| 13358 | tpSirChangeBIParams pMsg; |
| 13359 | tANI_U16 len = 0; |
| 13360 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13361 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13362 | |
| 13363 | if(!pSession) |
| 13364 | { |
| 13365 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13366 | return eHAL_STATUS_FAILURE; |
| 13367 | } |
| 13368 | |
| 13369 | //NO need to update the Beacon Params if update beacon parameter flag is not set |
| 13370 | if(!pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval ) |
| 13371 | return eHAL_STATUS_SUCCESS; |
| 13372 | |
| 13373 | pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE; |
| 13374 | |
| 13375 | /* Create the message and send to lim */ |
| 13376 | len = sizeof(tSirChangeBIParams); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13377 | pMsg = vos_mem_malloc(len); |
| 13378 | if ( NULL == pMsg ) |
| 13379 | status = eHAL_STATUS_FAILURE; |
| 13380 | else |
| 13381 | status = eHAL_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13382 | if(HAL_STATUS_SUCCESS(status)) |
| 13383 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13384 | vos_mem_set(pMsg, sizeof(tSirChangeBIParams), 0); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13385 | pMsg->messageType = eWNI_SME_CHNG_MCC_BEACON_INTERVAL; |
| 13386 | pMsg->length = len; |
| 13387 | |
| 13388 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13389 | vos_mem_copy((tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, |
| 13390 | sizeof(tSirMacAddr)); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13391 | smsLog( pMac, LOG1, FL("CSR Attempting to change BI for Bssid= "MAC_ADDRESS_STR), |
| 13392 | MAC_ADDR_ARRAY(pMsg->bssId)); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13393 | pMsg->sessionId = sessionId; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13394 | smsLog(pMac, LOG1, FL(" session %d BeaconInterval %d"), sessionId, pMac->roam.roamSession[sessionId].bssParams.beaconInterval); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13395 | pMsg->beaconInterval = pMac->roam.roamSession[sessionId].bssParams.beaconInterval; |
| 13396 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 13397 | } |
| 13398 | return status; |
| 13399 | } |
| 13400 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13401 | eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 13402 | { |
| 13403 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13404 | tSirSmeDeauthReq *pMsg; |
| 13405 | tANI_U8 *pBuf; |
| 13406 | tANI_U16 wTmp; |
| 13407 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13408 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 13409 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13410 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13411 | pMsg = vos_mem_malloc(sizeof( tSirSmeDeauthReq )); |
| 13412 | if ( NULL == pMsg ) |
| 13413 | status = eHAL_STATUS_FAILURE; |
| 13414 | else |
| 13415 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13416 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13417 | vos_mem_set(pMsg, sizeof( tSirSmeDeauthReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13418 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_REQ); |
| 13419 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthReq )); |
| 13420 | //sessionId |
| 13421 | pBuf = &pMsg->sessionId; |
| 13422 | *pBuf++ = (tANI_U8)sessionId; |
| 13423 | |
| 13424 | //tansactionId |
| 13425 | *pBuf = 0; |
| 13426 | *(pBuf + 1 ) = 0; |
| 13427 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13428 | if ((pSession->pCurRoamProfile != NULL) && ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13429 | (CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13430 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))){ |
| 13431 | // Set the BSSID before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13432 | vos_mem_copy( (tSirMacAddr *)pBuf, pSession->selfMacAddr, |
| 13433 | sizeof( pMsg->peerMacAddr ) ); |
| 13434 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13435 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 13436 | } |
| 13437 | else |
| 13438 | { |
| 13439 | // Set the BSSID before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13440 | vos_mem_copy( (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 13441 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13442 | pBuf = pBuf + sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13443 | } |
| 13444 | if(!HAL_STATUS_SUCCESS(status)) |
| 13445 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13446 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13447 | break; |
| 13448 | } |
| 13449 | // Set the peer MAC address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13450 | vos_mem_copy( (tSirMacAddr *) pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 13451 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13452 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 13453 | if(!HAL_STATUS_SUCCESS(status)) |
| 13454 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13455 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13456 | break; |
| 13457 | } |
| 13458 | wTmp = pal_cpu_to_be16(reasonCode); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13459 | vos_mem_copy( pBuf, &wTmp,sizeof( tANI_U16 ) ); |
| 13460 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13461 | if(!HAL_STATUS_SUCCESS(status)) |
| 13462 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13463 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13464 | break; |
| 13465 | } |
| 13466 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13467 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13468 | return( status ); |
| 13469 | } |
| 13470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13471 | eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd ) |
| 13472 | { |
| 13473 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13474 | tSirSmeDisassocCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13475 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13476 | pMsg = vos_mem_malloc(sizeof( tSirSmeDisassocCnf )); |
| 13477 | if ( NULL == pMsg ) |
| 13478 | status = eHAL_STATUS_FAILURE; |
| 13479 | else |
| 13480 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13481 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13482 | vos_mem_set(pMsg, sizeof( tSirSmeDisassocCnf), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13483 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_CNF); |
| 13484 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13485 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocCnf )); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13486 | vos_mem_copy(pMsg->peerMacAddr, pDisassocInd->peerMacAddr, |
| 13487 | sizeof(pMsg->peerMacAddr)); |
| 13488 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13489 | if(!HAL_STATUS_SUCCESS(status)) |
| 13490 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13491 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13492 | break; |
| 13493 | } |
| 13494 | //To test reconn |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13495 | vos_mem_copy(pMsg->bssId, pDisassocInd->bssId, sizeof(pMsg->peerMacAddr)); |
| 13496 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13497 | if(!HAL_STATUS_SUCCESS(status)) |
| 13498 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13499 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13500 | break; |
| 13501 | } |
| 13502 | //To test reconn ends |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13503 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13504 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13505 | return( status ); |
| 13506 | } |
| 13507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13508 | eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd ) |
| 13509 | { |
| 13510 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13511 | tSirSmeDeauthCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13512 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13513 | pMsg = vos_mem_malloc(sizeof( tSirSmeDeauthCnf )); |
| 13514 | if ( NULL == pMsg ) |
| 13515 | status = eHAL_STATUS_FAILURE; |
| 13516 | else |
| 13517 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13518 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13519 | vos_mem_set(pMsg, sizeof( tSirSmeDeauthCnf ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13520 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_CNF); |
| 13521 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13522 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthCnf )); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13523 | vos_mem_copy(pMsg->bssId, pDeauthInd->bssId, sizeof(pMsg->bssId)); |
| 13524 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13525 | if(!HAL_STATUS_SUCCESS(status)) |
| 13526 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13527 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13528 | break; |
| 13529 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13530 | vos_mem_copy(pMsg->peerMacAddr, pDeauthInd->peerMacAddr, |
| 13531 | sizeof(pMsg->peerMacAddr)); |
| 13532 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13533 | if(!HAL_STATUS_SUCCESS(status)) |
| 13534 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13535 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13536 | break; |
| 13537 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13538 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13539 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13540 | return( status ); |
| 13541 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13542 | eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus ) |
| 13543 | { |
| 13544 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13545 | tSirSmeAssocCnf *pMsg; |
| 13546 | tANI_U8 *pBuf; |
| 13547 | tSirResultCodes statusCode; |
| 13548 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13549 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13550 | pMsg = vos_mem_malloc(sizeof( tSirSmeAssocCnf )); |
| 13551 | if ( NULL == pMsg ) |
| 13552 | status = eHAL_STATUS_FAILURE; |
| 13553 | else |
| 13554 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13555 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13556 | vos_mem_set(pMsg, sizeof( tSirSmeAssocCnf ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13557 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ASSOC_CNF); |
| 13558 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocCnf )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13559 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 13560 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 13561 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13562 | else |
| 13563 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13564 | vos_mem_copy(pBuf, &statusCode, sizeof(tSirResultCodes)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13565 | pBuf += sizeof(tSirResultCodes); |
| 13566 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13567 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 13568 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13569 | pBuf += sizeof (tSirMacAddr); |
| 13570 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13571 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, |
| 13572 | sizeof(tSirMacAddr)); |
| 13573 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13574 | pBuf += sizeof (tSirMacAddr); |
| 13575 | // aid |
| 13576 | wTmp = pal_cpu_to_be16(pAssocInd->aid); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13577 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13578 | pBuf += sizeof (tANI_U16); |
| 13579 | // alternateBssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13580 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 13581 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13582 | pBuf += sizeof (tSirMacAddr); |
| 13583 | // alternateChannelId |
| 13584 | *pBuf = 11; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13585 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13586 | if(!HAL_STATUS_SUCCESS(status)) |
| 13587 | { |
| 13588 | //pMsg is freed by palSendMBMessage |
| 13589 | break; |
| 13590 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13591 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13592 | return( status ); |
| 13593 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13594 | eHalStatus csrSendAssocIndToUpperLayerCnfMsg( tpAniSirGlobal pMac, |
| 13595 | tpSirSmeAssocInd pAssocInd, |
| 13596 | eHalStatus Halstatus, |
| 13597 | tANI_U8 sessionId) |
| 13598 | { |
| 13599 | tSirMsgQ msgQ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13600 | tSirSmeAssocIndToUpperLayerCnf *pMsg; |
| 13601 | tANI_U8 *pBuf; |
| 13602 | tSirResultCodes statusCode; |
| 13603 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13604 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13605 | pMsg = vos_mem_malloc(sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 13606 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13607 | vos_mem_set(pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf ), 0); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13609 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPPER_LAYER_ASSOC_CNF); |
| 13610 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 13611 | |
| 13612 | pMsg->sessionId = sessionId; |
| 13613 | |
| 13614 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 13615 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 13616 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13617 | else |
| 13618 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13619 | vos_mem_copy(pBuf, &statusCode, sizeof(tSirResultCodes)) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13620 | pBuf += sizeof(tSirResultCodes); |
| 13621 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13622 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13623 | pBuf += sizeof (tSirMacAddr); |
| 13624 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13625 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, |
| 13626 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13627 | pBuf += sizeof (tSirMacAddr); |
| 13628 | // StaId |
| 13629 | wTmp = pal_cpu_to_be16(pAssocInd->staId); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13630 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13631 | pBuf += sizeof (tANI_U16); |
| 13632 | // alternateBssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13633 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13634 | pBuf += sizeof (tSirMacAddr); |
| 13635 | // alternateChannelId |
| 13636 | *pBuf = 11; |
| 13637 | pBuf += sizeof (tANI_U8); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 13638 | // Instead of copying roam Info, we just copy only WmmEnabled, RsnIE information |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13639 | //Wmm |
| 13640 | *pBuf = pAssocInd->wmmEnabledSta; |
| 13641 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13642 | //RSN IE |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13643 | vos_mem_copy((tSirRSNie *)pBuf, &pAssocInd->rsnIE, sizeof(tSirRSNie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13644 | pBuf += sizeof (tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13645 | //Additional IE |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13646 | vos_mem_copy((void *)pBuf, &pAssocInd->addIE, sizeof(tSirAddie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13647 | pBuf += sizeof (tSirAddie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13648 | //reassocReq |
| 13649 | *pBuf = pAssocInd->reassocReq; |
| 13650 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13651 | msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF; |
| 13652 | msgQ.bodyptr = pMsg; |
| 13653 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13654 | SysProcessMmhMsg(pMac, &msgQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13655 | } while( 0 ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13656 | return( eHAL_STATUS_SUCCESS ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13657 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13658 | |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 13659 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13660 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 13661 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 13662 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 13663 | tANI_U8 *pKeyRsc ) |
| 13664 | { |
| 13665 | tSirSmeSetContextReq *pMsg; |
| 13666 | tANI_U16 msgLen; |
| 13667 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13668 | tAniEdType tmpEdType; |
| 13669 | tAniKeyDirection tmpDirection; |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 13670 | tANI_U8 *pBuf = NULL; |
| 13671 | tANI_U8 *p = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13672 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13673 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13674 | if( ( 1 != numKeys ) && ( 0 != numKeys ) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13675 | // all of these fields appear in every SET_CONTEXT message. Below we'll add in the size for each |
| 13676 | // key set. Since we only support upto one key, we always allocate memory for 1 key |
| 13677 | msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) + |
| 13678 | sizeof( tSirMacAddr ) + 1 + sizeof(tANI_U16) + |
| 13679 | sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + |
| 13680 | ( sizeof( pMsg->keyMaterial.key ) ); |
| 13681 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13682 | pMsg = vos_mem_malloc(msgLen); |
| 13683 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13684 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13685 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SETCONTEXT_REQ); |
| 13686 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13687 | //sessionId |
| 13688 | pBuf = &pMsg->sessionId; |
| 13689 | *pBuf = (tANI_U8)sessionId; |
| 13690 | pBuf++; |
| 13691 | // transactionId |
| 13692 | *pBuf = 0; |
| 13693 | *(pBuf + 1) = 0; |
| 13694 | pBuf += sizeof(tANI_U16); |
| 13695 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13696 | vos_mem_copy(pBuf, (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13697 | |
| 13698 | pBuf += sizeof(tSirMacAddr); |
| 13699 | |
| 13700 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13701 | vos_mem_copy(pBuf, (tANI_U8 *)&pSession->connectedProfile.bssid, |
| 13702 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13703 | |
| 13704 | pBuf += sizeof(tSirMacAddr); |
| 13705 | |
| 13706 | p = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13707 | // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field |
| 13708 | // in the tSirKeyMaterial keyMaterial; field). |
| 13709 | // |
| 13710 | // !!NOTE: This keyMaterial.length contains the length of a MAX size key, though the keyLength can be |
| 13711 | // shorter than this max size. Is LIM interpreting this ok ? |
| 13712 | 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] | 13713 | // set pMsg->keyMaterial.edType |
| 13714 | tmpEdType = (tAniEdType)pal_cpu_to_be32(edType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13715 | vos_mem_copy(p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13716 | p += sizeof( pMsg->keyMaterial.edType ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13717 | // set the pMsg->keyMaterial.numKeys field |
| 13718 | *p = numKeys; |
| 13719 | p += sizeof( pMsg->keyMaterial.numKeys ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13720 | // set pSirKey->keyId = keyId; |
| 13721 | *p = keyId; |
| 13722 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13723 | // set pSirKey->unicast = (tANI_U8)fUnicast; |
| 13724 | *p = (tANI_U8)fUnicast; |
| 13725 | p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13726 | // set pSirKey->keyDirection = aniKeyDirection; |
| 13727 | tmpDirection = (tAniKeyDirection)pal_cpu_to_be32(aniKeyDirection); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13728 | vos_mem_copy(p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13729 | p += sizeof(tAniKeyDirection); |
| 13730 | // pSirKey->keyRsc = ;; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13731 | vos_mem_copy(p, pKeyRsc, CSR_MAX_RSC_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13732 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13733 | // set pSirKey->paeRole |
| 13734 | *p = paeRole; // 0 is Supplicant |
| 13735 | p++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13736 | // set pSirKey->keyLength = keyLength; |
| 13737 | p = pal_set_U16( p, pal_cpu_to_be16(keyLength) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13738 | if ( keyLength && pKey ) |
| 13739 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13740 | vos_mem_copy(p, pKey, keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13741 | if(keyLength == 16) |
| 13742 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13743 | smsLog(pMac, LOG1, " SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13744 | keyId, edType, pKey[0], pKey[1], pKey[2], pKey[3], pKey[4], |
| 13745 | pKey[5], pKey[6], pKey[7], pKey[8], |
| 13746 | pKey[9], pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], pKey[15]); |
| 13747 | } |
| 13748 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13749 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13750 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13751 | return( status ); |
| 13752 | } |
| 13753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13754 | eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, |
| 13755 | tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc ) |
| 13756 | { |
| 13757 | eHalStatus status; |
| 13758 | tSirSmeStartBssReq *pMsg; |
| 13759 | tANI_U8 *pBuf = NULL; |
| 13760 | tANI_U8 *wTmpBuf = NULL; |
| 13761 | tANI_U16 msgLen, wTmp; |
| 13762 | tANI_U32 dwTmp; |
| 13763 | tSirNwType nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13764 | ePhyChanBondState cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13765 | tANI_U32 authType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13766 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13767 | |
| 13768 | if(!pSession) |
| 13769 | { |
| 13770 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13771 | return eHAL_STATUS_FAILURE; |
| 13772 | } |
| 13773 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13774 | do { |
| 13775 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 13776 | pSession->joinFailStatusCode.reasonCode = 0; |
| 13777 | msgLen = sizeof(tSirSmeStartBssReq); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13778 | pMsg = vos_mem_malloc(msgLen); |
| 13779 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13780 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13781 | 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] | 13782 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13783 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13784 | //sessionId |
| 13785 | *pBuf = (tANI_U8)sessionId; |
| 13786 | pBuf++; |
| 13787 | // transactionId |
| 13788 | *pBuf = 0; |
| 13789 | *(pBuf + 1) = 0; |
| 13790 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13791 | // bssid |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13792 | vos_mem_copy(pBuf, pParam->bssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13793 | pBuf += sizeof(tSirMacAddr); |
| 13794 | // selfMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13795 | vos_mem_copy(pBuf, pSession->selfMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13796 | pBuf += sizeof(tSirMacAddr); |
| 13797 | // beaconInterval |
| 13798 | if( pBssDesc && pBssDesc->beaconInterval ) |
| 13799 | { |
| 13800 | wTmp = pal_cpu_to_be16( pBssDesc->beaconInterval ); |
| 13801 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13802 | else if(pParam->beaconInterval) |
| 13803 | { |
| 13804 | wTmp = pal_cpu_to_be16( pParam->beaconInterval ); |
| 13805 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13806 | else |
| 13807 | { |
| 13808 | wTmp = pal_cpu_to_be16( WNI_CFG_BEACON_INTERVAL_STADEF ); |
| 13809 | } |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame] | 13810 | if(csrIsconcurrentsessionValid (pMac, sessionId, |
| 13811 | pParam->bssPersona) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13812 | == eHAL_STATUS_SUCCESS ) |
| 13813 | { |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13814 | csrValidateMCCBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13815 | pParam->bssPersona); |
| 13816 | //Update the beacon Interval |
| 13817 | pParam->beaconInterval = wTmp; |
| 13818 | } |
| 13819 | else |
| 13820 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13821 | smsLog( pMac,LOGE, FL("****Start BSS failed persona already exists***")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13822 | status = eHAL_STATUS_FAILURE; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13823 | vos_mem_free(pMsg); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13824 | return status; |
| 13825 | } |
| 13826 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13827 | vos_mem_copy(pBuf, &wTmp, sizeof( tANI_U16 )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13828 | pBuf += sizeof(tANI_U16); |
| 13829 | // dot11mode |
| 13830 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pParam->uCfgDot11Mode ); |
| 13831 | pBuf += 1; |
| 13832 | // bssType |
| 13833 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( bssType ) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13834 | vos_mem_copy(pBuf, &dwTmp, sizeof(tSirBssType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13835 | pBuf += sizeof(tSirBssType); |
| 13836 | // ssId |
| 13837 | if( pParam->ssId.length ) |
| 13838 | { |
| 13839 | // ssId len |
| 13840 | *pBuf = pParam->ssId.length; |
| 13841 | pBuf++; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13842 | vos_mem_copy(pBuf, pParam->ssId.ssId, pParam->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13843 | pBuf += pParam->ssId.length; |
| 13844 | } |
| 13845 | else |
| 13846 | { |
| 13847 | *pBuf = 0; |
| 13848 | pBuf++; |
| 13849 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13850 | // set the channel Id |
| 13851 | *pBuf = pParam->operationChn; |
| 13852 | pBuf++; |
| 13853 | //What should we really do for the cbmode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13854 | cbMode = (ePhyChanBondState)pal_cpu_to_be32(pParam->cbMode); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13855 | vos_mem_copy(pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13856 | pBuf += sizeof(ePhyChanBondState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13857 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13858 | // Set privacy |
| 13859 | *pBuf = pParam->privacy; |
| 13860 | pBuf++; |
| 13861 | |
| 13862 | //Set Uapsd |
| 13863 | *pBuf = pParam->ApUapsdEnable; |
| 13864 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13865 | //Set SSID hidden |
| 13866 | *pBuf = pParam->ssidHidden; |
| 13867 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13868 | *pBuf = (tANI_U8)pParam->fwdWPSPBCProbeReq; |
| 13869 | pBuf++; |
| 13870 | |
| 13871 | //Ht protection Enable/Disable |
| 13872 | *pBuf = (tANI_U8)pParam->protEnabled; |
| 13873 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13874 | //Enable Beacons to Receive for OBSS protection Enable/Disable |
| 13875 | *pBuf = (tANI_U8)pParam->obssProtEnabled; |
| 13876 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13877 | //set cfg related to protection |
| 13878 | wTmp = pal_cpu_to_be16( pParam->ht_protection ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13879 | vos_mem_copy(pBuf, &wTmp, sizeof( tANI_U16 )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13880 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13881 | // Set Auth type |
| 13882 | authType = pal_cpu_to_be32(pParam->authType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13883 | vos_mem_copy(pBuf, (tANI_U8 *)&authType, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13884 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13885 | // Set DTIM |
| 13886 | dwTmp = pal_cpu_to_be32(pParam->dtimPeriod); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13887 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13888 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13889 | // Set wps_state |
| 13890 | *pBuf = pParam->wps_state; |
| 13891 | pBuf++; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 13892 | // set isCoalesingInIBSSAllowed |
| 13893 | *pBuf = pMac->isCoalesingInIBSSAllowed; |
| 13894 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13895 | //Persona |
| 13896 | *pBuf = (tANI_U8)pParam->bssPersona; |
| 13897 | pBuf++; |
| 13898 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 13899 | //txLdpcIniFeatureEnabled |
| 13900 | *pBuf = (tANI_U8)(tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 13901 | pBuf++; |
krunal soni | 4f087d2 | 2013-07-29 16:32:26 -0700 | [diff] [blame] | 13902 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 13903 | #ifdef WLAN_FEATURE_11W |
| 13904 | // Set MFP capable/required |
| 13905 | *pBuf = (tANI_U8)pParam->mfpCapable; |
| 13906 | pBuf++; |
| 13907 | *pBuf = (tANI_U8)pParam->mfpRequired; |
| 13908 | pBuf++; |
| 13909 | #endif |
| 13910 | |
krunal soni | 4f087d2 | 2013-07-29 16:32:26 -0700 | [diff] [blame] | 13911 | // set RSN IE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13912 | if( pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata) ) |
| 13913 | { |
| 13914 | status = eHAL_STATUS_INVALID_PARAMETER; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13915 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13916 | break; |
| 13917 | } |
| 13918 | wTmp = pal_cpu_to_be16( pParam->nRSNIELength ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13919 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13920 | pBuf += sizeof(tANI_U16); |
| 13921 | if( wTmp ) |
| 13922 | { |
| 13923 | wTmp = pParam->nRSNIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13924 | vos_mem_copy(pBuf, pParam->pRSNIE, wTmp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13925 | pBuf += wTmp; |
| 13926 | } |
| 13927 | nwType = (tSirNwType)pal_cpu_to_be32(pParam->sirNwType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13928 | vos_mem_copy(pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13929 | pBuf += sizeof(tSirNwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13930 | *pBuf = pParam->operationalRateSet.numRates; //tSirMacRateSet->numRates |
| 13931 | pBuf++; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13932 | vos_mem_copy(pBuf, pParam->operationalRateSet.rate, |
| 13933 | pParam->operationalRateSet.numRates ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13934 | pBuf += pParam->operationalRateSet.numRates ; |
| 13935 | *pBuf++ = pParam->extendedRateSet.numRates; |
| 13936 | if(0 != pParam->extendedRateSet.numRates) |
| 13937 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13938 | vos_mem_copy(pBuf, pParam->extendedRateSet.rate, |
| 13939 | pParam->extendedRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13940 | pBuf += pParam->extendedRateSet.numRates; |
| 13941 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 13942 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13943 | msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg |
| 13944 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 13945 | |
| 13946 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13947 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13948 | return( status ); |
| 13949 | } |
| 13950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13951 | eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 13952 | { |
| 13953 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13954 | tSirSmeStopBssReq *pMsg; |
| 13955 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13956 | tANI_U8 *pBuf; |
| 13957 | tANI_U16 msgLen; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13958 | |
| 13959 | if(!pSession) |
| 13960 | { |
| 13961 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13962 | return eHAL_STATUS_FAILURE; |
| 13963 | } |
| 13964 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13965 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13966 | pMsg = vos_mem_malloc(sizeof(tSirSmeStopBssReq)); |
| 13967 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13968 | vos_mem_set(pMsg, sizeof( tSirSmeStopBssReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13969 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 13970 | pBuf = &pMsg->sessionId; |
| 13971 | //sessionId |
| 13972 | *pBuf = (tANI_U8)sessionId; |
| 13973 | pBuf++; |
| 13974 | // transactionId |
| 13975 | *pBuf = 0; |
| 13976 | pBuf += sizeof(tANI_U16); |
| 13977 | //reason code |
| 13978 | *pBuf = 0; |
| 13979 | pBuf += sizeof(tSirResultCodes); |
| 13980 | // bssid |
| 13981 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 13982 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 13983 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13984 | vos_mem_copy(pBuf, (tANI_U8 *)&pSession->selfMacAddr, |
| 13985 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13986 | } |
| 13987 | else |
| 13988 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13989 | vos_mem_copy(pBuf, (tANI_U8 *)&pSession->connectedProfile.bssid, |
| 13990 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13991 | } |
| 13992 | pBuf += sizeof(tSirMacAddr); |
| 13993 | msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr); |
| 13994 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13995 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13996 | #if 0 |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13997 | pMsg = vos_mem_malloc(sizeof(tSirSmeStopBssReq)); |
| 13998 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13999 | vos_mem_set(pMsg, sizeof( tSirSmeStopBssReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14000 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 14001 | pMsg->reasonCode = 0; |
| 14002 | // bssid |
| 14003 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 14004 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 14005 | { |
| 14006 | pbBssid = (tANI_U8 *)&pSession->selfMacAddr; |
| 14007 | } |
| 14008 | else |
| 14009 | { |
| 14010 | pbBssid = (tANI_U8 *)&pSession->connectedProfile.bssid; |
| 14011 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14012 | vos_mem_copy(&pMsg->bssId, pbBssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14013 | pMsg->transactionId = 0; |
| 14014 | pMsg->sessionId = (tANI_U8)sessionId; |
| 14015 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeStopBssReq )); |
| 14016 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 14017 | #endif |
| 14018 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14019 | return( status ); |
| 14020 | } |
| 14021 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14022 | eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 14023 | tCsrRoamModifyProfileFields *pModProfileFields, |
| 14024 | tANI_U32 *pRoamId, v_BOOL_t fForce) |
| 14025 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14026 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14027 | tANI_U32 roamId = 0; |
| 14028 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14029 | if((csrIsConnStateConnected(pMac, sessionId)) && |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14030 | (fForce || (!vos_mem_compare( &pModProfileFields, |
| 14031 | &pSession->connectedProfile.modifyProfileFields, |
| 14032 | sizeof(tCsrRoamModifyProfileFields)))) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14033 | { |
| 14034 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 14035 | if(pRoamId) |
| 14036 | { |
| 14037 | *pRoamId = roamId; |
| 14038 | } |
| 14039 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14040 | status = csrRoamIssueReassoc(pMac, sessionId, NULL, pModProfileFields, |
| 14041 | eCsrSmeIssuedReassocToSameAP, roamId, |
| 14042 | eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14043 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14044 | return status; |
| 14045 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14046 | static eHalStatus csrRoamSessionOpened(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14047 | { |
| 14048 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14049 | tCsrRoamInfo roamInfo; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14050 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14051 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 14052 | eCSR_ROAM_SESSION_OPENED, eCSR_ROAM_RESULT_NONE); |
| 14053 | return (status); |
| 14054 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14055 | eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 14056 | { |
| 14057 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14058 | tListElem *pEntry = NULL; |
| 14059 | tSmeCmd *pCommand = NULL; |
| 14060 | tSirSmeAddStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14061 | do |
| 14062 | { |
| 14063 | if(pMsg == NULL) |
| 14064 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14065 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14066 | status = eHAL_STATUS_FAILURE; |
| 14067 | break; |
| 14068 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14069 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 14070 | if(pEntry) |
| 14071 | { |
| 14072 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14073 | if(eSmeCommandAddStaSession == pCommand->command) |
| 14074 | { |
| 14075 | pRsp = (tSirSmeAddStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14076 | smsLog( pMac, LOG1, "Add Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14077 | //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] | 14078 | csrRoamSessionOpened(pMac, pCommand->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14079 | //Remove this command out of the active list |
| 14080 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 14081 | { |
| 14082 | //Now put this command back on the avilable command list |
| 14083 | csrReleaseCommand(pMac, pCommand); |
| 14084 | } |
| 14085 | smeProcessPendingQueue( pMac ); |
| 14086 | } |
| 14087 | else |
| 14088 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14089 | smsLog(pMac, LOGE, "in %s eWNI_SME_ADD_STA_SELF_RSP Received but NO Add sta session command are ACTIVE ...", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 14090 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14091 | status = eHAL_STATUS_FAILURE; |
| 14092 | break; |
| 14093 | } |
| 14094 | } |
| 14095 | else |
| 14096 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14097 | smsLog(pMac, LOGE, "in %s eWNI_SME_ADD_STA_SELF_RSP Received but NO commands are ACTIVE ...", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 14098 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14099 | status = eHAL_STATUS_FAILURE; |
| 14100 | break; |
| 14101 | } |
| 14102 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14103 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14104 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14105 | eHalStatus csrSendMBAddSelfStaReqMsg(tpAniSirGlobal pMac, |
| 14106 | tAddStaForSessionCmd *pAddStaReq) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14107 | { |
| 14108 | tSirSmeAddStaSelfReq *pMsg; |
| 14109 | tANI_U16 msgLen; |
| 14110 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14111 | do { |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14112 | msgLen = sizeof(tSirSmeAddStaSelfReq); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14113 | pMsg = vos_mem_malloc(msgLen); |
| 14114 | if ( NULL == pMsg ) break; |
| 14115 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14116 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ADD_STA_SELF_REQ); |
| 14117 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14118 | // self station address |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14119 | vos_mem_copy((tANI_U8 *)pMsg->selfMacAddr, |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14120 | (tANI_U8 *)&pAddStaReq->selfMacAddr, sizeof(tSirMacAddr)); |
| 14121 | |
| 14122 | pMsg->currDeviceMode = pAddStaReq->currDeviceMode; |
| 14123 | |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 14124 | smsLog( pMac, LOG1, FL("selfMac="MAC_ADDRESS_STR), |
| 14125 | MAC_ADDR_ARRAY(pMsg->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14126 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14127 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14128 | return( status ); |
| 14129 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14130 | eHalStatus csrIssueAddStaForSessionReq(tpAniSirGlobal pMac, |
| 14131 | tANI_U32 sessionId, |
| 14132 | tSirMacAddr sessionMacAddr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14133 | { |
| 14134 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14135 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14136 | pCommand = csrGetCommandBuffer(pMac); |
| 14137 | if(NULL == pCommand) |
| 14138 | { |
| 14139 | status = eHAL_STATUS_RESOURCES; |
| 14140 | } |
| 14141 | else |
| 14142 | { |
| 14143 | pCommand->command = eSmeCommandAddStaSession; |
| 14144 | pCommand->sessionId = (tANI_U8)sessionId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14145 | vos_mem_copy(pCommand->u.addStaSessionCmd.selfMacAddr, sessionMacAddr, |
| 14146 | sizeof( tSirMacAddr ) ); |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14147 | pCommand->u.addStaSessionCmd.currDeviceMode = pMac->sme.currDeviceMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14148 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 14149 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 14150 | { |
| 14151 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14152 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14153 | } |
| 14154 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14155 | return (status); |
| 14156 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14157 | eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 14158 | { |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14159 | return csrSendMBAddSelfStaReqMsg(pMac, &pCommand->u.addStaSessionCmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14160 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14161 | eHalStatus csrRoamOpenSession(tpAniSirGlobal pMac, |
| 14162 | csrRoamCompleteCallback callback, |
| 14163 | void *pContext, tANI_U8 *pSelfMacAddr, |
| 14164 | tANI_U8 *pbSessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14165 | { |
| 14166 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14167 | tANI_U32 i; |
| 14168 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14169 | *pbSessionId = CSR_SESSION_ID_INVALID; |
| 14170 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 14171 | { |
| 14172 | if( !CSR_IS_SESSION_VALID( pMac, i ) ) |
| 14173 | { |
| 14174 | pSession = CSR_GET_SESSION( pMac, i ); |
| 14175 | status = eHAL_STATUS_SUCCESS; |
| 14176 | pSession->sessionActive = eANI_BOOLEAN_TRUE; |
| 14177 | pSession->sessionId = (tANI_U8)i; |
| 14178 | pSession->callback = callback; |
| 14179 | pSession->pContext = pContext; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14180 | vos_mem_copy(&pSession->selfMacAddr, pSelfMacAddr, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14181 | *pbSessionId = (tANI_U8)i; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14182 | status = vos_timer_init(&pSession->hTimerRoaming, VOS_TIMER_TYPE_SW, |
| 14183 | csrRoamRoamingTimerHandler, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14184 | &pSession->roamingTimerInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14185 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14186 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14187 | smsLog(pMac, LOGE, FL("cannot allocate memory for Roaming timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14188 | break; |
| 14189 | } |
| 14190 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14191 | status = vos_timer_init(&pSession->hTimerJoinRetry, VOS_TIMER_TYPE_SW, |
| 14192 | csrRoamJoinRetryTimerHandler, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14193 | &pSession->joinRetryTimerInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14194 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14195 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14196 | smsLog(pMac, LOGE, FL("cannot allocate memory for joinretry timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14197 | break; |
| 14198 | } |
| 14199 | #endif |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14200 | status = csrIssueAddStaForSessionReq (pMac, i, pSelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14201 | break; |
| 14202 | } |
| 14203 | } |
| 14204 | if( CSR_ROAM_SESSION_MAX == i ) |
| 14205 | { |
| 14206 | //No session is available |
| 14207 | status = eHAL_STATUS_RESOURCES; |
| 14208 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14209 | return ( status ); |
| 14210 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14211 | eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 14212 | { |
| 14213 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14214 | tListElem *pEntry = NULL; |
| 14215 | tSmeCmd *pCommand = NULL; |
| 14216 | tSirSmeDelStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14217 | do |
| 14218 | { |
| 14219 | if(pMsg == NULL) |
| 14220 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14221 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14222 | status = eHAL_STATUS_FAILURE; |
| 14223 | break; |
| 14224 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14225 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 14226 | if(pEntry) |
| 14227 | { |
| 14228 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14229 | if(eSmeCommandDelStaSession == pCommand->command) |
| 14230 | { |
| 14231 | tANI_U8 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14232 | pRsp = (tSirSmeDelStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14233 | smsLog( pMac, LOG1, "Del Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14234 | //This session is done. |
| 14235 | csrCleanupSession(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14236 | if(pCommand->u.delStaSessionCmd.callback) |
| 14237 | { |
| 14238 | |
| 14239 | status = sme_ReleaseGlobalLock( &pMac->sme ); |
| 14240 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 14241 | { |
| 14242 | pCommand->u.delStaSessionCmd.callback( |
| 14243 | pCommand->u.delStaSessionCmd.pContext); |
| 14244 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 14245 | if (! HAL_STATUS_SUCCESS( status ) ) |
| 14246 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14247 | smsLog(pMac, LOGP, "%s: Failed to Acquire Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14248 | return status; |
| 14249 | } |
| 14250 | } |
| 14251 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14252 | smsLog(pMac, LOGE, "%s: Failed to Release Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14253 | } |
| 14254 | } |
| 14255 | |
| 14256 | //Remove this command out of the active list |
| 14257 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 14258 | { |
| 14259 | //Now put this command back on the avilable command list |
| 14260 | csrReleaseCommand(pMac, pCommand); |
| 14261 | } |
| 14262 | smeProcessPendingQueue( pMac ); |
| 14263 | } |
| 14264 | else |
| 14265 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14266 | smsLog(pMac, LOGE, "in %s eWNI_SME_DEL_STA_SELF_RSP Received but NO Del sta session command are ACTIVE ...", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 14267 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14268 | status = eHAL_STATUS_FAILURE; |
| 14269 | break; |
| 14270 | } |
| 14271 | } |
| 14272 | else |
| 14273 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14274 | smsLog(pMac, LOGE, "in %s eWNI_SME_DEL_STA_SELF_RSP Received but NO commands are ACTIVE ...", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 14275 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14276 | status = eHAL_STATUS_FAILURE; |
| 14277 | break; |
| 14278 | } |
| 14279 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14280 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14281 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14282 | eHalStatus csrSendMBDelSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 14283 | { |
| 14284 | tSirSmeDelStaSelfReq *pMsg; |
| 14285 | tANI_U16 msgLen; |
| 14286 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14287 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14288 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 14289 | sizeof( tSirBssType )*/; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14290 | pMsg = vos_mem_malloc(msgLen); |
| 14291 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 14292 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14293 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_STA_SELF_REQ); |
| 14294 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14295 | // self station address |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14296 | vos_mem_copy((tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, |
| 14297 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14298 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14299 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14300 | return( status ); |
| 14301 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14302 | eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 14303 | tSirMacAddr sessionMacAddr, |
| 14304 | csrRoamSessionCloseCallback callback, |
| 14305 | void *pContext) |
| 14306 | { |
| 14307 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14308 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14309 | pCommand = csrGetCommandBuffer(pMac); |
| 14310 | if(NULL == pCommand) |
| 14311 | { |
| 14312 | status = eHAL_STATUS_RESOURCES; |
| 14313 | } |
| 14314 | else |
| 14315 | { |
| 14316 | pCommand->command = eSmeCommandDelStaSession; |
| 14317 | pCommand->sessionId = (tANI_U8)sessionId; |
| 14318 | pCommand->u.delStaSessionCmd.callback = callback; |
| 14319 | pCommand->u.delStaSessionCmd.pContext = pContext; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14320 | vos_mem_copy(pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr, |
| 14321 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14322 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 14323 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 14324 | { |
| 14325 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14326 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14327 | } |
| 14328 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14329 | return (status); |
| 14330 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14331 | eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 14332 | { |
| 14333 | return csrSendMBDelSelfStaReqMsg( pMac, |
| 14334 | pCommand->u.delStaSessionCmd.selfMacAddr ); |
| 14335 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14336 | static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14337 | { |
| 14338 | tDblLinkList *pList = &pMac->roam.roamCmdPendingList; |
| 14339 | tListElem *pEntry, *pNext; |
| 14340 | tSmeCmd *pCommand; |
| 14341 | tDblLinkList localList; |
| 14342 | |
| 14343 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 14344 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 14345 | { |
| 14346 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 14347 | return; |
| 14348 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14349 | csrLLLock(pList); |
| 14350 | pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK); |
| 14351 | while(pEntry != NULL) |
| 14352 | { |
| 14353 | pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK); |
| 14354 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14355 | if(pCommand->sessionId == sessionId) |
| 14356 | { |
| 14357 | if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK)) |
| 14358 | { |
| 14359 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 14360 | } |
| 14361 | } |
| 14362 | pEntry = pNext; |
| 14363 | } |
| 14364 | csrLLUnlock(pList); |
| 14365 | |
| 14366 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 14367 | { |
| 14368 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14369 | csrAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 14370 | } |
| 14371 | csrLLClose(&localList); |
| 14372 | } |
| 14373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14374 | void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14375 | { |
| 14376 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 14377 | { |
| 14378 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14379 | csrRoamStop(pMac, sessionId); |
| 14380 | csrFreeConnectBssDesc(pMac, sessionId); |
| 14381 | csrRoamFreeConnectProfile( pMac, &pSession->connectedProfile ); |
| 14382 | csrRoamFreeConnectedInfo ( pMac, &pSession->connectedInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14383 | vos_timer_destroy(&pSession->hTimerRoaming); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14384 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14385 | vos_timer_destroy(&pSession->hTimerJoinRetry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14386 | #endif |
Madan Mohan Koyyalamudi | 2125599 | 2013-08-01 18:00:25 +0530 | [diff] [blame] | 14387 | purgeSmeSessionCmdList(pMac, sessionId, &pMac->sme.smeCmdPendingList); |
| 14388 | if (pMac->fScanOffload) |
| 14389 | { |
| 14390 | purgeSmeSessionCmdList(pMac, sessionId, |
| 14391 | &pMac->sme.smeScanCmdPendingList); |
| 14392 | } |
| 14393 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14394 | purgeCsrSessionCmdList(pMac, sessionId); |
| 14395 | csrInitSession(pMac, sessionId); |
| 14396 | } |
| 14397 | } |
| 14398 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14399 | eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 14400 | tANI_BOOLEAN fSync, |
| 14401 | csrRoamSessionCloseCallback callback, |
| 14402 | void *pContext ) |
| 14403 | { |
| 14404 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14405 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 14406 | { |
| 14407 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14408 | if(fSync) |
| 14409 | { |
| 14410 | csrCleanupSession(pMac, sessionId); |
| 14411 | } |
| 14412 | else |
| 14413 | { |
Madan Mohan Koyyalamudi | 2125599 | 2013-08-01 18:00:25 +0530 | [diff] [blame] | 14414 | purgeSmeSessionCmdList(pMac, sessionId, |
| 14415 | &pMac->sme.smeCmdPendingList); |
| 14416 | if (pMac->fScanOffload) |
| 14417 | { |
| 14418 | purgeSmeSessionCmdList(pMac, sessionId, |
| 14419 | &pMac->sme.smeScanCmdPendingList); |
| 14420 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14421 | purgeCsrSessionCmdList(pMac, sessionId); |
| 14422 | status = csrIssueDelStaForSessionReq( pMac, sessionId, |
| 14423 | pSession->selfMacAddr, callback, pContext); |
| 14424 | } |
| 14425 | } |
| 14426 | else |
| 14427 | { |
| 14428 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 14429 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14430 | return ( status ); |
| 14431 | } |
| 14432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14433 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 14434 | { |
| 14435 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 14436 | |
| 14437 | if(!pSession) |
| 14438 | { |
| 14439 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 14440 | return; |
| 14441 | } |
| 14442 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14443 | pSession->sessionActive = eANI_BOOLEAN_FALSE; |
| 14444 | pSession->sessionId = CSR_SESSION_ID_INVALID; |
| 14445 | pSession->callback = NULL; |
| 14446 | pSession->pContext = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14447 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 14448 | // TODO : Confirm pMac->roam.fReadyForPowerSave = eANI_BOOLEAN_FALSE; |
| 14449 | csrFreeRoamProfile( pMac, sessionId ); |
| 14450 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 14451 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 14452 | csrFreeConnectBssDesc(pMac, sessionId); |
| 14453 | csrScanEnable(pMac); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14454 | vos_mem_set(&pSession->selfMacAddr, sizeof(tCsrBssid), 0); |
| 14455 | if (pSession->pWpaRsnReqIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14456 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14457 | vos_mem_free(pSession->pWpaRsnReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14458 | pSession->pWpaRsnReqIE = NULL; |
| 14459 | } |
| 14460 | pSession->nWpaRsnReqIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14461 | if (pSession->pWpaRsnRspIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14462 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14463 | vos_mem_free(pSession->pWpaRsnRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14464 | pSession->pWpaRsnRspIE = NULL; |
| 14465 | } |
| 14466 | pSession->nWpaRsnRspIeLength = 0; |
| 14467 | #ifdef FEATURE_WLAN_WAPI |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14468 | if (pSession->pWapiReqIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14469 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14470 | vos_mem_free(pSession->pWapiReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14471 | pSession->pWapiReqIE = NULL; |
| 14472 | } |
| 14473 | pSession->nWapiReqIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14474 | if (pSession->pWapiRspIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14475 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14476 | vos_mem_free(pSession->pWapiRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14477 | pSession->pWapiRspIE = NULL; |
| 14478 | } |
| 14479 | pSession->nWapiRspIeLength = 0; |
| 14480 | #endif /* FEATURE_WLAN_WAPI */ |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 14481 | if (pSession->nAddIEScanLength) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14482 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 14483 | memset(pSession->addIEScan, 0 , SIR_MAC_MAX_IE_LENGTH); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14484 | } |
| 14485 | pSession->nAddIEScanLength = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 14486 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14487 | if (pSession->pAddIEAssoc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14488 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14489 | vos_mem_free(pSession->pAddIEAssoc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14490 | pSession->pAddIEAssoc = NULL; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14491 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14492 | pSession->nAddIEAssocLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14493 | } |
| 14494 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14495 | eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId ) |
| 14496 | { |
| 14497 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14498 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14499 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 14500 | { |
| 14501 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 14502 | { |
| 14503 | if( csrIsMacAddressEqual( pMac, bssid, &pMac->roam.roamSession[i].connectedProfile.bssid ) ) |
| 14504 | { |
| 14505 | //Found it |
| 14506 | status = eHAL_STATUS_SUCCESS; |
| 14507 | *pSessionId = i; |
| 14508 | break; |
| 14509 | } |
| 14510 | } |
| 14511 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14512 | return( status ); |
| 14513 | } |
| 14514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14515 | //This function assumes that we only support one IBSS session. We cannot use BSSID to identify |
| 14516 | //session because for IBSS, the bssid changes. |
| 14517 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ) |
| 14518 | { |
| 14519 | tANI_U32 i, nRet = CSR_SESSION_ID_INVALID; |
| 14520 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14521 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 14522 | { |
| 14523 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 14524 | { |
| 14525 | pSession = CSR_GET_SESSION( pMac, i ); |
| 14526 | if( pSession->pCurRoamProfile && ( csrIsBssTypeIBSS( pSession->connectedProfile.BSSType ) ) ) |
| 14527 | { |
| 14528 | //Found it |
| 14529 | nRet = i; |
| 14530 | break; |
| 14531 | } |
| 14532 | } |
| 14533 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14534 | return (nRet); |
| 14535 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14536 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid) |
| 14537 | { |
| 14538 | /* Update the current BSS info in ho control block based on connected |
| 14539 | profile info from pmac global structure */ |
| 14540 | |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 14541 | smsLog(pMac, LOGW, " csrRoamLinkUp: WLAN link UP with AP= "MAC_ADDRESS_STR, |
| 14542 | MAC_ADDR_ARRAY(bssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14543 | /* Check for user misconfig of RSSI trigger threshold */ |
| 14544 | pMac->roam.configParam.vccRssiThreshold = |
| 14545 | ( 0 == pMac->roam.configParam.vccRssiThreshold ) ? |
| 14546 | CSR_VCC_RSSI_THRESHOLD : pMac->roam.configParam.vccRssiThreshold; |
| 14547 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14548 | /* Check for user misconfig of UL MAC Loss trigger threshold */ |
| 14549 | pMac->roam.configParam.vccUlMacLossThreshold = |
| 14550 | ( 0 == pMac->roam.configParam.vccUlMacLossThreshold ) ? |
| 14551 | CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14552 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 14553 | { |
| 14554 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14555 | /* Indicate the neighbor roal algorithm about the connect indication */ |
| 14556 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId); |
| 14557 | csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS); |
| 14558 | } |
| 14559 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14560 | } |
| 14561 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14562 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14563 | { |
| 14564 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 14565 | |
| 14566 | if(!pSession) |
| 14567 | { |
| 14568 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 14569 | return; |
| 14570 | } |
| 14571 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14572 | //Only to handle the case for Handover on infra link |
| 14573 | if( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 14574 | { |
| 14575 | return; |
| 14576 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14577 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 14578 | csrRoamDeregStatisticsReq(pMac); |
| 14579 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 14580 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 14581 | /* Indicate the neighbor roal algorithm about the disconnect indication */ |
| 14582 | csrNeighborRoamIndicateDisconnect(pMac, sessionId); |
| 14583 | #endif |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 14584 | |
| 14585 | //Remove this code once SLM_Sessionization is supported |
| 14586 | //BMPS_WORKAROUND_NOT_NEEDED |
| 14587 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 14588 | csrIsInfraApStarted( pMac ) && |
| 14589 | pMac->roam.configParam.doBMPSWorkaround) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14590 | { |
| 14591 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 14592 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14593 | } |
| 14594 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14595 | void csrRoamTlStatsTimerHandler(void *pv) |
| 14596 | { |
| 14597 | tpAniSirGlobal pMac = PMAC_STRUCT( pv ); |
| 14598 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14599 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 14600 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14601 | smsLog(pMac, LOG1, FL(" TL stat timer is no-op. It needs to support multiple stations")); |
| 14602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14603 | #if 0 |
| 14604 | // TODO Persession .??? |
| 14605 | //req TL for stats |
| 14606 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId)) |
| 14607 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14608 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:couldn't get the stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14609 | } |
| 14610 | else |
| 14611 | { |
| 14612 | //save in SME |
| 14613 | csrRoamSaveStatsFromTl(pMac, tlStats); |
| 14614 | } |
| 14615 | #endif |
| 14616 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 14617 | { |
| 14618 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 14619 | { |
| 14620 | //start timer |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14621 | status = vos_timer_start(&pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 14622 | pMac->roam.tlStatsReqInfo.periodicity); |
| 14623 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14624 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14625 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14626 | return; |
| 14627 | } |
| 14628 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 14629 | } |
| 14630 | } |
| 14631 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14632 | void csrRoamPeStatsTimerHandler(void *pv) |
| 14633 | { |
| 14634 | tCsrPeStatsReqInfo *pPeStatsReqListEntry = (tCsrPeStatsReqInfo *)pv; |
| 14635 | eHalStatus status; |
| 14636 | tpAniSirGlobal pMac = pPeStatsReqListEntry->pMac; |
| 14637 | VOS_STATUS vosStatus; |
| 14638 | tPmcPowerState powerState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14639 | pPeStatsReqListEntry->timerRunning = FALSE; |
| 14640 | if( pPeStatsReqListEntry->timerStopFailed == TRUE ) |
| 14641 | { |
| 14642 | // If we entered here, meaning the timer could not be successfully |
| 14643 | // stopped in csrRoamRemoveEntryFromPeStatsReqList(). So do it here. |
| 14644 | |
| 14645 | /* Destroy the timer */ |
| 14646 | vosStatus = vos_timer_destroy( &pPeStatsReqListEntry->hPeStatsTimer ); |
| 14647 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14648 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14649 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14650 | } |
| 14651 | |
| 14652 | // Free the entry |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14653 | vos_mem_free(pPeStatsReqListEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14654 | pPeStatsReqListEntry = NULL; |
| 14655 | } |
| 14656 | else |
| 14657 | { |
| 14658 | if(!pPeStatsReqListEntry->rspPending) |
| 14659 | { |
| 14660 | status = csrSendMBStatsReqMsg(pMac, pPeStatsReqListEntry->statsMask & ~(1 << eCsrGlobalClassDStats), |
| 14661 | pPeStatsReqListEntry->staId); |
| 14662 | if(!HAL_STATUS_SUCCESS(status)) |
| 14663 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14664 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to send down stats req to PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14665 | } |
| 14666 | else |
| 14667 | { |
| 14668 | pPeStatsReqListEntry->rspPending = TRUE; |
| 14669 | } |
| 14670 | } |
| 14671 | |
| 14672 | //send down a req |
| 14673 | if(pPeStatsReqListEntry->periodicity && |
| 14674 | (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pPeStatsReqListEntry->hPeStatsTimer))) |
| 14675 | { |
| 14676 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 14677 | if(ePMC_FULL_POWER == powerState) |
| 14678 | { |
| 14679 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 14680 | { |
| 14681 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 14682 | } |
| 14683 | } |
| 14684 | else |
| 14685 | { |
| 14686 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 14687 | { |
| 14688 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 14689 | } |
| 14690 | } |
| 14691 | //start timer |
| 14692 | vosStatus = vos_timer_start( &pPeStatsReqListEntry->hPeStatsTimer, pPeStatsReqListEntry->periodicity ); |
| 14693 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14694 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14695 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14696 | return; |
| 14697 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14698 | pPeStatsReqListEntry->timerRunning = TRUE; |
| 14699 | |
| 14700 | } |
| 14701 | |
| 14702 | } |
| 14703 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14704 | void csrRoamStatsClientTimerHandler(void *pv) |
| 14705 | { |
| 14706 | tCsrStatsClientReqInfo *pStaEntry = (tCsrStatsClientReqInfo *)pv; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14707 | if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pStaEntry->timer)) |
| 14708 | { |
| 14709 | #if 0 |
| 14710 | // TODO Stats fix for multisession |
| 14711 | //start the timer |
| 14712 | vosStatus = vos_timer_start( &pStaEntry->timer, pStaEntry->periodicity ); |
| 14713 | |
| 14714 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14715 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14716 | smsLog(pStaEntry->pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14717 | } |
| 14718 | #endif |
| 14719 | } |
| 14720 | #if 0 |
| 14721 | //send up the stats report |
| 14722 | csrRoamReportStatistics(pStaEntry->pMac, pStaEntry->statsMask, pStaEntry->callback, |
| 14723 | pStaEntry->staId, pStaEntry->pContext); |
| 14724 | #endif |
| 14725 | } |
| 14726 | |
| 14727 | |
| 14728 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14729 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId) |
| 14730 | { |
| 14731 | tAniGetPEStatsReq *pMsg; |
| 14732 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14733 | pMsg = vos_mem_malloc(sizeof(tAniGetPEStatsReq)); |
| 14734 | if ( NULL == pMsg ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14735 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 14736 | smsLog(pMac, LOGE, FL( "Failed to allocate mem for stats req ")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14737 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14738 | } |
| 14739 | // need to initiate a stats request to PE |
| 14740 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_STATISTICS_REQ); |
| 14741 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq); |
| 14742 | pMsg->staId = staId; |
| 14743 | pMsg->statsMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14744 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14745 | if(!HAL_STATUS_SUCCESS(status)) |
| 14746 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 14747 | smsLog(pMac, LOG1, FL("Failed to send down the stats req ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14748 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14749 | return status; |
| 14750 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14751 | void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg) |
| 14752 | { |
| 14753 | tAniGetPEStatsRsp *pSmeStatsRsp; |
| 14754 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14755 | tListElem *pEntry = NULL; |
| 14756 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 14757 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 14758 | tANI_U32 tempMask = 0; |
| 14759 | tANI_U8 counter = 0; |
| 14760 | tANI_U8 *pStats = NULL; |
| 14761 | tANI_U32 length = 0; |
| 14762 | v_PVOID_t pvosGCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14763 | v_S7_t rssi = 0, snr = 0; |
| 14764 | tANI_U32 *pRssi = NULL, *pSnr = NULL; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14765 | tANI_U32 linkCapacity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14766 | pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg; |
| 14767 | if(pSmeStatsRsp->rc) |
| 14768 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14769 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:stats rsp from PE shows failure")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14770 | goto post_update; |
| 14771 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14772 | tempMask = pSmeStatsRsp->statsMask; |
| 14773 | pStats = ((tANI_U8 *)&pSmeStatsRsp->statsMask) + sizeof(pSmeStatsRsp->statsMask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14774 | /* subtract all statistics from this length, and after processing the entire |
| 14775 | * 'stat' part of the message, if the length is not zero, then rssi is piggy packed |
| 14776 | * in this 'stats' message. |
| 14777 | */ |
| 14778 | length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14779 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 14780 | while(tempMask) |
| 14781 | { |
| 14782 | if(tempMask & 1) |
| 14783 | { |
| 14784 | switch(counter) |
| 14785 | { |
| 14786 | case eCsrSummaryStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14787 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:summary stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14788 | vos_mem_copy((tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 14789 | pStats, sizeof(tCsrSummaryStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14790 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 14791 | length -= sizeof(tCsrSummaryStatsInfo); |
| 14792 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14793 | case eCsrGlobalClassAStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14794 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassA stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14795 | vos_mem_copy((tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 14796 | pStats, sizeof(tCsrGlobalClassAStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14797 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
| 14798 | length -= sizeof(tCsrGlobalClassAStatsInfo); |
| 14799 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14800 | case eCsrGlobalClassBStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14801 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassB stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14802 | vos_mem_copy((tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 14803 | pStats, sizeof(tCsrGlobalClassBStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14804 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
| 14805 | length -= sizeof(tCsrGlobalClassBStatsInfo); |
| 14806 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14807 | case eCsrGlobalClassCStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14808 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassC stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14809 | vos_mem_copy((tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 14810 | pStats, sizeof(tCsrGlobalClassCStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14811 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
| 14812 | length -= sizeof(tCsrGlobalClassCStatsInfo); |
| 14813 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14814 | case eCsrPerStaStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14815 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14816 | if( CSR_MAX_STA > pSmeStatsRsp->staId ) |
| 14817 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14818 | vos_mem_copy((tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId], |
| 14819 | pStats, sizeof(tCsrPerStaStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14820 | } |
| 14821 | else |
| 14822 | { |
| 14823 | status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14824 | smsLog( pMac, LOGE, FL("csrRoamStatsRspProcessor:out bound staId:%d"), pSmeStatsRsp->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14825 | VOS_ASSERT( 0 ); |
| 14826 | } |
| 14827 | if(!HAL_STATUS_SUCCESS(status)) |
| 14828 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14829 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14830 | } |
| 14831 | pStats += sizeof(tCsrPerStaStatsInfo); |
| 14832 | length -= sizeof(tCsrPerStaStatsInfo); |
| 14833 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14834 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14835 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14836 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14837 | } |
| 14838 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14839 | tempMask >>=1; |
| 14840 | counter++; |
| 14841 | } |
| 14842 | pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 14843 | if (length != 0) |
| 14844 | { |
| 14845 | pRssi = (tANI_U32*)pStats; |
| 14846 | rssi = (v_S7_t)*pRssi; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14847 | pStats += sizeof(tANI_U32); |
| 14848 | length -= sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14849 | } |
| 14850 | else |
| 14851 | { |
| 14852 | /* If riva is not sending rssi, continue to use the hack */ |
| 14853 | rssi = RSSI_HACK_BMPS; |
| 14854 | } |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14856 | WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14857 | |
| 14858 | if (length != 0) |
| 14859 | { |
| 14860 | linkCapacity = *(tANI_U32*)pStats; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14861 | pStats += sizeof(tANI_U32); |
| 14862 | length -= sizeof(tANI_U32); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14863 | } |
| 14864 | else |
| 14865 | { |
| 14866 | linkCapacity = 0; |
| 14867 | } |
| 14868 | |
| 14869 | WDA_UpdateLinkCapacity(pvosGCtx, pSmeStatsRsp->staId, linkCapacity); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14870 | |
| 14871 | if (length != 0) |
| 14872 | { |
| 14873 | pSnr = (tANI_U32*)pStats; |
| 14874 | snr = (v_S7_t)*pSnr; |
| 14875 | } |
| 14876 | else |
| 14877 | { |
| 14878 | snr = SNR_HACK_BMPS; |
| 14879 | } |
| 14880 | |
| 14881 | WDA_UpdateSnrBmps(pvosGCtx, pSmeStatsRsp->staId, snr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14882 | post_update: |
| 14883 | //make sure to update the pe stats req list |
| 14884 | pEntry = csrRoamFindInPeStatsReqList(pMac, pSmeStatsRsp->statsMask); |
| 14885 | if(pEntry) |
| 14886 | { |
| 14887 | pPeStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
| 14888 | pPeStaEntry->rspPending = FALSE; |
| 14889 | |
| 14890 | } |
| 14891 | //check the one timer cases |
| 14892 | pEntry = csrRoamCheckClientReqList(pMac, pSmeStatsRsp->statsMask); |
| 14893 | if(pEntry) |
| 14894 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14895 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14896 | if(pTempStaEntry->timerExpired) |
| 14897 | { |
| 14898 | //send up the stats report |
| 14899 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 14900 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 14901 | //also remove from the client list |
| 14902 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 14903 | pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14904 | } |
| 14905 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14906 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14907 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 14908 | { |
| 14909 | tListElem *pEntry = NULL; |
| 14910 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14911 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14912 | if(!pEntry) |
| 14913 | { |
| 14914 | //list empty |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14915 | smsLog(pMac, LOG2, "csrRoamFindInPeStatsReqList: List empty, no request to PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14916 | return NULL; |
| 14917 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14918 | while( pEntry ) |
| 14919 | { |
| 14920 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14921 | if(pTempStaEntry->statsMask == statsMask) |
| 14922 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14923 | smsLog(pMac, LOG3, "csrRoamFindInPeStatsReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14924 | break; |
| 14925 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14926 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14927 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14928 | return pEntry; |
| 14929 | } |
| 14930 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14931 | tListElem * csrRoamChecknUpdateClientReqList(tpAniSirGlobal pMac, tCsrStatsClientReqInfo *pStaEntry, |
| 14932 | tANI_BOOLEAN update) |
| 14933 | { |
| 14934 | tListElem *pEntry; |
| 14935 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14936 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14937 | if(!pEntry) |
| 14938 | { |
| 14939 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14940 | smsLog(pMac, LOG2, "csrRoamChecknUpdateClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14941 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14942 | return NULL; |
| 14943 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14944 | while( pEntry ) |
| 14945 | { |
| 14946 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14947 | if((pTempStaEntry->requesterId == pStaEntry->requesterId) && |
| 14948 | (pTempStaEntry->statsMask == pStaEntry->statsMask)) |
| 14949 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14950 | smsLog(pMac, LOG3, "csrRoamChecknUpdateClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14951 | if(update) |
| 14952 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14953 | pTempStaEntry->periodicity = pStaEntry->periodicity; |
| 14954 | pTempStaEntry->callback = pStaEntry->callback; |
| 14955 | pTempStaEntry->pContext = pStaEntry->pContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14956 | } |
| 14957 | break; |
| 14958 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14959 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14960 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14961 | return pEntry; |
| 14962 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14963 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 14964 | { |
| 14965 | tListElem *pEntry; |
| 14966 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14967 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14968 | if(!pEntry) |
| 14969 | { |
| 14970 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14971 | smsLog(pMac, LOG2, "csrRoamCheckClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14972 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14973 | return NULL; |
| 14974 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14975 | while( pEntry ) |
| 14976 | { |
| 14977 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14978 | if((pTempStaEntry->statsMask & ~(1 << eCsrGlobalClassDStats)) == statsMask) |
| 14979 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14980 | smsLog(pMac, LOG3, "csrRoamCheckClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14981 | break; |
| 14982 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14983 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14984 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14985 | return pEntry; |
| 14986 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14987 | eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac, |
| 14988 | csrRoamLinkQualityIndCallback callback, |
| 14989 | void *pContext) |
| 14990 | { |
| 14991 | pMac->roam.linkQualityIndInfo.callback = callback; |
| 14992 | pMac->roam.linkQualityIndInfo.context = pContext; |
| 14993 | if( NULL == callback ) |
| 14994 | { |
| 14995 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being deregistered"); |
| 14996 | } |
| 14997 | else |
| 14998 | { |
| 14999 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being registered"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15000 | /* do we need to invoke the callback to notify client of initial value ?? */ |
| 15001 | } |
| 15002 | return eHAL_STATUS_SUCCESS; |
| 15003 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15004 | void csrRoamVccTrigger(tpAniSirGlobal pMac) |
| 15005 | { |
| 15006 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 15007 | tANI_U32 ul_mac_loss = 0; |
| 15008 | tANI_U32 ul_mac_loss_trigger_threshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15009 | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 15010 | /*------------------------------------------------------------------------- |
| 15011 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15012 | Check for a change in link quality and notify client if necessary |
| 15013 | -------------------------------------------------------------------------*/ |
| 15014 | ul_mac_loss_trigger_threshold = |
| 15015 | pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15016 | VOS_ASSERT( ul_mac_loss_trigger_threshold != 0 ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15017 | smsLog(pMac, LOGW, "csrRoamVccTrigger: UL_MAC_LOSS_THRESHOLD is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15018 | ul_mac_loss_trigger_threshold ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15019 | if(ul_mac_loss_trigger_threshold < ul_mac_loss) |
| 15020 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15021 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is POOR "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15022 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 15023 | } |
| 15024 | else |
| 15025 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15026 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is GOOD"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15027 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 15028 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15029 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link qual : *** UL_MAC_LOSS %d *** ", |
| 15030 | ul_mac_loss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15031 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 15032 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15033 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15034 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 15035 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15036 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15037 | newVccLinkQuality ); |
| 15038 | |
| 15039 | /* we now invoke the callback once to notify client of initial value */ |
| 15040 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 15041 | pMac->roam.linkQualityIndInfo.context ); |
| 15042 | //event: EVENT_WLAN_VCC |
| 15043 | } |
| 15044 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15045 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
| 15046 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15047 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15048 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 15049 | v_U8_t rssiNotification, |
| 15050 | void * context) |
| 15051 | { |
| 15052 | tpAniSirGlobal pMac = PMAC_STRUCT( context ); |
| 15053 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 15054 | // TODO : Session info unavailable |
| 15055 | tANI_U32 sessionId = 0; |
| 15056 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 15057 | /*------------------------------------------------------------------------- |
| 15058 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15059 | Check for a change in link quality and notify client if necessary |
| 15060 | -------------------------------------------------------------------------*/ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15061 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: RSSI trigger threshold is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15062 | pMac->roam.configParam.vccRssiThreshold); |
| 15063 | if(!csrIsConnStateConnectedInfra(pMac, sessionId)) |
| 15064 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15065 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: ignoring the indication as we are not connected"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15066 | return VOS_STATUS_SUCCESS; |
| 15067 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15068 | if(WLANTL_HO_THRESHOLD_DOWN == rssiNotification) |
| 15069 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15070 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is POOR"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15071 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 15072 | } |
| 15073 | else if(WLANTL_HO_THRESHOLD_UP == rssiNotification) |
| 15074 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15075 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is GOOD "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15076 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 15077 | } |
| 15078 | else |
| 15079 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15080 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: unknown rssi notification %d", rssiNotification); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15081 | //Set to this so the code below won't do anything |
| 15082 | newVccLinkQuality = pMac->roam.vccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15083 | VOS_ASSERT(0); |
| 15084 | } |
| 15085 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15086 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 15087 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15088 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15089 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 15090 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15091 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15092 | newVccLinkQuality); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15093 | /* we now invoke the callback once to notify client of initial value */ |
| 15094 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 15095 | pMac->roam.linkQualityIndInfo.context ); |
| 15096 | //event: EVENT_WLAN_VCC |
| 15097 | } |
| 15098 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15099 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15100 | return status; |
| 15101 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15102 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 15103 | tDblLinkList *pStaList, |
| 15104 | tCsrStatsClientReqInfo *pStaEntry) |
| 15105 | { |
| 15106 | tCsrStatsClientReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15107 | //if same entity requested for same set of stats with different periodicity & |
| 15108 | // callback update it |
| 15109 | if(NULL == csrRoamChecknUpdateClientReqList(pMac, pStaEntry, TRUE)) |
| 15110 | { |
| 15111 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15112 | pNewStaEntry = vos_mem_malloc(sizeof(tCsrStatsClientReqInfo)); |
| 15113 | if (NULL == pNewStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15114 | { |
| 15115 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15116 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15117 | return NULL; |
| 15118 | } |
| 15119 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15120 | pNewStaEntry->callback = pStaEntry->callback; |
| 15121 | pNewStaEntry->pContext = pStaEntry->pContext; |
| 15122 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 15123 | pNewStaEntry->requesterId = pStaEntry->requesterId; |
| 15124 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 15125 | pNewStaEntry->pPeStaEntry = pStaEntry->pPeStaEntry; |
| 15126 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 15127 | pNewStaEntry->staId = pStaEntry->staId; |
| 15128 | pNewStaEntry->timerExpired = pStaEntry->timerExpired; |
| 15129 | |
| 15130 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
| 15131 | } |
| 15132 | return pNewStaEntry; |
| 15133 | } |
| 15134 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15135 | tCsrPeStatsReqInfo * csrRoamInsertEntryIntoPeStatsReqList( tpAniSirGlobal pMac, |
| 15136 | tDblLinkList *pStaList, |
| 15137 | tCsrPeStatsReqInfo *pStaEntry) |
| 15138 | { |
| 15139 | tCsrPeStatsReqInfo *pNewStaEntry = NULL; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15140 | pNewStaEntry = vos_mem_malloc(sizeof(tCsrPeStatsReqInfo)); |
| 15141 | if (NULL == pNewStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15142 | { |
| 15143 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoPeStatsReqList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15144 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15145 | return NULL; |
| 15146 | } |
| 15147 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15148 | pNewStaEntry->hPeStatsTimer = pStaEntry->hPeStatsTimer; |
| 15149 | pNewStaEntry->numClient = pStaEntry->numClient; |
| 15150 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 15151 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 15152 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 15153 | pNewStaEntry->staId = pStaEntry->staId; |
| 15154 | pNewStaEntry->timerRunning = pStaEntry->timerRunning; |
| 15155 | pNewStaEntry->rspPending = pStaEntry->rspPending; |
| 15156 | |
| 15157 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15158 | return pNewStaEntry; |
| 15159 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15160 | eHalStatus csrGetRssi(tpAniSirGlobal pMac, |
| 15161 | tCsrRssiCallback callback, |
| 15162 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 15163 | { |
| 15164 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15165 | vos_msg_t msg; |
| 15166 | tANI_U32 sessionId; |
| 15167 | |
| 15168 | tAniGetRssiReq *pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15169 | smsLog(pMac, LOG2, FL("called")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15170 | pMsg = vos_mem_malloc(sizeof(tAniGetRssiReq)); |
| 15171 | if ( NULL == pMsg ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15172 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15173 | smsLog(pMac, LOGE, " csrGetRssi: failed to allocate mem for req "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15174 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15175 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15176 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 15177 | |
| 15178 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_RSSI_REQ); |
| 15179 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 15180 | pMsg->sessionId = sessionId; |
| 15181 | pMsg->staId = staId; |
| 15182 | pMsg->rssiCallback = callback; |
| 15183 | pMsg->pDevContext = pContext; |
| 15184 | pMsg->pVosContext = pVosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15185 | msg.type = eWNI_SME_GET_RSSI_REQ; |
| 15186 | msg.bodyptr = pMsg; |
| 15187 | msg.reserved = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15188 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 15189 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15190 | smsLog(pMac, LOGE, " csrGetRssi failed to post msg to self "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15191 | vos_mem_free((void *)pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15192 | status = eHAL_STATUS_FAILURE; |
| 15193 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15194 | smsLog(pMac, LOG2, FL("returned")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15195 | return status; |
| 15196 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15197 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15198 | eHalStatus csrGetSnr(tpAniSirGlobal pMac, |
| 15199 | tCsrSnrCallback callback, |
| 15200 | tANI_U8 staId, tCsrBssid bssId, |
| 15201 | void *pContext) |
| 15202 | { |
| 15203 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15204 | vos_msg_t msg; |
| 15205 | tANI_U32 sessionId; |
| 15206 | |
| 15207 | tAniGetSnrReq *pMsg; |
| 15208 | |
| 15209 | smsLog(pMac, LOG2, FL("called")); |
| 15210 | |
| 15211 | pMsg =(tAniGetSnrReq *)vos_mem_malloc(sizeof(tAniGetSnrReq)); |
| 15212 | if (NULL == pMsg ) |
| 15213 | { |
| 15214 | smsLog(pMac, LOGE, "%s: failed to allocate mem for req",__func__); |
| 15215 | return status; |
| 15216 | } |
| 15217 | |
| 15218 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 15219 | |
| 15220 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_SNR_REQ); |
| 15221 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetSnrReq); |
| 15222 | pMsg->sessionId = sessionId; |
| 15223 | pMsg->staId = staId; |
| 15224 | pMsg->snrCallback = callback; |
| 15225 | pMsg->pDevContext = pContext; |
| 15226 | msg.type = eWNI_SME_GET_SNR_REQ; |
| 15227 | msg.bodyptr = pMsg; |
| 15228 | msg.reserved = 0; |
| 15229 | |
| 15230 | if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 15231 | { |
| 15232 | smsLog(pMac, LOGE, "%s failed to post msg to self", __func__); |
| 15233 | vos_mem_free((v_VOID_t *)pMsg); |
| 15234 | status = eHAL_STATUS_FAILURE; |
| 15235 | } |
| 15236 | |
| 15237 | smsLog(pMac, LOG2, FL("returned")); |
| 15238 | return status; |
| 15239 | } |
| 15240 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 15241 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15242 | eHalStatus csrGetRoamRssi(tpAniSirGlobal pMac, |
| 15243 | tCsrRssiCallback callback, |
| 15244 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 15245 | { |
| 15246 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15247 | tAniGetRssiReq *pMsg; |
| 15248 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15249 | pMsg = vos_mem_malloc(sizeof(tAniGetRssiReq)); |
| 15250 | if ( NULL == pMsg ) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15251 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 15252 | smsLog(pMac, LOGE, FL("Failed to allocate mem for req")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15253 | return eHAL_STATUS_FAILURE; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15254 | } |
| 15255 | // need to initiate a stats request to PE |
| 15256 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_ROAM_RSSI_REQ); |
| 15257 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 15258 | pMsg->staId = staId; |
| 15259 | pMsg->rssiCallback = callback; |
| 15260 | pMsg->pDevContext = pContext; |
| 15261 | pMsg->pVosContext = pVosContext; |
| 15262 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 15263 | if(!HAL_STATUS_SUCCESS(status)) |
| 15264 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 15265 | smsLog(pMac, LOGE, FL(" Failed to send down get rssi req")); |
Tushnim Bhattacharyya | 41f7286 | 2013-04-03 21:34:01 -0700 | [diff] [blame] | 15266 | //pMsg is freed by palSendMBMessage |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15267 | status = eHAL_STATUS_FAILURE; |
| 15268 | } |
| 15269 | return status; |
| 15270 | } |
| 15271 | #endif |
| 15272 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15273 | |
| 15274 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 15275 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15276 | eHalStatus csrGetTsmStats(tpAniSirGlobal pMac, |
| 15277 | tCsrTsmStatsCallback callback, |
| 15278 | tANI_U8 staId, |
| 15279 | tCsrBssid bssId, |
| 15280 | void *pContext, |
| 15281 | void* pVosContext, |
| 15282 | tANI_U8 tid) |
| 15283 | { |
| 15284 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15285 | tAniGetTsmStatsReq *pMsg = NULL; |
| 15286 | |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 15287 | pMsg = (tAniGetTsmStatsReq*)vos_mem_malloc(sizeof(tAniGetTsmStatsReq)); |
| 15288 | if (NULL == pMsg) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15289 | { |
| 15290 | smsLog(pMac, LOGE, "csrGetTsmStats: failed to allocate mem for req"); |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 15291 | return eHAL_STATUS_FAILED_ALLOC; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15292 | } |
| 15293 | // need to initiate a stats request to PE |
| 15294 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_TSM_STATS_REQ); |
| 15295 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetTsmStatsReq); |
| 15296 | pMsg->staId = staId; |
| 15297 | pMsg->tid = tid; |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 15298 | vos_mem_copy(pMsg->bssId, bssId, sizeof(tSirMacAddr)); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15299 | pMsg->tsmStatsCallback = callback; |
| 15300 | pMsg->pDevContext = pContext; |
| 15301 | pMsg->pVosContext = pVosContext; |
| 15302 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 15303 | if(!HAL_STATUS_SUCCESS(status)) |
| 15304 | { |
| 15305 | smsLog(pMac, LOG1, " csrGetTsmStats: failed to send down the rssi req"); |
| 15306 | //pMsg is freed by palSendMBMessage |
| 15307 | status = eHAL_STATUS_FAILURE; |
| 15308 | } |
| 15309 | return status; |
| 15310 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 15311 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15312 | |
| 15313 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 15314 | /* --------------------------------------------------------------------------- |
| 15315 | \fn csrGetTLSTAState |
| 15316 | \helper function to get teh TL STA State whenever the function is called. |
| 15317 | |
| 15318 | \param staId - The staID to be passed to the TL |
| 15319 | to get the relevant TL STA State |
| 15320 | \return the state as tANI_U16 |
| 15321 | ---------------------------------------------------------------------------*/ |
| 15322 | tANI_U16 csrGetTLSTAState(tpAniSirGlobal pMac, tANI_U8 staId) |
| 15323 | { |
| 15324 | WLANTL_STAStateType tlSTAState; |
| 15325 | tlSTAState = WLANTL_STA_INIT; |
| 15326 | |
| 15327 | //request TL for STA State |
| 15328 | if ( !VOS_IS_STATUS_SUCCESS(WLANTL_GetSTAState(pMac->roam.gVosContext, staId, &tlSTAState)) ) |
| 15329 | { |
| 15330 | smsLog(pMac, LOGE, FL("csrGetTLSTAState:couldn't get the STA state from TL")); |
| 15331 | } |
| 15332 | |
| 15333 | return tlSTAState; |
| 15334 | } |
| 15335 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15336 | eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, |
| 15337 | tANI_U32 statsMask, |
| 15338 | tCsrStatsCallback callback, |
| 15339 | tANI_U32 periodicity, tANI_BOOLEAN cache, |
| 15340 | tANI_U8 staId, void *pContext) |
| 15341 | { |
| 15342 | tCsrStatsClientReqInfo staEntry; |
| 15343 | tCsrStatsClientReqInfo *pStaEntry = NULL; |
| 15344 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 15345 | tListElem *pEntry = NULL; |
| 15346 | tANI_BOOLEAN found = FALSE; |
| 15347 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15348 | tANI_BOOLEAN insertInClientList = FALSE; |
| 15349 | VOS_STATUS vosStatus; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15350 | WLANTL_TRANSFER_STA_TYPE *pTlStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15351 | |
| 15352 | if( csrIsAllSessionDisconnected(pMac) ) |
| 15353 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15354 | //smsLog(pMac, LOGW, "csrGetStatistics: wrong state curState(%d) not connected", pMac->roam.curState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15355 | return eHAL_STATUS_FAILURE; |
| 15356 | } |
Hanumantha Reddy Pothula | 449aadf | 2014-02-07 13:53:35 +0530 | [diff] [blame] | 15357 | |
| 15358 | if (csrNeighborMiddleOfRoaming((tHalHandle)pMac)) |
| 15359 | { |
| 15360 | smsLog(pMac, LOG1, FL("in the middle of roaming states")); |
| 15361 | return eHAL_STATUS_FAILURE; |
| 15362 | } |
| 15363 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15364 | if((!statsMask) && (!callback)) |
| 15365 | { |
| 15366 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15367 | smsLog(pMac, LOGW, "csrGetStatistics: statsMask & callback empty in the request"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15368 | return eHAL_STATUS_FAILURE; |
| 15369 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15370 | //for the search list method for deregister |
| 15371 | staEntry.requesterId = requesterId; |
| 15372 | staEntry.statsMask = statsMask; |
| 15373 | //requester wants to deregister or just an error |
| 15374 | if((statsMask) && (!callback)) |
| 15375 | { |
| 15376 | pEntry = csrRoamChecknUpdateClientReqList(pMac, &staEntry, FALSE); |
| 15377 | if(!pEntry) |
| 15378 | { |
| 15379 | //msg |
| 15380 | smsLog(pMac, LOGW, "csrGetStatistics: callback is empty in the request & couldn't " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15381 | "find any existing request in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15382 | return eHAL_STATUS_FAILURE; |
| 15383 | } |
| 15384 | else |
| 15385 | { |
| 15386 | //clean up & return |
| 15387 | pStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 15388 | if(NULL != pStaEntry->pPeStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15389 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15390 | pStaEntry->pPeStaEntry->numClient--; |
| 15391 | //check if we need to delete the entry from peStatsReqList too |
| 15392 | if(!pStaEntry->pPeStaEntry->numClient) |
| 15393 | { |
| 15394 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pStaEntry->pPeStaEntry); |
| 15395 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15396 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 15397 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15398 | //check if we need to stop the tl stats timer too |
| 15399 | pMac->roam.tlStatsReqInfo.numClient--; |
| 15400 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 15401 | { |
| 15402 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 15403 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15404 | status = vos_timer_stop(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 15405 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15406 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15407 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15408 | return eHAL_STATUS_FAILURE; |
| 15409 | } |
| 15410 | } |
| 15411 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 15412 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 15413 | } |
| 15414 | vos_timer_stop( &pStaEntry->timer ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15415 | // Destroy the vos timer... |
| 15416 | vosStatus = vos_timer_destroy( &pStaEntry->timer ); |
| 15417 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15418 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15419 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15420 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15421 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 15422 | pStaEntry = NULL; |
| 15423 | return eHAL_STATUS_SUCCESS; |
| 15424 | } |
| 15425 | } |
| 15426 | |
| 15427 | if(cache && !periodicity) |
| 15428 | { |
| 15429 | //return the cached stats |
| 15430 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 15431 | } |
| 15432 | else |
| 15433 | { |
| 15434 | //add the request in the client req list |
| 15435 | staEntry.callback = callback; |
| 15436 | staEntry.pContext = pContext; |
| 15437 | staEntry.periodicity = periodicity; |
| 15438 | staEntry.pPeStaEntry = NULL; |
| 15439 | staEntry.staId = staId; |
| 15440 | staEntry.pMac = pMac; |
| 15441 | staEntry.timerExpired = FALSE; |
| 15442 | |
| 15443 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15444 | //if periodic report requested with non cached result from PE/TL |
| 15445 | if(periodicity) |
| 15446 | { |
| 15447 | |
| 15448 | //if looking for stats from PE |
| 15449 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 15450 | { |
| 15451 | |
| 15452 | //check if same request made already & waiting for rsp |
| 15453 | pPeStaEntry = csrRoamCheckPeStatsReqList(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), |
| 15454 | periodicity, &found, staId); |
| 15455 | if(!pPeStaEntry) |
| 15456 | { |
| 15457 | //bail out, maxed out on number of req for PE |
| 15458 | return eHAL_STATUS_FAILURE; |
| 15459 | } |
| 15460 | else |
| 15461 | { |
| 15462 | staEntry.pPeStaEntry = pPeStaEntry; |
| 15463 | } |
| 15464 | |
| 15465 | } |
| 15466 | //request stats from TL rightaway if requested by client, update tlStatsReqInfo if needed |
| 15467 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 15468 | { |
| 15469 | if(cache && pMac->roam.tlStatsReqInfo.numClient) |
| 15470 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15471 | smsLog(pMac, LOGE, FL("csrGetStatistics:Looking for cached stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15472 | } |
| 15473 | else |
| 15474 | { |
| 15475 | |
| 15476 | //update periodicity |
| 15477 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 15478 | { |
| 15479 | pMac->roam.tlStatsReqInfo.periodicity = |
| 15480 | CSR_ROAM_MIN(periodicity, pMac->roam.tlStatsReqInfo.periodicity); |
| 15481 | } |
| 15482 | else |
| 15483 | { |
| 15484 | pMac->roam.tlStatsReqInfo.periodicity = periodicity; |
| 15485 | } |
| 15486 | if(pMac->roam.tlStatsReqInfo.periodicity < CSR_MIN_TL_STAT_QUERY_PERIOD) |
| 15487 | { |
| 15488 | pMac->roam.tlStatsReqInfo.periodicity = CSR_MIN_TL_STAT_QUERY_PERIOD; |
| 15489 | } |
| 15490 | |
| 15491 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 15492 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15493 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15494 | if (NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15495 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15496 | //req TL for class D stats |
| 15497 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId)) |
| 15498 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15499 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15500 | } |
| 15501 | else |
| 15502 | { |
| 15503 | //save in SME |
| 15504 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 15505 | } |
| 15506 | vos_mem_free(pTlStats); |
| 15507 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15508 | } |
| 15509 | else |
| 15510 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15511 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15512 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15513 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15514 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 15515 | { |
| 15516 | //start timer |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15517 | status = vos_timer_start(&pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 15518 | pMac->roam.tlStatsReqInfo.periodicity); |
| 15519 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15520 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15521 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15522 | return eHAL_STATUS_FAILURE; |
| 15523 | } |
| 15524 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 15525 | } |
| 15526 | } |
| 15527 | } |
| 15528 | pMac->roam.tlStatsReqInfo.numClient++; |
| 15529 | } |
| 15530 | |
| 15531 | insertInClientList = TRUE; |
| 15532 | } |
| 15533 | //if one time report requested with non cached result from PE/TL |
| 15534 | else if(!cache && !periodicity) |
| 15535 | { |
| 15536 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 15537 | { |
| 15538 | //send down a req |
| 15539 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 15540 | if(!HAL_STATUS_SUCCESS(status)) |
| 15541 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15542 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to send down stats req to PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15543 | } |
| 15544 | //so that when the stats rsp comes back from PE we respond to upper layer |
| 15545 | //right away |
| 15546 | staEntry.timerExpired = TRUE; |
| 15547 | insertInClientList = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15548 | } |
| 15549 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 15550 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15551 | pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE)); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15552 | if (NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15553 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15554 | //req TL for class D stats |
| 15555 | if(!VOS_IS_STATUS_SUCCESS(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId))) |
| 15556 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15557 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15558 | } |
| 15559 | else |
| 15560 | { |
| 15561 | //save in SME |
| 15562 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 15563 | } |
| 15564 | vos_mem_free(pTlStats); |
| 15565 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15566 | } |
| 15567 | else |
| 15568 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15569 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15570 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15571 | |
| 15572 | } |
| 15573 | //if looking for stats from TL only |
| 15574 | if(!insertInClientList) |
| 15575 | { |
| 15576 | //return the stats |
| 15577 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 15578 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15579 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15580 | if(insertInClientList) |
| 15581 | { |
| 15582 | pStaEntry = csrRoamInsertEntryIntoList(pMac, &pMac->roam.statsClientReqList, &staEntry); |
| 15583 | if(!pStaEntry) |
| 15584 | { |
| 15585 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15586 | smsLog(pMac, LOGW, "csrGetStatistics: Failed to insert req in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15587 | return eHAL_STATUS_FAILURE; |
| 15588 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15589 | pStaEntry->periodicity = periodicity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15590 | //Init & start timer if needed |
| 15591 | if(periodicity) |
| 15592 | { |
| 15593 | vosStatus = vos_timer_init( &pStaEntry->timer, VOS_TIMER_TYPE_SW, |
| 15594 | csrRoamStatsClientTimerHandler, pStaEntry ); |
| 15595 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15596 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15597 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot init StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15598 | return eHAL_STATUS_FAILURE; |
| 15599 | } |
| 15600 | vosStatus = vos_timer_start( &pStaEntry->timer, periodicity ); |
| 15601 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15602 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15603 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15604 | return eHAL_STATUS_FAILURE; |
| 15605 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15606 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15607 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15608 | } |
| 15609 | return eHAL_STATUS_SUCCESS; |
| 15610 | } |
| 15611 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15612 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 15613 | |
| 15614 | static tSirRetStatus |
| 15615 | csrRoamScanOffloadPopulateMacHeader(tpAniSirGlobal pMac, |
| 15616 | tANI_U8* pBD, |
| 15617 | tANI_U8 type, |
| 15618 | tANI_U8 subType, |
| 15619 | tSirMacAddr peerAddr, |
| 15620 | tSirMacAddr selfMacAddr) |
| 15621 | { |
| 15622 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 15623 | tpSirMacMgmtHdr pMacHdr; |
| 15624 | |
| 15625 | /* Prepare MAC management header */ |
| 15626 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 15627 | |
| 15628 | /* Prepare FC */ |
| 15629 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 15630 | pMacHdr->fc.type = type; |
| 15631 | pMacHdr->fc.subType = subType; |
| 15632 | |
| 15633 | /* Prepare Address 1 */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15634 | vos_mem_copy((tANI_U8 *) pMacHdr->da, (tANI_U8 *) peerAddr, |
| 15635 | sizeof( tSirMacAddr )); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15636 | |
| 15637 | sirCopyMacAddr(pMacHdr->sa,selfMacAddr); |
| 15638 | |
| 15639 | /* Prepare Address 3 */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15640 | vos_mem_copy((tANI_U8 *) pMacHdr->bssId, (tANI_U8 *) peerAddr, |
| 15641 | sizeof( tSirMacAddr )); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15642 | return statusCode; |
| 15643 | } /*** csrRoamScanOffloadPopulateMacHeader() ***/ |
| 15644 | |
| 15645 | static tSirRetStatus |
| 15646 | csrRoamScanOffloadPrepareProbeReqTemplate(tpAniSirGlobal pMac, |
| 15647 | tANI_U8 nChannelNum, |
| 15648 | tANI_U32 dot11mode, |
| 15649 | tSirMacAddr selfMacAddr, |
| 15650 | tANI_U8 *pFrame, |
| 15651 | tANI_U16 *pusLen) |
| 15652 | { |
| 15653 | tDot11fProbeRequest pr; |
| 15654 | tANI_U32 nStatus, nBytes, nPayload; |
| 15655 | tSirRetStatus nSirStatus; |
| 15656 | /*Bcast tx*/ |
| 15657 | tSirMacAddr bssId = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 15658 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 15659 | |
| 15660 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15661 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15662 | |
| 15663 | PopulateDot11fSuppRates( pMac, nChannelNum, &pr.SuppRates,NULL); |
| 15664 | |
| 15665 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 15666 | { |
| 15667 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 15668 | } |
| 15669 | |
| 15670 | |
| 15671 | if (IS_DOT11_MODE_HT(dot11mode)) |
| 15672 | { |
| 15673 | PopulateDot11fHTCaps( pMac, NULL, &pr.HTCaps ); |
| 15674 | } |
| 15675 | |
| 15676 | |
| 15677 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 15678 | if ( DOT11F_FAILED( nStatus ) ) |
| 15679 | { |
| 15680 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15681 | "Failed to calculate the packed size f" |
| 15682 | "or a Probe Request (0x%08x).\n", nStatus ); |
| 15683 | |
| 15684 | |
| 15685 | nPayload = sizeof( tDot11fProbeRequest ); |
| 15686 | } |
| 15687 | else if ( DOT11F_WARNED( nStatus ) ) |
| 15688 | { |
| 15689 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15690 | "There were warnings while calculating" |
| 15691 | "the packed size for a Probe Request (" |
| 15692 | "0x%08x).\n", nStatus ); |
| 15693 | } |
| 15694 | |
| 15695 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 15696 | |
| 15697 | /* Prepare outgoing frame*/ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15698 | vos_mem_set(pFrame, nBytes , 0); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15699 | |
| 15700 | |
| 15701 | nSirStatus = csrRoamScanOffloadPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15702 | SIR_MAC_MGMT_PROBE_REQ, bssId,selfMacAddr); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15703 | |
| 15704 | if ( eSIR_SUCCESS != nSirStatus ) |
| 15705 | { |
| 15706 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15707 | "Failed to populate the buffer descriptor for a Probe Request (%d).\n", |
| 15708 | nSirStatus ); |
| 15709 | return nSirStatus; |
| 15710 | } |
| 15711 | |
| 15712 | |
| 15713 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 15714 | sizeof( tSirMacMgmtHdr ), |
| 15715 | nPayload, &nPayload ); |
| 15716 | if ( DOT11F_FAILED( nStatus ) ) |
| 15717 | { |
| 15718 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15719 | "Failed to pack a Probe Request (0x%08x).\n", nStatus ); |
| 15720 | return eSIR_FAILURE; |
| 15721 | } |
| 15722 | else if ( DOT11F_WARNED( nStatus ) ) |
| 15723 | { |
| 15724 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 15725 | "There were warnings while packing a Probe Request (0x%08x).\n", |
| 15726 | nStatus ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15727 | } |
| 15728 | |
| 15729 | *pusLen = nPayload + sizeof(tSirMacMgmtHdr); |
| 15730 | return eSIR_SUCCESS; |
| 15731 | } |
| 15732 | |
| 15733 | eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 command, tANI_U8 reason) |
| 15734 | { |
| 15735 | vos_msg_t msg; |
| 15736 | tSirRoamOffloadScanReq *pRequestBuf; |
| 15737 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 15738 | tCsrRoamSession *pSession; |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 15739 | tANI_U8 i,j,num_channels = 0, ucDot11Mode; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15740 | tANI_U8 *ChannelList = NULL; |
| 15741 | tANI_U32 sessionId; |
| 15742 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15743 | tpCsrChannelInfo currChannelListInfo; |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 15744 | tANI_U32 host_channels = 0; |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 15745 | tANI_U8 ChannelCacheStr[128] = {0}; |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 15746 | eCsrBand eBand; |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 15747 | tSirBssDescription *pBssDesc = NULL; |
| 15748 | tDot11fBeaconIEs *pIes = NULL; |
| 15749 | tANI_U8 minRate = 0, dataRate; |
Varun Reddy Yeturu | 52231ea | 2014-02-06 12:00:56 -0800 | [diff] [blame] | 15750 | tANI_U8 operationChannel = 0; |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 15751 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15752 | currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 15753 | |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 15754 | if (0 == csrRoamIsRoamOffloadScanEnabled(pMac)) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15755 | { |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 15756 | smsLog( pMac, LOGE,"isRoamOffloadScanEnabled not set"); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15757 | return eHAL_STATUS_FAILURE; |
| 15758 | } |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 15759 | |
| 15760 | if ((VOS_TRUE == bRoamScanOffloadStarted) && (ROAM_SCAN_OFFLOAD_START == command)) |
| 15761 | { |
| 15762 | smsLog( pMac, LOGE,"Roam Scan Offload is already started"); |
| 15763 | return eHAL_STATUS_FAILURE; |
| 15764 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15765 | status = csrRoamGetSessionIdFromBSSID(pMac, |
| 15766 | (tCsrBssid *)pNeighborRoamInfo->currAPbssid, |
| 15767 | &sessionId); |
| 15768 | /*The Dynamic Config Items Update may happen even if the state is in INIT. |
| 15769 | * It is important to ensure that the command is passed down to the FW only |
| 15770 | * if the Infra Station is in a connected state.A connected station could also be |
| 15771 | * in a PREAUTH or REASSOC states.So, consider not sending the command down in INIT state. |
| 15772 | * We also have to ensure that if there is a STOP command we always have to inform Riva, |
| 15773 | * irrespective of whichever state we are in.*/ |
| 15774 | if ((pMac->roam.neighborRoamInfo.neighborRoamState == eCSR_NEIGHBOR_ROAM_STATE_INIT) && |
| 15775 | (command != ROAM_SCAN_OFFLOAD_STOP)) |
| 15776 | { |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 15777 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 15778 | FL("Scan Command not sent to FW with state = %s and cmd=%d\n"), |
| 15779 | macTraceGetNeighbourRoamState( |
| 15780 | pMac->roam.neighborRoamInfo.neighborRoamState), command); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15781 | return eHAL_STATUS_FAILURE; |
| 15782 | } |
| 15783 | |
| 15784 | if ( !HAL_STATUS_SUCCESS( status ) ) |
| 15785 | { |
| 15786 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to find the sessionId for Roam Offload scan request", __func__); |
| 15787 | return eHAL_STATUS_FAILURE; |
| 15788 | } |
| 15789 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
krunal soni | 587bf01 | 2014-02-04 12:35:11 -0800 | [diff] [blame] | 15790 | if (NULL == pSession) |
| 15791 | { |
| 15792 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15793 | "%s:pSession is null", __func__); |
| 15794 | return eHAL_STATUS_FAILURE; |
| 15795 | } |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 15796 | pBssDesc = pSession->pConnectBssDesc; |
| 15797 | if (pBssDesc == NULL) |
| 15798 | { |
| 15799 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: pBssDesc not found for current session", __func__); |
| 15800 | return eHAL_STATUS_FAILURE; |
| 15801 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15802 | pRequestBuf = vos_mem_malloc(sizeof(tSirRoamOffloadScanReq)); |
| 15803 | if (NULL == pRequestBuf) |
| 15804 | { |
| 15805 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for Roam Offload scan request", __func__); |
| 15806 | return eHAL_STATUS_FAILED_ALLOC; |
| 15807 | } |
| 15808 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15809 | vos_mem_zero(pRequestBuf, sizeof(tSirRoamOffloadScanReq)); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15810 | /* If command is STOP, then pass down ScanOffloadEnabled as Zero.This will handle the case of |
| 15811 | * host driver reloads, but Riva still up and running*/ |
Mukul Sharma | 90506b4 | 2014-04-24 13:24:12 +0530 | [diff] [blame^] | 15812 | pRequestBuf->Command = command; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15813 | if(command == ROAM_SCAN_OFFLOAD_STOP) |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 15814 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15815 | pRequestBuf->RoamScanOffloadEnabled = 0; |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 15816 | /*For a STOP Command, there is no need to |
| 15817 | * go through filling up all the below parameters |
| 15818 | * since they are not required for the STOP command*/ |
| 15819 | goto send_roam_scan_offload_cmd; |
| 15820 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15821 | else |
| 15822 | pRequestBuf->RoamScanOffloadEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15823 | vos_mem_copy(pRequestBuf->ConnectedNetwork.currAPbssid, |
| 15824 | pNeighborRoamInfo->currAPbssid, |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15825 | sizeof(tCsrBssid)); |
| 15826 | pRequestBuf->ConnectedNetwork.ssId.length = |
| 15827 | pMac->roam.roamSession[sessionId].connectedProfile.SSID.length; |
| 15828 | vos_mem_copy(pRequestBuf->ConnectedNetwork.ssId.ssId, |
| 15829 | pMac->roam.roamSession[sessionId].connectedProfile.SSID.ssId, |
| 15830 | pRequestBuf->ConnectedNetwork.ssId.length); |
| 15831 | pRequestBuf->ConnectedNetwork.authentication = |
| 15832 | pMac->roam.roamSession[sessionId].connectedProfile.AuthType; |
| 15833 | pRequestBuf->ConnectedNetwork.encryption = |
| 15834 | pMac->roam.roamSession[sessionId].connectedProfile.EncryptionType; |
| 15835 | pRequestBuf->ConnectedNetwork.mcencryption = |
| 15836 | pMac->roam.roamSession[sessionId].connectedProfile.mcEncryptionType; |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 15837 | if (pNeighborRoamInfo->cfgParams.neighborLookupThreshold) |
| 15838 | { |
| 15839 | pRequestBuf->LookupThreshold = |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15840 | (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1); |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 15841 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_DEFAULT; |
| 15842 | } |
| 15843 | else |
| 15844 | { |
| 15845 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Calculate Adaptive Threshold"); |
| 15846 | operationChannel = pSession->connectedProfile.operationChannel; |
| 15847 | |
| 15848 | if (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 15849 | { |
| 15850 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15851 | "%s: csrGetParsedBssDescriptionIEs failed", __func__); |
| 15852 | vos_mem_free(pRequestBuf); |
| 15853 | return eHAL_STATUS_FAILURE; |
| 15854 | } |
Kaushik, Sushant | 5874d03 | 2014-02-20 17:22:36 +0530 | [diff] [blame] | 15855 | if(NULL == pIes) |
| 15856 | { |
| 15857 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15858 | "%s : pIes is Null", __func__); |
| 15859 | return eHAL_STATUS_FAILURE; |
| 15860 | } |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 15861 | if (pIes->SuppRates.present) |
| 15862 | { |
| 15863 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Number \t Rate"); |
| 15864 | /*Check for both basic rates and extended rates.*/ |
| 15865 | for (i = 0; i < pIes->SuppRates.num_rates; i++) |
| 15866 | { |
| 15867 | /*Check if the Rate is Mandatory or Not*/ |
| 15868 | if (csrRatesIsDot11RateSupported(pMac, pIes->SuppRates.rates[i]) |
| 15869 | && (pIes->SuppRates.rates[i] & 0x80)) |
| 15870 | { |
| 15871 | /*Retrieve the actual data rate*/ |
| 15872 | dataRate = (pIes->SuppRates.rates[i] & 0x7F)/2; |
| 15873 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%d \t\t %d", i, dataRate); |
| 15874 | if (minRate == 0) |
| 15875 | minRate = dataRate; |
| 15876 | else |
| 15877 | minRate = (minRate < dataRate) ? minRate:dataRate; |
| 15878 | } |
| 15879 | } |
| 15880 | |
| 15881 | if (pIes->ExtSuppRates.present) |
| 15882 | { |
| 15883 | for (i = 0; i < pIes->ExtSuppRates.num_rates; i++) |
| 15884 | { |
| 15885 | /*Check if the Rate is Mandatory or Not*/ |
| 15886 | if (csrRatesIsDot11RateSupported(pMac, pIes->ExtSuppRates.rates[i]) |
| 15887 | && (pIes->ExtSuppRates.rates[i] & 0x80)) |
| 15888 | { |
| 15889 | /*Retrieve the actual data rate*/ |
| 15890 | dataRate = (pIes->ExtSuppRates.rates[i] & 0x7F)/2; |
| 15891 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%d \t\t %d", i, dataRate); |
| 15892 | if (minRate == 0) |
| 15893 | minRate = dataRate; |
| 15894 | else |
| 15895 | minRate = (minRate < dataRate) ? minRate:dataRate; |
| 15896 | } |
| 15897 | } |
| 15898 | } |
| 15899 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "MinRate = %d", minRate); |
| 15900 | } |
| 15901 | else |
| 15902 | { |
| 15903 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15904 | "%s: Supp Rates not present in pIes", __func__); |
| 15905 | vos_mem_free(pRequestBuf); |
| 15906 | return eHAL_STATUS_FAILURE; |
| 15907 | } |
| 15908 | if (NULL != pIes) |
| 15909 | { |
| 15910 | vos_mem_free(pIes); |
| 15911 | pIes = NULL; |
| 15912 | } |
| 15913 | switch (minRate) |
| 15914 | { |
| 15915 | case 1: |
| 15916 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_1MBPS; |
| 15917 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_1MBPS; |
| 15918 | break; |
| 15919 | case 2: |
| 15920 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_2MBPS; |
| 15921 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_2MBPS; |
| 15922 | break; |
| 15923 | case 5: |
| 15924 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_5_5MBPS; |
| 15925 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_5_5MBPS; |
| 15926 | break; |
| 15927 | case 6: |
| 15928 | if (CSR_IS_CHANNEL_24GHZ(operationChannel)) |
| 15929 | { |
| 15930 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_6MBPS_2G; |
| 15931 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_6MBPS_2G; |
| 15932 | } |
| 15933 | else |
| 15934 | { |
| 15935 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_6MBPS_5G; |
| 15936 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_6MBPS_5G; |
| 15937 | } |
| 15938 | break; |
| 15939 | case 11: |
| 15940 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_11MBPS; |
| 15941 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_11MBPS; |
| 15942 | break; |
| 15943 | case 12: |
| 15944 | if (CSR_IS_CHANNEL_24GHZ(operationChannel)) |
| 15945 | { |
| 15946 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_12MBPS_2G; |
| 15947 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_12MBPS_2G; |
| 15948 | } |
| 15949 | else |
| 15950 | { |
| 15951 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_12MBPS_5G; |
| 15952 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_12MBPS_5G; |
| 15953 | } |
| 15954 | break; |
| 15955 | case 24: |
| 15956 | if (CSR_IS_CHANNEL_24GHZ(operationChannel)) |
| 15957 | { |
| 15958 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_24MBPS_2G; |
| 15959 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_24MBPS_2G; |
| 15960 | } |
| 15961 | else |
| 15962 | { |
| 15963 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_24MBPS_5G; |
| 15964 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_24MBPS_5G; |
| 15965 | } |
| 15966 | break; |
| 15967 | default: |
| 15968 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_DEFAULT; |
| 15969 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_DEFAULT; |
| 15970 | break; |
| 15971 | } |
| 15972 | } |
| 15973 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 15974 | "Chnl=%d,MinRate=%d,RxSenThr=%d,LookupThr=%d", |
| 15975 | operationChannel, minRate, |
| 15976 | pRequestBuf->RxSensitivityThreshold, |
| 15977 | pRequestBuf->LookupThreshold); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15978 | pRequestBuf->RoamRssiDiff = |
| 15979 | pMac->roam.configParam.RoamRssiDiff; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15980 | pRequestBuf->StartScanReason = reason; |
| 15981 | pRequestBuf->NeighborScanTimerPeriod = |
| 15982 | pNeighborRoamInfo->cfgParams.neighborScanPeriod; |
| 15983 | pRequestBuf->NeighborRoamScanRefreshPeriod = |
| 15984 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod; |
| 15985 | pRequestBuf->NeighborScanChannelMinTime = |
| 15986 | pNeighborRoamInfo->cfgParams.minChannelScanTime; |
| 15987 | pRequestBuf->NeighborScanChannelMaxTime = |
| 15988 | pNeighborRoamInfo->cfgParams.maxChannelScanTime; |
| 15989 | pRequestBuf->EmptyRefreshScanPeriod = |
| 15990 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod; |
Sameer Thalappil | 4ae66ec | 2013-11-05 14:17:35 -0800 | [diff] [blame] | 15991 | /* MAWC feature */ |
| 15992 | pRequestBuf->MAWCEnabled = |
| 15993 | pMac->roam.configParam.MAWCEnabled; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 15994 | #ifdef FEATURE_WLAN_ESE |
| 15995 | pRequestBuf->IsESEEnabled = pMac->roam.configParam.isEseIniFeatureEnabled; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15996 | #endif |
| 15997 | if ( |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 15998 | #ifdef FEATURE_WLAN_ESE |
| 15999 | ((pNeighborRoamInfo->isESEAssoc) && |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16000 | (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == |
| 16001 | eANI_BOOLEAN_FALSE)) || |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16002 | (pNeighborRoamInfo->isESEAssoc == eANI_BOOLEAN_FALSE) || |
| 16003 | #endif // ESE |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16004 | currChannelListInfo->numOfChannels == 0) |
| 16005 | { |
| 16006 | |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16007 | /*Retrieve the Channel Cache either from ini or from the Occupied Channels list. |
| 16008 | * Give Preference to INI Channels.*/ |
| 16009 | if (pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels) |
| 16010 | { |
| 16011 | ChannelList = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 16012 | /*The INI channels need to be filtered with respect to the current |
| 16013 | * band that is supported.*/ |
| 16014 | eBand = pMac->roam.configParam.bandCapability; |
| 16015 | if ((eCSR_BAND_24 != eBand) && (eCSR_BAND_5G != eBand) && (eCSR_BAND_ALL != eBand)) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16016 | { |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16017 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16018 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 16019 | vos_mem_free(pRequestBuf); |
| 16020 | return eHAL_STATUS_FAILURE; |
| 16021 | } |
| 16022 | for (i=0; i<pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++) |
| 16023 | { |
| 16024 | if(((eCSR_BAND_24 == eBand) && CSR_IS_CHANNEL_24GHZ(*ChannelList)) || |
| 16025 | ((eCSR_BAND_5G == eBand) && CSR_IS_CHANNEL_5GHZ(*ChannelList)) || |
| 16026 | (eCSR_BAND_ALL == eBand)) |
| 16027 | { |
| 16028 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && |
| 16029 | csrRoamIsChannelValid(pMac, *ChannelList) && |
| 16030 | *ChannelList && (num_channels < SIR_ROAM_MAX_CHANNELS)) |
| 16031 | { |
| 16032 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 16033 | } |
| 16034 | } |
| 16035 | ChannelList++; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16036 | } |
| 16037 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 16038 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_STATIC; |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16039 | } |
| 16040 | else |
| 16041 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16042 | ChannelList = pMac->scan.occupiedChannels.channelList; |
| 16043 | for(i=0; i<pMac->scan.occupiedChannels.numChannels; i++) |
| 16044 | { |
Sandeep Puligilla | c80f26e | 2014-03-11 18:36:10 +0530 | [diff] [blame] | 16045 | /*Allow DFS channels only if the DFS channel roam flag is enabled */ |
| 16046 | if(((pMac->roam.configParam.allowDFSChannelRoam) || |
| 16047 | (!CSR_IS_CHANNEL_DFS(*ChannelList))) && |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16048 | *ChannelList && (num_channels < SIR_ROAM_MAX_CHANNELS)) |
| 16049 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16050 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16051 | } |
| 16052 | ChannelList++; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16053 | } |
| 16054 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 16055 | /* If the profile changes as to what it was earlier, inform the FW through |
| 16056 | * FLUSH as ChannelCacheType in which case, the FW will flush the occupied channels |
| 16057 | * for the earlier profile and try to learn them afresh.*/ |
| 16058 | if (reason == REASON_FLUSH_CHANNEL_LIST) |
| 16059 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_FLUSH; |
| 16060 | else { |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16061 | if (csrNeighborRoamIsNewConnectedProfile(pMac)) |
| 16062 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_INIT; |
| 16063 | else |
| 16064 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16065 | } |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16066 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16067 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16068 | #ifdef FEATURE_WLAN_ESE |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16069 | else |
| 16070 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16071 | /* If ESE is enabled, and a neighbor Report is received,then |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16072 | * Ignore the INI Channels or the Occupied Channel List. Consider |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16073 | * the channels in the neighbor list sent by the ESE AP.*/ |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16074 | if (currChannelListInfo->numOfChannels != 0) |
| 16075 | { |
| 16076 | ChannelList = currChannelListInfo->ChannelList; |
| 16077 | for (i=0;i<currChannelListInfo->numOfChannels;i++) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16078 | { |
Sandeep Puligilla | c80f26e | 2014-03-11 18:36:10 +0530 | [diff] [blame] | 16079 | if(((pMac->roam.configParam.allowDFSChannelRoam) || |
| 16080 | (!CSR_IS_CHANNEL_DFS(*ChannelList))) && *ChannelList) |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16081 | { |
| 16082 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 16083 | } |
| 16084 | ChannelList++; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16085 | } |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16086 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 16087 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE; |
| 16088 | } |
| 16089 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16090 | #endif |
Kaushik, Sushant | 5ed8ab6 | 2014-03-05 11:21:11 +0530 | [diff] [blame] | 16091 | for (i = 0, j = 0;j < (sizeof(ChannelCacheStr)/sizeof(ChannelCacheStr[0])) && i < pRequestBuf->ConnectedNetwork.ChannelCount; i++) |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16092 | { |
Kaushik, Sushant | d39915b | 2014-04-23 15:12:28 +0530 | [diff] [blame] | 16093 | if (j < sizeof(ChannelCacheStr)) |
| 16094 | { |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16095 | j += snprintf(ChannelCacheStr + j, sizeof(ChannelCacheStr) - j," %d", |
| 16096 | pRequestBuf->ConnectedNetwork.ChannelCache[i]); |
Kaushik, Sushant | d39915b | 2014-04-23 15:12:28 +0530 | [diff] [blame] | 16097 | } |
| 16098 | else |
| 16099 | { |
| 16100 | break; |
| 16101 | } |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16102 | } |
| 16103 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 16104 | "ChnlCacheType:%d, No of Chnls:%d,Channels: %s", |
| 16105 | pRequestBuf->ChannelCacheType, |
| 16106 | pRequestBuf->ConnectedNetwork.ChannelCount, |
| 16107 | ChannelCacheStr); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16108 | num_channels = 0; |
| 16109 | ChannelList = NULL; |
| 16110 | |
| 16111 | /* Maintain the Valid Channels List*/ |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16112 | host_channels = sizeof(pMac->roam.validChannelList); |
| 16113 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &host_channels))) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16114 | { |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16115 | ChannelList = pMac->roam.validChannelList; |
| 16116 | pMac->roam.numValidChannels = host_channels; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16117 | } |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16118 | else |
| 16119 | { |
| 16120 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16121 | "%s:Failed to get the valid channel list", __func__); |
Praveen Kumar Sirisilla | 16c6377 | 2013-10-23 19:31:58 -0700 | [diff] [blame] | 16122 | vos_mem_free(pRequestBuf); |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16123 | return eHAL_STATUS_FAILURE; |
| 16124 | } |
| 16125 | for(i=0; i<pMac->roam.numValidChannels; i++) |
| 16126 | { |
Sandeep Puligilla | c80f26e | 2014-03-11 18:36:10 +0530 | [diff] [blame] | 16127 | if(((pMac->roam.configParam.allowDFSChannelRoam) || |
| 16128 | (!CSR_IS_CHANNEL_DFS(*ChannelList))) && *ChannelList) |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16129 | { |
| 16130 | pRequestBuf->ValidChannelList[num_channels++] = *ChannelList; |
| 16131 | } |
| 16132 | ChannelList++; |
| 16133 | } |
| 16134 | pRequestBuf->ValidChannelCount = num_channels; |
| 16135 | |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 16136 | pRequestBuf->MDID.mdiePresent = |
| 16137 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent; |
| 16138 | pRequestBuf->MDID.mobilityDomain = |
| 16139 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mobilityDomain; |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 16140 | pRequestBuf->nProbes = pMac->roam.configParam.nProbes; |
| 16141 | |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 16142 | pRequestBuf->HomeAwayTime = pMac->roam.configParam.nRoamScanHomeAwayTime; |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16143 | /* Home Away Time should be at least equal to (MaxDwell time + (2*RFS)), |
| 16144 | * where RFS is the RF Switching time. It is twice RFS to consider the |
| 16145 | * time to go off channel and return to the home channel. */ |
| 16146 | if (pRequestBuf->HomeAwayTime < (pRequestBuf->NeighborScanChannelMaxTime + (2 * CSR_ROAM_SCAN_CHANNEL_SWITCH_TIME))) |
| 16147 | { |
| 16148 | VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 16149 | "%s: Invalid config, Home away time(%d) is less than (twice RF switching time + channel max time)(%d)" |
| 16150 | " Hence enforcing home away time to disable (0)", |
| 16151 | __func__, pRequestBuf->HomeAwayTime, |
| 16152 | (pRequestBuf->NeighborScanChannelMaxTime + (2 * CSR_ROAM_SCAN_CHANNEL_SWITCH_TIME))); |
| 16153 | pRequestBuf->HomeAwayTime = 0; |
| 16154 | } |
| 16155 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,"HomeAwayTime:%d",pRequestBuf->HomeAwayTime); |
Srinivas Girigowda | 6cf0b82 | 2013-06-27 14:00:20 -0700 | [diff] [blame] | 16156 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16157 | /*Prepare a probe request for 2.4GHz band and one for 5GHz band*/ |
| 16158 | ucDot11Mode = (tANI_U8) csrTranslateToWNICfgDot11Mode(pMac, |
| 16159 | csrFindBestPhyMode( pMac, pMac->roam.configParam.phyMode )); |
| 16160 | csrRoamScanOffloadPrepareProbeReqTemplate(pMac,SIR_ROAM_SCAN_24G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, |
| 16161 | pRequestBuf->p24GProbeTemplate, &pRequestBuf->us24GProbeTemplateLen); |
| 16162 | |
| 16163 | csrRoamScanOffloadPrepareProbeReqTemplate(pMac,SIR_ROAM_SCAN_5G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, |
| 16164 | pRequestBuf->p5GProbeTemplate, &pRequestBuf->us5GProbeTemplateLen); |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 16165 | send_roam_scan_offload_cmd: |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 16166 | msg.type = WDA_ROAM_SCAN_OFFLOAD_REQ; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16167 | msg.reserved = 0; |
| 16168 | msg.bodyptr = pRequestBuf; |
| 16169 | if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))) |
| 16170 | { |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 16171 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_ROAM_SCAN_OFFLOAD_REQ message to WDA", __func__); |
| 16172 | vos_mem_free(pRequestBuf); |
| 16173 | return eHAL_STATUS_FAILURE; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16174 | } |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 16175 | else |
| 16176 | { |
| 16177 | if (ROAM_SCAN_OFFLOAD_START == command) |
| 16178 | bRoamScanOffloadStarted = VOS_TRUE; |
| 16179 | else if (ROAM_SCAN_OFFLOAD_STOP == command) |
| 16180 | bRoamScanOffloadStarted = VOS_FALSE; |
| 16181 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16182 | |
| 16183 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Roam Scan Offload Command %d, Reason %d", command, reason); |
| 16184 | return status; |
| 16185 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 16186 | |
| 16187 | eHalStatus csrRoamOffloadScanRspHdlr(tpAniSirGlobal pMac, tANI_U8 reason) |
| 16188 | { |
| 16189 | switch(reason) |
| 16190 | { |
| 16191 | case 0: |
| 16192 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Rsp for Roam Scan Offload with failure status"); |
| 16193 | break; |
| 16194 | case REASON_OS_REQUESTED_ROAMING_NOW: |
| 16195 | csrNeighborRoamProceedWithHandoffReq(pMac); |
| 16196 | break; |
| 16197 | default: |
Tushnim Bhattacharyya | 5128d75 | 2013-06-26 23:23:18 -0700 | [diff] [blame] | 16198 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Rsp for Roam Scan Offload with reason %d", reason); |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 16199 | } |
| 16200 | return eHAL_STATUS_SUCCESS; |
| 16201 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16202 | #endif |
| 16203 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16204 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 16205 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId) |
| 16206 | { |
| 16207 | tANI_BOOLEAN found = FALSE; |
| 16208 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16209 | tCsrPeStatsReqInfo staEntry; |
| 16210 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
| 16211 | tListElem *pStaEntry = NULL; |
| 16212 | VOS_STATUS vosStatus; |
| 16213 | tPmcPowerState powerState; |
| 16214 | *pFound = FALSE; |
| 16215 | |
| 16216 | pStaEntry = csrRoamFindInPeStatsReqList(pMac, statsMask); |
| 16217 | if(pStaEntry) |
| 16218 | { |
| 16219 | pTempStaEntry = GET_BASE_ADDR( pStaEntry, tCsrPeStatsReqInfo, link ); |
| 16220 | if(pTempStaEntry->periodicity) |
| 16221 | { |
| 16222 | pTempStaEntry->periodicity = |
| 16223 | CSR_ROAM_MIN(periodicity, pTempStaEntry->periodicity); |
| 16224 | } |
| 16225 | else |
| 16226 | { |
| 16227 | pTempStaEntry->periodicity = periodicity; |
| 16228 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16229 | pTempStaEntry->numClient++; |
| 16230 | found = TRUE; |
| 16231 | } |
| 16232 | else |
| 16233 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16234 | vos_mem_set(&staEntry, sizeof(tCsrPeStatsReqInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16235 | staEntry.numClient = 1; |
| 16236 | staEntry.periodicity = periodicity; |
| 16237 | staEntry.pMac = pMac; |
| 16238 | staEntry.rspPending = FALSE; |
| 16239 | staEntry.staId = staId; |
| 16240 | staEntry.statsMask = statsMask; |
| 16241 | staEntry.timerRunning = FALSE; |
| 16242 | pTempStaEntry = csrRoamInsertEntryIntoPeStatsReqList(pMac, &pMac->roam.peStatsReqList, &staEntry); |
| 16243 | if(!pTempStaEntry) |
| 16244 | { |
| 16245 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16246 | smsLog(pMac, LOGW, "csrRoamCheckPeStatsReqList: Failed to insert req in peStatsReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16247 | return NULL; |
| 16248 | } |
| 16249 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16250 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 16251 | if(ePMC_FULL_POWER == powerState) |
| 16252 | { |
| 16253 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 16254 | { |
| 16255 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 16256 | } |
| 16257 | } |
| 16258 | else |
| 16259 | { |
| 16260 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 16261 | { |
| 16262 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 16263 | } |
| 16264 | } |
| 16265 | if(!pTempStaEntry->timerRunning) |
| 16266 | { |
| 16267 | //send down a req in case of one time req, for periodic ones wait for timer to expire |
| 16268 | if(!pTempStaEntry->rspPending && |
| 16269 | !pTempStaEntry->periodicity) |
| 16270 | { |
| 16271 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 16272 | if(!HAL_STATUS_SUCCESS(status)) |
| 16273 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16274 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:failed to send down stats req to PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16275 | } |
| 16276 | else |
| 16277 | { |
| 16278 | pTempStaEntry->rspPending = TRUE; |
| 16279 | } |
| 16280 | } |
| 16281 | if(pTempStaEntry->periodicity) |
| 16282 | { |
| 16283 | if(!found) |
| 16284 | { |
| 16285 | |
| 16286 | vosStatus = vos_timer_init( &pTempStaEntry->hPeStatsTimer, VOS_TIMER_TYPE_SW, |
| 16287 | csrRoamPeStatsTimerHandler, pTempStaEntry ); |
| 16288 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 16289 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16290 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot init hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16291 | return NULL; |
| 16292 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16293 | } |
| 16294 | //start timer |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16295 | smsLog(pMac, LOG1, "csrRoamCheckPeStatsReqList:peStatsTimer period %d", pTempStaEntry->periodicity); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16296 | vosStatus = vos_timer_start( &pTempStaEntry->hPeStatsTimer, pTempStaEntry->periodicity ); |
| 16297 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 16298 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16299 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16300 | return NULL; |
| 16301 | } |
| 16302 | pTempStaEntry->timerRunning = TRUE; |
| 16303 | } |
| 16304 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16305 | *pFound = found; |
| 16306 | return pTempStaEntry; |
| 16307 | } |
| 16308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16309 | /* |
| 16310 | pStaEntry is no longer invalid upon the return of this function. |
| 16311 | */ |
| 16312 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry) |
| 16313 | { |
| 16314 | if(pEntry) |
| 16315 | { |
| 16316 | if(csrLLRemoveEntry(&pMac->roam.statsClientReqList, pEntry, LL_ACCESS_LOCK)) |
| 16317 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16318 | vos_mem_free(GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16319 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16320 | } |
| 16321 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16322 | |
| 16323 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry) |
| 16324 | { |
| 16325 | tListElem *pEntry; |
| 16326 | tCsrPeStatsReqInfo *pTempStaEntry; |
| 16327 | VOS_STATUS vosStatus; |
| 16328 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16329 | if(!pEntry) |
| 16330 | { |
| 16331 | //list empty |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16332 | smsLog(pMac, LOGE, FL(" List empty, no stats req for PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16333 | return; |
| 16334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16335 | while( pEntry ) |
| 16336 | { |
| 16337 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16338 | if( pTempStaEntry && pTempStaEntry->statsMask == pPeStaEntry->statsMask) |
| 16339 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16340 | smsLog(pMac, LOGW, FL("Match found")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16341 | if(pTempStaEntry->timerRunning) |
| 16342 | { |
| 16343 | vosStatus = vos_timer_stop( &pTempStaEntry->hPeStatsTimer ); |
| 16344 | /* If we are not able to stop the timer here, just remove |
| 16345 | * the entry from the linked list. Destroy the timer object |
| 16346 | * and free the memory in the timer CB |
| 16347 | */ |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 16348 | if ( vosStatus == VOS_STATUS_SUCCESS ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16349 | { |
| 16350 | /* the timer is successfully stopped */ |
| 16351 | pTempStaEntry->timerRunning = FALSE; |
| 16352 | |
| 16353 | /* Destroy the timer */ |
| 16354 | vosStatus = vos_timer_destroy( &pTempStaEntry->hPeStatsTimer ); |
| 16355 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 16356 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16357 | smsLog(pMac, LOGE, FL("csrRoamRemoveEntryFromPeStatsReqList:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16358 | } |
| 16359 | } |
| 16360 | else |
| 16361 | { |
| 16362 | // the timer could not be stopped. Hence destroy and free the |
| 16363 | // memory for the PE stat entry in the timer CB. |
| 16364 | pTempStaEntry->timerStopFailed = TRUE; |
| 16365 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16366 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16367 | |
| 16368 | if(csrLLRemoveEntry(&pMac->roam.peStatsReqList, pEntry, LL_ACCESS_LOCK)) |
| 16369 | { |
| 16370 | // Only free the memory if we could stop the timer successfully |
| 16371 | if(!pTempStaEntry->timerStopFailed) |
| 16372 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16373 | vos_mem_free(pTempStaEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16374 | pTempStaEntry = NULL; |
| 16375 | } |
| 16376 | break; |
| 16377 | } |
| 16378 | |
| 16379 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 16380 | } |
| 16381 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16382 | return; |
| 16383 | } |
| 16384 | |
| 16385 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16386 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16387 | { |
| 16388 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16389 | pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = pTlStats->rxBcntCRCok; |
| 16390 | pMac->roam.classDStatsInfo.rx_bc_byte_cnt = pTlStats->rxBCBcnt; |
| 16391 | pMac->roam.classDStatsInfo.rx_bc_frm_cnt = pTlStats->rxBCFcnt; |
| 16392 | pMac->roam.classDStatsInfo.rx_byte_cnt = pTlStats->rxBcnt; |
| 16393 | pMac->roam.classDStatsInfo.rx_mc_byte_cnt = pTlStats->rxMCBcnt; |
| 16394 | pMac->roam.classDStatsInfo.rx_mc_frm_cnt = pTlStats->rxMCFcnt; |
| 16395 | pMac->roam.classDStatsInfo.rx_rate = pTlStats->rxRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16396 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16397 | pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = pTlStats->rxUCBcnt; |
| 16398 | pMac->roam.classDStatsInfo.rx_uc_frm_cnt = pTlStats->rxUCFcnt; |
| 16399 | pMac->roam.classDStatsInfo.tx_bc_byte_cnt = pTlStats->txBCBcnt; |
| 16400 | pMac->roam.classDStatsInfo.tx_bc_frm_cnt = pTlStats->txBCFcnt; |
| 16401 | pMac->roam.classDStatsInfo.tx_mc_byte_cnt = pTlStats->txMCBcnt; |
| 16402 | pMac->roam.classDStatsInfo.tx_mc_frm_cnt = pTlStats->txMCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16403 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16404 | pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = pTlStats->txUCBcnt; |
| 16405 | pMac->roam.classDStatsInfo.tx_uc_frm_cnt = pTlStats->txUCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16406 | |
| 16407 | } |
| 16408 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16409 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 16410 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext) |
| 16411 | { |
| 16412 | tANI_U8 stats[500]; |
| 16413 | tANI_U8 *pStats = NULL; |
| 16414 | tANI_U32 tempMask = 0; |
| 16415 | tANI_U8 counter = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16416 | if(!callback) |
| 16417 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16418 | smsLog(pMac, LOGE, FL("Cannot report callback NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16419 | return; |
| 16420 | } |
| 16421 | if(!statsMask) |
| 16422 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16423 | smsLog(pMac, LOGE, FL("Cannot report statsMask is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16424 | return; |
| 16425 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16426 | pStats = stats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16427 | tempMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16428 | while(tempMask) |
| 16429 | { |
| 16430 | if(tempMask & 1) |
| 16431 | { |
| 16432 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 16433 | switch(counter) |
| 16434 | { |
| 16435 | case eCsrSummaryStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16436 | smsLog( pMac, LOG2, FL("Summary stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16437 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 16438 | sizeof(tCsrSummaryStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16439 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 16440 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16441 | case eCsrGlobalClassAStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16442 | smsLog( pMac, LOG2, FL("ClassA stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16443 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 16444 | sizeof(tCsrGlobalClassAStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16445 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16446 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16447 | case eCsrGlobalClassBStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16448 | smsLog( pMac, LOG2, FL("ClassB stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16449 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 16450 | sizeof(tCsrGlobalClassBStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16451 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16452 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16453 | case eCsrGlobalClassCStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16454 | smsLog( pMac, LOG2, FL("ClassC stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16455 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 16456 | sizeof(tCsrGlobalClassCStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16457 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16458 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16459 | case eCsrGlobalClassDStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16460 | smsLog( pMac, LOG2, FL("ClassD stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16461 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classDStatsInfo, |
| 16462 | sizeof(tCsrGlobalClassDStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16463 | pStats += sizeof(tCsrGlobalClassDStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16464 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16465 | case eCsrPerStaStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16466 | smsLog( pMac, LOG2, FL("PerSta stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16467 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.perStaStatsInfo[staId], |
| 16468 | sizeof(tCsrPerStaStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16469 | pStats += sizeof(tCsrPerStaStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16470 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16471 | default: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16472 | smsLog( pMac, LOGE, FL("Unknown stats type and counter %d"), counter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16473 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16474 | } |
| 16475 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16476 | tempMask >>=1; |
| 16477 | counter++; |
| 16478 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16479 | callback(stats, pContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16480 | } |
| 16481 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16482 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac) |
| 16483 | { |
| 16484 | tListElem *pEntry = NULL; |
| 16485 | tListElem *pPrevEntry = NULL; |
| 16486 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 16487 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16488 | VOS_STATUS vosStatus; |
| 16489 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16490 | if(!pEntry) |
| 16491 | { |
| 16492 | //list empty |
| 16493 | smsLog(pMac, LOGW, "csrRoamDeregStatisticsReq: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16494 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16495 | return status; |
| 16496 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16497 | while( pEntry ) |
| 16498 | { |
| 16499 | if(pPrevEntry) |
| 16500 | { |
| 16501 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 16502 | //send up the stats report |
| 16503 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 16504 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 16505 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 16506 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16507 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16508 | if (pTempStaEntry->pPeStaEntry) //pPeStaEntry can be NULL |
| 16509 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16510 | pTempStaEntry->pPeStaEntry->numClient--; |
| 16511 | //check if we need to delete the entry from peStatsReqList too |
| 16512 | if(!pTempStaEntry->pPeStaEntry->numClient) |
| 16513 | { |
| 16514 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry); |
| 16515 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16516 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16517 | //check if we need to stop the tl stats timer too |
| 16518 | pMac->roam.tlStatsReqInfo.numClient--; |
| 16519 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 16520 | { |
| 16521 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 16522 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 16523 | status = vos_timer_stop(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 16524 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16525 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16526 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16527 | //we will continue |
| 16528 | } |
| 16529 | } |
| 16530 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 16531 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 16532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16533 | if (pTempStaEntry->periodicity) |
| 16534 | { |
| 16535 | //While creating StaEntry in csrGetStatistics, |
| 16536 | //Initializing and starting timer only when periodicity is set. |
| 16537 | //So Stop and Destroy timer only when periodicity is set. |
| 16538 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16539 | vos_timer_stop( &pTempStaEntry->timer ); |
| 16540 | // Destroy the vos timer... |
| 16541 | vosStatus = vos_timer_destroy( &pTempStaEntry->timer ); |
| 16542 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 16543 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16544 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16545 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16546 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16547 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16548 | |
| 16549 | pPrevEntry = pEntry; |
| 16550 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 16551 | } |
| 16552 | //the last one |
| 16553 | if(pPrevEntry) |
| 16554 | { |
| 16555 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 16556 | //send up the stats report |
| 16557 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 16558 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 16559 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 16560 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16561 | return status; |
| 16562 | |
| 16563 | } |
| 16564 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16565 | eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 16566 | tRequestFullPowerReason *pReason, |
| 16567 | tANI_BOOLEAN *pfNeedPower ) |
| 16568 | { |
| 16569 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 16570 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
| 16571 | tPmcState pmcState; |
| 16572 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16573 | // TODO : Session info unavailable |
| 16574 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16575 | if( pfNeedPower ) |
| 16576 | { |
| 16577 | *pfNeedPower = eANI_BOOLEAN_FALSE; |
| 16578 | } |
| 16579 | //We only handle CSR commands |
| 16580 | if( !(eSmeCsrCommandMask & pCommand->command) ) |
| 16581 | { |
| 16582 | return eHAL_STATUS_SUCCESS; |
| 16583 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16584 | //Check PMC state first |
| 16585 | pmcState = pmcGetPmcState( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16586 | switch( pmcState ) |
| 16587 | { |
| 16588 | case REQUEST_IMPS: |
| 16589 | case IMPS: |
| 16590 | if( eSmeCommandScan == pCommand->command ) |
| 16591 | { |
| 16592 | switch( pCommand->u.scanCmd.reason ) |
| 16593 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16594 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 16595 | case eCsrScanGetLfrResult: |
| 16596 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16597 | case eCsrScanGetResult: |
| 16598 | case eCsrScanBGScanAbort: |
| 16599 | case eCsrScanBGScanEnable: |
| 16600 | case eCsrScanGetScanChnInfo: |
| 16601 | //Internal process, no need for full power |
| 16602 | fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 16603 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16604 | default: |
| 16605 | //Other scans are real scan, ask for power |
| 16606 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16607 | break; |
| 16608 | } //switch |
| 16609 | } |
| 16610 | else |
| 16611 | { |
| 16612 | //ask for power for roam and status change |
| 16613 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16614 | } |
| 16615 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16616 | case REQUEST_BMPS: |
| 16617 | case BMPS: |
| 16618 | case REQUEST_START_UAPSD: |
| 16619 | case UAPSD: |
| 16620 | //We treat WOWL same as BMPS |
| 16621 | case REQUEST_ENTER_WOWL: |
| 16622 | case WOWL: |
| 16623 | if( eSmeCommandRoam == pCommand->command ) |
| 16624 | { |
| 16625 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 16626 | tCsrScanResult *pScanResult; |
| 16627 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16628 | switch ( pCommand->u.roamCmd.roamReason ) |
| 16629 | { |
| 16630 | case eCsrForcedDisassoc: |
| 16631 | case eCsrForcedDisassocMICFailure: |
| 16632 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 16633 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16634 | break; |
| 16635 | case eCsrSmeIssuedDisassocForHandoff: |
| 16636 | case eCsrForcedDeauth: |
| 16637 | case eCsrHddIssuedReassocToSameAP: |
| 16638 | case eCsrSmeIssuedReassocToSameAP: |
| 16639 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16640 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16641 | case eCsrCapsChange: |
| 16642 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16643 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16644 | default: |
| 16645 | //Check whether the profile is already connected. If so, no need for full power |
| 16646 | //Note: IBSS is ignored for now because we don't support powersave in IBSS |
| 16647 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && pBSSList ) |
| 16648 | { |
| 16649 | //Only need to check the first one |
| 16650 | pEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 16651 | if( pEntry ) |
| 16652 | { |
| 16653 | pScanResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link); |
| 16654 | #if 0 |
| 16655 | // TODO : Session Specific info pConnectBssDesc |
| 16656 | if( csrIsBssIdEqual( pMac, &pScanResult->Result.BssDescriptor, pMac->roam.pConnectBssDesc ) && |
| 16657 | csrIsSsidEqual( pMac, pMac->roam.pConnectBssDesc, |
| 16658 | &pScanResult->Result.BssDescriptor, (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ) ) ) |
| 16659 | { |
| 16660 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 16661 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 16662 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 16663 | // a new Association. |
| 16664 | if(csrIsSameProfile(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 16665 | { |
| 16666 | if(csrRoamIsSameProfileKeys(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 16667 | { |
| 16668 | //Done, eventually, the command reaches eCsrReassocToSelfNoCapChange; |
| 16669 | //No need for full power |
| 16670 | //Set the flag so the code later can avoid to do the above |
| 16671 | //check again. |
| 16672 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_TRUE; |
| 16673 | break; |
| 16674 | } |
| 16675 | } |
| 16676 | } |
| 16677 | #endif |
| 16678 | } |
| 16679 | } |
| 16680 | //If we are here, full power is needed |
| 16681 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16682 | break; |
| 16683 | } |
| 16684 | } |
| 16685 | else if( eSmeCommandWmStatusChange == pCommand->command ) |
| 16686 | { |
| 16687 | //need full power for all |
| 16688 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16689 | reason = eSME_LINK_DISCONNECTED_BY_OTHER; |
| 16690 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16691 | #ifdef FEATURE_WLAN_TDLS |
| 16692 | else if( eSmeCommandTdlsAddPeer == pCommand->command ) |
| 16693 | { |
| 16694 | //TDLS link is getting established. need full power |
| 16695 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16696 | reason = eSME_FULL_PWR_NEEDED_BY_TDLS_PEER_SETUP; |
| 16697 | } |
| 16698 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16699 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16700 | case REQUEST_STOP_UAPSD: |
| 16701 | case REQUEST_EXIT_WOWL: |
| 16702 | if( eSmeCommandRoam == pCommand->command ) |
| 16703 | { |
| 16704 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16705 | switch ( pCommand->u.roamCmd.roamReason ) |
| 16706 | { |
| 16707 | case eCsrForcedDisassoc: |
| 16708 | case eCsrForcedDisassocMICFailure: |
| 16709 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 16710 | break; |
| 16711 | default: |
| 16712 | break; |
| 16713 | } |
| 16714 | } |
| 16715 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16716 | case STOPPED: |
| 16717 | case REQUEST_STANDBY: |
| 16718 | case STANDBY: |
| 16719 | case LOW_POWER: |
| 16720 | //We are not supposed to do anything |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16721 | smsLog( pMac, LOGE, FL( " cannot process because PMC is in stopped/standby state %d" ), pmcState ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16722 | status = eHAL_STATUS_FAILURE; |
| 16723 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16724 | case FULL_POWER: |
| 16725 | case REQUEST_FULL_POWER: |
| 16726 | default: |
| 16727 | //No need to ask for full power. This has to be FULL_POWER state |
| 16728 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16729 | } //switch |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16730 | if( pReason ) |
| 16731 | { |
| 16732 | *pReason = reason; |
| 16733 | } |
| 16734 | if( pfNeedPower ) |
| 16735 | { |
| 16736 | *pfNeedPower = fNeedFullPower; |
| 16737 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16738 | return ( status ); |
| 16739 | } |
| 16740 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16741 | static eHalStatus csrRequestFullPower( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 16742 | { |
| 16743 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16744 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 16745 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16746 | status = csrIsFullPowerNeeded( pMac, pCommand, &reason, &fNeedFullPower ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16747 | if( fNeedFullPower && HAL_STATUS_SUCCESS( status ) ) |
| 16748 | { |
| 16749 | status = pmcRequestFullPower(pMac, csrFullPowerCallback, pMac, reason); |
| 16750 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16751 | return ( status ); |
| 16752 | } |
| 16753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16754 | tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac ) |
| 16755 | { |
| 16756 | tSmeCmd *pCmd = smeGetCommandBuffer( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16757 | if( pCmd ) |
| 16758 | { |
| 16759 | pMac->roam.sPendingCommands++; |
| 16760 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16761 | return ( pCmd ); |
| 16762 | } |
| 16763 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16764 | void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 16765 | { |
| 16766 | if (pMac->roam.sPendingCommands > 0) |
| 16767 | { |
| 16768 | //All command allocated through csrGetCommandBuffer need to |
| 16769 | //decrement the pending count when releasing. |
| 16770 | pMac->roam.sPendingCommands--; |
| 16771 | smeReleaseCommand( pMac, pCommand ); |
| 16772 | } |
| 16773 | else |
| 16774 | { |
| 16775 | smsLog(pMac, LOGE, FL( "no pending commands")); |
| 16776 | VOS_ASSERT(0); |
| 16777 | } |
| 16778 | } |
| 16779 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16780 | //Return SUCCESS is the command is queued, failed |
| 16781 | eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority ) |
| 16782 | { |
| 16783 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16784 | if( (eSmeCommandScan == pCommand->command) && pMac->scan.fDropScanCmd ) |
| 16785 | { |
| 16786 | smsLog(pMac, LOGW, FL(" drop scan (scan reason %d) command"), |
| 16787 | pCommand->u.scanCmd.reason); |
| 16788 | return eHAL_STATUS_CSR_WRONG_STATE; |
| 16789 | } |
| 16790 | |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 16791 | if ((pMac->fScanOffload) && (pCommand->command == eSmeCommandScan)) |
| 16792 | { |
| 16793 | csrLLInsertTail(&pMac->sme.smeScanCmdPendingList, |
| 16794 | &pCommand->Link, LL_ACCESS_LOCK); |
| 16795 | // process the command queue... |
| 16796 | smeProcessPendingQueue(pMac); |
| 16797 | status = eHAL_STATUS_SUCCESS; |
| 16798 | goto end; |
| 16799 | } |
| 16800 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16801 | //We can call request full power first before putting the command into pending Q |
| 16802 | //because we are holding SME lock at this point. |
| 16803 | status = csrRequestFullPower( pMac, pCommand ); |
| 16804 | if( HAL_STATUS_SUCCESS( status ) ) |
| 16805 | { |
| 16806 | tANI_BOOLEAN fNoCmdPending; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16807 | //make sure roamCmdPendingList is not empty first |
| 16808 | fNoCmdPending = csrLLIsListEmpty( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_FALSE ); |
| 16809 | if( fNoCmdPending ) |
| 16810 | { |
| 16811 | smePushCommand( pMac, pCommand, fHighPriority ); |
| 16812 | } |
| 16813 | else |
| 16814 | { |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 16815 | //Other commands are waiting for PMC callback, queue the new command to the pending Q |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16816 | //no list lock is needed since SME lock is held |
| 16817 | if( !fHighPriority ) |
| 16818 | { |
| 16819 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 16820 | } |
| 16821 | else { |
| 16822 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 16823 | } |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 16824 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16825 | } |
| 16826 | else if( eHAL_STATUS_PMC_PENDING == status ) |
| 16827 | { |
| 16828 | //no list lock is needed since SME lock is held |
| 16829 | if( !fHighPriority ) |
| 16830 | { |
| 16831 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 16832 | } |
| 16833 | else { |
| 16834 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 16835 | } |
| 16836 | //Let caller know the command is queue |
| 16837 | status = eHAL_STATUS_SUCCESS; |
| 16838 | } |
| 16839 | else |
| 16840 | { |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 16841 | //Not to decrease pMac->roam.sPendingCommands here. Caller will decrease it when it |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16842 | //release the command. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16843 | smsLog( pMac, LOGE, FL( " cannot queue command %d" ), pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16844 | } |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 16845 | end: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16846 | return ( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16847 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16848 | eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs* pAPWPSIES ) |
| 16849 | { |
| 16850 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16851 | tSirUpdateAPWPSIEsReq *pMsg; |
| 16852 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 16853 | |
| 16854 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 16855 | if (NULL == pSession) |
| 16856 | { |
| 16857 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 16858 | return eHAL_STATUS_FAILURE; |
| 16859 | } |
| 16860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16861 | do |
| 16862 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16863 | pMsg = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq)); |
| 16864 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 16865 | vos_mem_set(pMsg, sizeof(tSirUpdateAPWPSIEsReq), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16866 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPDATE_APWPSIE_REQ); |
| 16867 | |
| 16868 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 16869 | VOS_ASSERT(pBuf); |
| 16870 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16871 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16872 | // transactionId |
| 16873 | *pBuf = 0; |
| 16874 | *( pBuf + 1 ) = 0; |
| 16875 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16876 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16877 | vos_mem_copy((tSirMacAddr *)pBuf, &pSession->selfMacAddr, |
| 16878 | sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16879 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16880 | //sessionId |
| 16881 | *pBuf++ = (tANI_U8)sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16882 | // APWPSIEs |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16883 | vos_mem_copy((tSirAPWPSIEs *)pBuf, pAPWPSIES, sizeof(tSirAPWPSIEs)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16884 | pBuf += sizeof(tSirAPWPSIEs); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16885 | 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] | 16886 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16887 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16888 | return ( status ); |
| 16889 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16890 | eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie) |
| 16891 | { |
| 16892 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16893 | tSirUpdateAPWPARSNIEsReq *pMsg; |
| 16894 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16895 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 16896 | if (NULL == pSession) |
| 16897 | { |
| 16898 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 16899 | return eHAL_STATUS_FAILURE; |
| 16900 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16901 | do |
| 16902 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16903 | pMsg = vos_mem_malloc(sizeof(tSirUpdateAPWPARSNIEsReq)); |
| 16904 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 16905 | vos_mem_set(pMsg, sizeof( tSirUpdateAPWPARSNIEsReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16906 | 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] | 16907 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 16908 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16909 | // transactionId |
| 16910 | *pBuf = 0; |
| 16911 | *( pBuf + 1 ) = 0; |
| 16912 | pBuf += sizeof(tANI_U16); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 16913 | VOS_ASSERT(pBuf); |
| 16914 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16915 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16916 | vos_mem_copy((tSirMacAddr *)pBuf, &pSession->selfMacAddr, |
| 16917 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16918 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16919 | // sessionId |
| 16920 | *pBuf++ = (tANI_U8)sessionId; |
| 16921 | |
| 16922 | // APWPARSNIEs |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16923 | vos_mem_copy((tSirRSNie *)pBuf, pAPSirRSNie, sizeof(tSirRSNie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16924 | pBuf += sizeof(tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16925 | 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] | 16926 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16927 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16928 | return ( status ); |
| 16929 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16930 | |
| 16931 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 16932 | //eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tCsrBssid preAuthBssid, tANI_U8 channelId) |
| 16933 | eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription) |
| 16934 | { |
| 16935 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 16936 | tpSirFTPreAuthReq pftPreAuthReq; |
| 16937 | tANI_U16 auth_req_len = 0; |
| 16938 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16939 | auth_req_len = sizeof(tSirFTPreAuthReq); |
| 16940 | pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16941 | if (NULL == pftPreAuthReq) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16942 | { |
| 16943 | smsLog(pMac, LOGE, FL("Memory allocation for FT Preauth request failed")); |
| 16944 | return eHAL_STATUS_RESOURCES; |
| 16945 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16946 | // Save the SME Session ID here. We need it while processing the preauth response |
| 16947 | pMac->ft.ftSmeContext.smeSessionId = sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16948 | vos_mem_zero(pftPreAuthReq, auth_req_len); |
| 16949 | |
| 16950 | pftPreAuthReq->pbssDescription = (tpSirBssDescription)vos_mem_malloc( |
| 16951 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 16952 | |
| 16953 | pftPreAuthReq->messageType = pal_cpu_to_be16(eWNI_SME_FT_PRE_AUTH_REQ); |
| 16954 | |
| 16955 | pftPreAuthReq->preAuthchannelNum = pBssDescription->channelId; |
| 16956 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16957 | vos_mem_copy((void *)&pftPreAuthReq->currbssId, |
| 16958 | (void *)pSession->connectedProfile.bssid, sizeof(tSirMacAddr)); |
| 16959 | vos_mem_copy((void *)&pftPreAuthReq->preAuthbssId, |
| 16960 | (void *)pBssDescription->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16961 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16962 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 16963 | if (csrRoamIs11rAssoc(pMac) && |
| 16964 | (pMac->roam.roamSession[sessionId].connectedProfile.AuthType != eCSR_AUTH_TYPE_OPEN_SYSTEM)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16965 | { |
| 16966 | pftPreAuthReq->ft_ies_length = (tANI_U16)pMac->ft.ftSmeContext.auth_ft_ies_length; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16967 | vos_mem_copy(pftPreAuthReq->ft_ies, pMac->ft.ftSmeContext.auth_ft_ies, |
| 16968 | pMac->ft.ftSmeContext.auth_ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16969 | } |
| 16970 | else |
| 16971 | #endif |
| 16972 | { |
| 16973 | pftPreAuthReq->ft_ies_length = 0; |
| 16974 | } |
Madan Mohan Koyyalamudi | 613b0a4 | 2012-10-31 15:55:53 -0700 | [diff] [blame] | 16975 | vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription, |
| 16976 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 16977 | pftPreAuthReq->length = pal_cpu_to_be16(auth_req_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16978 | return palSendMBMessage(pMac->hHdd, pftPreAuthReq); |
| 16979 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16980 | /*-------------------------------------------------------------------------- |
| 16981 | * This will receive and process the FT Pre Auth Rsp from the current |
| 16982 | * associated ap. |
| 16983 | * |
| 16984 | * This will invoke the hdd call back. This is so that hdd can now |
| 16985 | * send the FTIEs from the Auth Rsp (Auth Seq 2) to the supplicant. |
| 16986 | ------------------------------------------------------------------------*/ |
| 16987 | void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp ) |
| 16988 | { |
| 16989 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 16990 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16991 | #if defined(FEATURE_WLAN_LFR) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_ESE_UPLOAD) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16992 | tCsrRoamInfo roamInfo; |
| 16993 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16994 | |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 16995 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 16996 | status = csrNeighborRoamPreauthRspHandler(pMac, pFTPreAuthRsp->status); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 16997 | if (status != eHAL_STATUS_SUCCESS) { |
| 16998 | /* |
| 16999 | * Bail out if pre-auth was not even processed. |
| 17000 | */ |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 17001 | smsLog(pMac, LOGE,FL("Preauth was not processed: %d SessionID: %d"), |
| 17002 | status, pFTPreAuthRsp->smeSessionId); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 17003 | return; |
| 17004 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17005 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17006 | /* The below function calls/timers should be invoked only if the pre-auth is successful */ |
| 17007 | if (VOS_STATUS_SUCCESS != (VOS_STATUS)pFTPreAuthRsp->status) |
| 17008 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17009 | // Implies a success |
| 17010 | pMac->ft.ftSmeContext.FTState = eFT_AUTH_COMPLETE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17011 | // Indicate SME QoS module the completion of Preauth success. This will trigger the creation of RIC IEs |
| 17012 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = pFTPreAuthRsp; |
Tushnim Bhattacharyya | 8436d77 | 2013-06-26 23:03:29 -0700 | [diff] [blame] | 17013 | /* No need to notify qos module if this is a non 11r roam*/ |
| 17014 | if (csrRoamIs11rAssoc(pMac)) |
| 17015 | { |
| 17016 | sme_QosCsrEventInd(pMac, pMac->ft.ftSmeContext.smeSessionId, SME_QOS_CSR_PREAUTH_SUCCESS_IND, NULL); |
| 17017 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17018 | /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, |
| 17019 | * actual transition from the current to handoff AP is triggered */ |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 17020 | status = vos_timer_start(&pMac->ft.ftSmeContext.preAuthReassocIntvlTimer, |
| 17021 | 60); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17022 | if (eHAL_STATUS_SUCCESS != status) |
| 17023 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17024 | smsLog(pMac, LOGE, FL("Preauth reassoc interval timer start failed to start with status %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17025 | return; |
| 17026 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17027 | // Save the received response |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17028 | vos_mem_copy((void *)&pMac->ft.ftSmeContext.preAuthbssId, |
| 17029 | (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17030 | if (csrRoamIs11rAssoc(pMac)) |
| 17031 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, NULL, 0, |
| 17032 | eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE); |
| 17033 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 17034 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
| 17035 | if (csrRoamIsESEAssoc(pMac)) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17036 | { |
| 17037 | /* read TSF */ |
| 17038 | csrRoamReadTSF(pMac, (tANI_U8 *)roamInfo.timestamp); |
| 17039 | |
| 17040 | // Save the bssid from the received response |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 17041 | vos_mem_copy((void *)&roamInfo.bssid, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17042 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_CCKM_PREAUTH_NOTIFY, 0); |
| 17043 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 17044 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17045 | #ifdef FEATURE_WLAN_LFR |
| 17046 | // If Legacy Fast Roaming is enabled, signal the supplicant |
| 17047 | // 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] | 17048 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17049 | { |
| 17050 | // Save the bssid from the received response |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17051 | vos_mem_copy((void *)&roamInfo.bssid, |
| 17052 | (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17053 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_PMK_NOTIFY, 0); |
| 17054 | } |
| 17055 | |
| 17056 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17057 | |
| 17058 | // Done with it, init it. |
| 17059 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL; |
| 17060 | } |
| 17061 | #endif |
| 17062 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 17063 | void csrRoamJoinRetryTimerHandler(void *pv) |
| 17064 | { |
| 17065 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 17066 | tpAniSirGlobal pMac = pInfo->pMac; |
| 17067 | tANI_U32 sessionId = pInfo->sessionId; |
| 17068 | tCsrRoamSession *pSession; |
| 17069 | |
| 17070 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 17071 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17072 | smsLog( pMac, LOGE, FL( " retrying the last roam profile on session %d" ), sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17073 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 17074 | if(pSession->pCurRoamProfile && csrIsConnStateDisconnected(pMac, sessionId)) |
| 17075 | { |
| 17076 | if( !HAL_STATUS_SUCCESS(csrRoamJoinLastProfile(pMac, sessionId)) ) |
| 17077 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17078 | smsLog( pMac, LOGE, FL( " fail to retry the last roam profile" ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17079 | } |
| 17080 | } |
| 17081 | } |
| 17082 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17083 | eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 17084 | { |
| 17085 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 17086 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 17087 | |
| 17088 | if(pSession->pCurRoamProfile && pSession->maxRetryCount) |
| 17089 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17090 | smsLog(pMac, LOGE, FL(" call sessionId %d retry count %d left"), sessionId, pSession->maxRetryCount); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17091 | pSession->maxRetryCount--; |
| 17092 | pSession->joinRetryTimerInfo.pMac = pMac; |
| 17093 | pSession->joinRetryTimerInfo.sessionId = (tANI_U8)sessionId; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 17094 | status = vos_timer_start(&pSession->hTimerJoinRetry, interval/PAL_TIMER_TO_MS_UNIT); |
| 17095 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17096 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17097 | smsLog(pMac, LOGE, FL(" fail to start timer status %s"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17098 | } |
| 17099 | } |
| 17100 | else |
| 17101 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17102 | smsLog(pMac, LOGE, FL(" not to start timer due to no profile or reach mac ret (%d)"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17103 | pSession->maxRetryCount); |
| 17104 | } |
| 17105 | |
| 17106 | return (status); |
| 17107 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17108 | eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 17109 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17110 | smsLog(pMac, LOGE, " csrRoamStopJoinRetryTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17111 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 17112 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 17113 | return (vos_timer_stop(&pMac->roam.roamSession[sessionId].hTimerJoinRetry)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17114 | } |
| 17115 | |
| 17116 | return eHAL_STATUS_SUCCESS; |
| 17117 | } |
| 17118 | #endif |
| 17119 | |
| 17120 | |
| 17121 | /* |
| 17122 | pBuf points to the beginning of the message |
| 17123 | LIM packs disassoc rsp as below, |
| 17124 | messageType - 2 bytes |
| 17125 | messageLength - 2 bytes |
| 17126 | sessionId - 1 byte |
| 17127 | transactionId - 2 bytes (tANI_U16) |
| 17128 | reasonCode - 4 bytes (sizeof(tSirResultCodes)) |
| 17129 | peerMacAddr - 6 bytes |
| 17130 | The rest is conditionally defined of (WNI_POLARIS_FW_PRODUCT == AP) and not used |
| 17131 | */ |
| 17132 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp) |
| 17133 | { |
| 17134 | if(pBuf && pRsp) |
| 17135 | { |
| 17136 | pBuf += 4; //skip type and length |
| 17137 | pRsp->sessionId = *pBuf++; |
| 17138 | pal_get_U16( pBuf, (tANI_U16 *)&pRsp->transactionId ); |
| 17139 | pBuf += 2; |
| 17140 | pal_get_U32( pBuf, (tANI_U32 *)&pRsp->statusCode ); |
| 17141 | pBuf += 4; |
| 17142 | vos_mem_copy(pRsp->peerMacAddr, pBuf, 6); |
| 17143 | } |
| 17144 | } |
| 17145 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 17146 | eHalStatus csrGetDefaultCountryCodeFrmNv(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 17147 | { |
| 17148 | static uNvTables nvTables; |
| 17149 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17150 | VOS_STATUS vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 17151 | |
| 17152 | /* read the country code from NV and use it */ |
| 17153 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 17154 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17155 | vos_mem_copy(pCountry, nvTables.defaultCountryTable.countryCode, |
| 17156 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 17157 | return status; |
| 17158 | } |
| 17159 | else |
| 17160 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17161 | vos_mem_copy(pCountry, "XXX", WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 17162 | status = eHAL_STATUS_FAILURE; |
| 17163 | return status; |
| 17164 | } |
| 17165 | } |
| 17166 | |
| 17167 | eHalStatus csrGetCurrentCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 17168 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17169 | vos_mem_copy(pCountry, pMac->scan.countryCode11d, WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 17170 | return eHAL_STATUS_SUCCESS; |
| 17171 | } |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 17172 | |
| 17173 | eHalStatus csrSetTxPower(tpAniSirGlobal pMac, v_U8_t sessionId, v_U8_t mW) |
| 17174 | { |
| 17175 | tSirSetTxPowerReq *pMsg = NULL; |
| 17176 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17177 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 17178 | |
| 17179 | if (!pSession) |
| 17180 | { |
| 17181 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 17182 | return eHAL_STATUS_FAILURE; |
| 17183 | } |
| 17184 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17185 | pMsg = vos_mem_malloc(sizeof(tSirSetTxPowerReq)); |
| 17186 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 17187 | vos_mem_set((void *)pMsg, sizeof(tSirSetTxPowerReq), 0); |
| 17188 | pMsg->messageType = eWNI_SME_SET_TX_POWER_REQ; |
| 17189 | pMsg->length = sizeof(tSirSetTxPowerReq); |
| 17190 | pMsg->mwPower = mW; |
| 17191 | vos_mem_copy((tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, |
| 17192 | sizeof(tSirMacAddr)); |
| 17193 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 17194 | if (!HAL_STATUS_SUCCESS(status)) |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 17195 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17196 | smsLog(pMac, LOGE, FL(" csr set TX Power Post MSG Fail %d "), status); |
| 17197 | //pMsg is freed by palSendMBMessage |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 17198 | } |
| 17199 | return status; |
| 17200 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 17201 | |
Sandeep Puligilla | 332ea91 | 2014-02-04 00:16:24 +0530 | [diff] [blame] | 17202 | eHalStatus csrHT40StopOBSSScan(tpAniSirGlobal pMac, v_U8_t sessionId) |
| 17203 | { |
| 17204 | tSirSmeHT40OBSSStopScanInd *pMsg = NULL; |
| 17205 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17206 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 17207 | |
| 17208 | if (!pSession) |
| 17209 | { |
| 17210 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 17211 | return eHAL_STATUS_FAILURE; |
| 17212 | } |
| 17213 | if(IS_HT40_OBSS_SCAN_FEATURE_ENABLE) |
| 17214 | { |
| 17215 | pMsg = vos_mem_malloc(sizeof(tSirSmeHT40OBSSStopScanInd)); |
| 17216 | vos_mem_zero((void *)pMsg, sizeof(tSirSmeHT40OBSSStopScanInd)); |
| 17217 | pMsg->messageType = eWNI_SME_HT40_STOP_OBSS_SCAN_IND; |
| 17218 | pMsg->length = sizeof(tANI_U8); |
| 17219 | pMsg->seesionId = sessionId; |
| 17220 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 17221 | if (!HAL_STATUS_SUCCESS(status)) |
| 17222 | { |
| 17223 | smsLog(pMac, LOGE, FL(" csr STOP OBSS SCAN Fail %d "), status); |
| 17224 | //pMsg is freed by palSendMBMessage |
| 17225 | } |
| 17226 | } |
| 17227 | else |
| 17228 | { |
| 17229 | smsLog(pMac, LOGE, FL(" OBSS STOP OBSS SCAN is not supported")); |
| 17230 | status = eHAL_STATUS_FAILURE; |
| 17231 | } |
| 17232 | return status; |
| 17233 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 17234 | /* Returns whether a session is in VOS_STA_MODE...or not */ |
| 17235 | tANI_BOOLEAN csrRoamIsStaMode(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 17236 | { |
| 17237 | tCsrRoamSession *pSession = NULL; |
| 17238 | pSession = CSR_GET_SESSION ( pMac, sessionId ); |
| 17239 | if(!pSession) |
| 17240 | { |
| 17241 | smsLog(pMac, LOGE, FL(" %s: session %d not found "), __func__, sessionId); |
| 17242 | return eANI_BOOLEAN_FALSE; |
| 17243 | } |
| 17244 | if ( !CSR_IS_SESSION_VALID ( pMac, sessionId ) ) |
| 17245 | { |
| 17246 | smsLog(pMac, LOGE, FL(" %s: Inactive session"), __func__); |
| 17247 | return eANI_BOOLEAN_FALSE; |
| 17248 | } |
| 17249 | if ( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 17250 | { |
| 17251 | return eANI_BOOLEAN_FALSE; |
| 17252 | } |
| 17253 | /* There is a possibility that the above check may fail,because |
| 17254 | * P2P CLI also uses the same BSSType (eCSR_BSS_TYPE_INFRASTRUCTURE) |
| 17255 | * when it is connected.So,we may sneak through the above check even |
| 17256 | * if we are not a STA mode INFRA station. So, if we sneak through |
| 17257 | * the above condition, we can use the following check if we are |
| 17258 | * really in STA Mode.*/ |
| 17259 | |
| 17260 | if ( NULL != pSession->pCurRoamProfile ) |
| 17261 | { |
| 17262 | if ( pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE ) |
| 17263 | { |
| 17264 | return eANI_BOOLEAN_TRUE; |
| 17265 | } else { |
| 17266 | smsLog(pMac, LOGE, FL(" %s: pCurRoamProfile is NULL\n"), __func__); |
| 17267 | return eANI_BOOLEAN_FALSE; |
| 17268 | } |
| 17269 | } |
| 17270 | |
| 17271 | return eANI_BOOLEAN_FALSE; |
| 17272 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 17273 | |
| 17274 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 17275 | eHalStatus csrHandoffRequest(tpAniSirGlobal pMac, |
| 17276 | tCsrHandoffRequest *pHandoffInfo) |
| 17277 | { |
| 17278 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17279 | vos_msg_t msg; |
| 17280 | |
| 17281 | tAniHandoffReq *pMsg; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17282 | pMsg = vos_mem_malloc(sizeof(tAniHandoffReq)); |
| 17283 | if ( NULL == pMsg ) |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 17284 | { |
| 17285 | smsLog(pMac, LOGE, " csrHandoffRequest: failed to allocate mem for req "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17286 | return eHAL_STATUS_FAILURE; |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 17287 | } |
| 17288 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_HANDOFF_REQ); |
| 17289 | pMsg->msgLen = (tANI_U16)sizeof(tAniHandoffReq); |
| 17290 | pMsg->sessionId = pMac->roam.neighborRoamInfo.csrSessionId; |
| 17291 | pMsg->channel = pHandoffInfo->channel; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17292 | vos_mem_copy(pMsg->bssid, |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 17293 | pHandoffInfo->bssid, |
| 17294 | 6); |
| 17295 | msg.type = eWNI_SME_HANDOFF_REQ; |
| 17296 | msg.bodyptr = pMsg; |
| 17297 | msg.reserved = 0; |
| 17298 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 17299 | { |
| 17300 | smsLog(pMac, LOGE, " csrHandoffRequest failed to post msg to self "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17301 | vos_mem_free((void *)pMsg); |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 17302 | status = eHAL_STATUS_FAILURE; |
| 17303 | } |
| 17304 | return status; |
| 17305 | } |
| 17306 | #endif /* WLAN_FEATURE_ROAM_SCAN_OFFLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17307 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 17308 | |
| 17309 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17310 | /* --------------------------------------------------------------------------- |
| 17311 | \fn csrSetCCKMIe |
| 17312 | \brief This function stores the CCKM IE passed by the supplicant in a place holder |
| 17313 | data structure and this IE will be packed inside reassociation request |
| 17314 | \param pMac - pMac global structure |
| 17315 | \param sessionId - Current session id |
| 17316 | \param pCckmIe - pointer to CCKM IE data |
| 17317 | \param ccKmIeLen - length of the CCKM IE |
| 17318 | \- return Success or failure |
| 17319 | -------------------------------------------------------------------------*/ |
| 17320 | VOS_STATUS csrSetCCKMIe(tpAniSirGlobal pMac, const tANI_U8 sessionId, |
| 17321 | const tANI_U8 *pCckmIe, |
| 17322 | const tANI_U8 ccKmIeLen) |
| 17323 | { |
| 17324 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17325 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 17326 | |
| 17327 | if (!pSession) |
| 17328 | { |
| 17329 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 17330 | return eHAL_STATUS_FAILURE; |
| 17331 | } |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 17332 | vos_mem_copy(pSession->suppCckmIeInfo.cckmIe, pCckmIe, ccKmIeLen); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17333 | pSession->suppCckmIeInfo.cckmIeLen = ccKmIeLen; |
| 17334 | return status; |
| 17335 | } |
| 17336 | |
| 17337 | /* --------------------------------------------------------------------------- |
| 17338 | \fn csrRoamReadTSF |
| 17339 | \brief This function reads the TSF; and also add the time elapsed since last beacon or |
| 17340 | probe response reception from the hand off AP to arrive at the latest TSF value. |
| 17341 | \param pMac - pMac global structure |
| 17342 | \param pTimestamp - output TSF timestamp |
| 17343 | \- return Success or failure |
| 17344 | -------------------------------------------------------------------------*/ |
| 17345 | VOS_STATUS csrRoamReadTSF(tpAniSirGlobal pMac, tANI_U8 *pTimestamp) |
| 17346 | { |
| 17347 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17348 | tCsrNeighborRoamBSSInfo handoffNode; |
| 17349 | tANI_U32 timer_diff = 0; |
| 17350 | tANI_U32 timeStamp[2]; |
| 17351 | tpSirBssDescription pBssDescription = NULL; |
| 17352 | |
| 17353 | csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode); |
| 17354 | pBssDescription = handoffNode.pBssDescription; |
| 17355 | |
| 17356 | // Get the time diff in milli seconds |
| 17357 | timer_diff = vos_timer_get_system_time() - pBssDescription->scanSysTimeMsec; |
| 17358 | // Convert msec to micro sec timer |
| 17359 | timer_diff = (tANI_U32)(timer_diff * SYSTEM_TIME_MSEC_TO_USEC); |
| 17360 | |
| 17361 | timeStamp[0] = pBssDescription->timeStamp[0]; |
| 17362 | timeStamp[1] = pBssDescription->timeStamp[1]; |
| 17363 | |
| 17364 | UpdateCCKMTSF(&(timeStamp[0]), &(timeStamp[1]), &timer_diff); |
| 17365 | |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 17366 | vos_mem_copy(pTimestamp, (void *) &timeStamp[0], |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17367 | sizeof (tANI_U32) * 2); |
| 17368 | return status; |
| 17369 | } |
| 17370 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 17371 | #endif /*FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17372 | |